From 4ebcf46df42484c68a3634afb113c4cb4d06e1ef Mon Sep 17 00:00:00 2001 From: scanash00 Date: Sat, 18 Oct 2025 01:44:00 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/voteWebhook.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/voteWebhook.ts b/src/routes/voteWebhook.ts index ad9e773..4b027e2 100644 --- a/src/routes/voteWebhook.ts +++ b/src/routes/voteWebhook.ts @@ -1,11 +1,19 @@ import { Router } from 'express'; import { recordVote } from '../utils/voteManager'; import logger from '../utils/logger'; -import { authenticateTopGG } from '../middlewares/verifyApiKey'; const router = Router(); -router.all('/webhooks/topgg', authenticateTopGG, async (req, res) => { +router.all('/webhooks/topgg', async (req, res) => { + const authHeader = req.headers.authorization; + if (!authHeader || authHeader !== process.env.TOPGG_WEBHOOK_AUTH) { + logger.warn('Unauthorized webhook attempt', { + ip: req.ip, + headers: req.headers, + timestamp: new Date().toISOString() + }); + return res.status(401).json({ error: 'Unauthorized' }); + } if (req.method === 'GET') { return res.status(200).json({ success: true, message: 'Webhook is active' }); } -- 2.51.2