From 9a09ab8f7f52b940c98990aaa2bfe78aa845692c Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 19 Nov 2026 12:05:05 +0700 Subject: [PATCH 1/2] fix(playback): avoid forwarding signed stream URLs to CORS proxy --- utils/radio-source-plan.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/radio-source-plan.mjs b/utils/radio-source-plan.mjs index 4cdc43e6..c29833fa 100644 --- a/utils/radio-source-plan.mjs +++ b/utils/radio-source-plan.mjs @@ -43,7 +43,10 @@ export const buildPlaybackSources = (sources, corsServer) => { let hasCredentials = false; try { const parsed = new URL(src); - hasCredentials = Boolean(parsed.username || parsed.password); + // Signed stream URLs must not be forwarded to third-party CORS proxies. + const sensitiveQuery = [...parsed.searchParams.keys()].some(key => + /^(?:token|access[_-]?key|api[_-]?key|auth(?:orization)?|signature|sig|secret|password|jwt|expires?|policy|key[_-]?pair[_-]?id)$/i.test(key)); + hasCredentials = Boolean(parsed.username || parsed.password || sensitiveQuery); } catch { /* Invalid URLs are not eligible for proxy fallback. */ hasCredentials = true; } From 22db8531c04e194688b1aaccb7ccfe31c9801103 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 19 Nov 2026 12:05:10 +0700 Subject: [PATCH 2/2] test(playback): cover signed query proxy suppression --- tests/radio-source-plan.test.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/radio-source-plan.test.mjs b/tests/radio-source-plan.test.mjs index 1c00af0d..bba4bcfe 100644 --- a/tests/radio-source-plan.test.mjs +++ b/tests/radio-source-plan.test.mjs @@ -148,3 +148,19 @@ test("does not disclose embedded stream credentials through a CORS proxy", () => ]); assert.equal(result.filter(item => item.proxied).length, 1); }); + + +test("never forwards signed query credentials to a third-party proxy", () => { + const sources = [ + { src: "https://radio.example/live.mp3?token=private-test-value" }, + { src: "https://radio.example/live.aac?accessKey=private-test-value" }, + { src: "https://radio.example/live.mp3?Signature=private-test-value" }, + { src: "https://radio.example/live.mp3?quality=high" }, + ]; + const result = buildPlaybackSources(sources, "https://cors.example/"); + assert.deepEqual(result.map(item => item.src), [ + ...sources.slice(0, 3).map(item => item.src), + "https://radio.example/live.mp3?quality=high", + "https://cors.example/https://radio.example/live.mp3?quality=high", + ]); +});