fix: parse webhook URL pathname instead of raw string match

Fixes incorrect path matching that would reject valid webhooks with
querystrings and match unintended prefixes like /linq-webhookX.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
George McCain
2026-02-13 16:20:28 -05:00
committed by Peter Steinberger
parent d4a142fd8f
commit 60bd154e5a

View File

@@ -372,7 +372,8 @@ export async function monitorLinqProvider(opts: MonitorLinqOpts = {}): Promise<v
const port = linqCfg.webhookUrl ? new URL(linqCfg.webhookUrl).port || "0" : "0";
const server: Server = createServer(async (req: IncomingMessage, res: ServerResponse) => {
if (req.method !== "POST" || !req.url?.startsWith(webhookPath)) {
const url = new URL(req.url || "/", `http://${req.headers.host}`);
if (req.method !== "POST" || !url.pathname.startsWith(webhookPath)) {
res.writeHead(404);
res.end();
return;