From 88288fc9602e23b01d9811687d1a1cc787bcfe12 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 19 Nov 2026 18:12:18 +0700 Subject: [PATCH 1/2] fix(playback): keep cloud-signed stream URLs out of proxy fallback --- utils/radio-source-plan.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/radio-source-plan.mjs b/utils/radio-source-plan.mjs index c29833fa..bfc5f461 100644 --- a/utils/radio-source-plan.mjs +++ b/utils/radio-source-plan.mjs @@ -43,9 +43,9 @@ export const buildPlaybackSources = (sources, corsServer) => { let hasCredentials = false; try { const parsed = new URL(src); - // Signed stream URLs must not be forwarded to third-party CORS proxies. + // Signed stream URLs (including AWS/GCS provider-specific query fields) must not reach third-party 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)); + /^(?:x-amz-.+|x-goog-.+|awsaccesskeyid|googleaccessid|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 94b8a999f11785f6b2cc03b64e755eb361164737 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Thu, 19 Nov 2026 18:12:24 +0700 Subject: [PATCH 2/2] test(playback): guard AWS and GCS signed URL proxy leakage --- tests/radio-source-plan.test.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/radio-source-plan.test.mjs b/tests/radio-source-plan.test.mjs index bba4bcfe..9ee20b65 100644 --- a/tests/radio-source-plan.test.mjs +++ b/tests/radio-source-plan.test.mjs @@ -164,3 +164,24 @@ test("never forwards signed query credentials to a third-party proxy", () => { "https://cors.example/https://radio.example/live.mp3?quality=high", ]); }); + +test("never forwards cloud-provider signed stream query parameters to a third-party proxy", () => { + const signed = [ + "https://radio.example/live.mp3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=test&X-Amz-Signature=test", + "https://radio.example/live.aac?X-Amz-Security-Token=test", + "https://radio.example/live.mp3?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Signature=test", + "https://radio.example/live.mp3?AWSAccessKeyId=test", + "https://radio.example/live.mp3?GoogleAccessId=test", + ]; + const ordinary = "https://radio.example/live.mp3?quality=high"; + const result = buildPlaybackSources( + [...signed, ordinary].map(src => ({ src })), + "https://cors.example/", + ); + assert.deepEqual(result.map(item => item.src), [ + ...signed, + ordinary, + `https://cors.example/${ordinary}`, + ]); + assert.equal(result.filter(item => item.proxied).length, 1); +});