From f1e75301698d4219d158bcc3d663c271e534a0f8 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Mon, 23 Nov 2026 22:41:32 +0700 Subject: [PATCH 1/2] fix(playback): reject proxy bases with empty query or fragment delimiters --- utils/radio-source-plan.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/radio-source-plan.mjs b/utils/radio-source-plan.mjs index 69493611..8631b81c 100644 --- a/utils/radio-source-plan.mjs +++ b/utils/radio-source-plan.mjs @@ -7,7 +7,7 @@ const normalizeProxyBase = (value) => { // an unusable playback candidate (or exposing credentials in its URL). try { const url = new URL(base); - if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) return ""; + if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || base.includes("?") || base.includes("#")) return ""; return base.endsWith("/") ? base : `${base}/`; } catch { return ""; } }; From 55234897f31cb7aede2344c10ffcd603ba0c4be2 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Mon, 23 Nov 2026 22:41:43 +0700 Subject: [PATCH 2/2] test(playback): cover empty proxy URL delimiters --- 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 16b96798..50306600 100644 --- a/tests/radio-source-plan.test.mjs +++ b/tests/radio-source-plan.test.mjs @@ -216,3 +216,19 @@ test("does not re-proxy an already proxied URL with canonical-equivalent host ca [otherStream, "https://cors.example/https://radio.example/live.mp3"], ); }); + +test("rejects proxy URLs with empty query or fragment delimiters", () => { + const source = [{ src: "https://radio.example/live.mp3" }]; + for (const proxy of [ + "https://proxy.example/?", + "https://proxy.example/#", + "https://proxy.example/path?", + "https://proxy.example/path#", + ]) { + assert.deepEqual( + buildPlaybackSources(source, proxy).map(item => item.src), + [source[0].src], + proxy, + ); + } +});