From acc4ca70ab32a2d80d82cabd7dbc7ae65ab31e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tatsat=20=28Tats=29=20Mishra=20=F0=9F=90=89?= Date: Mon, 30 Nov 2026 11:57:40 +1300 Subject: [PATCH] Potential fix for code scanning alert no. 5: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/run.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/run.test.ts b/src/run.test.ts index 51bca3f..384edc7 100644 --- a/src/run.test.ts +++ b/src/run.test.ts @@ -664,8 +664,9 @@ describe('run.ts', () => { stubDownloadChain() inputs('3.14', '', '', 'https://fallback.tld') vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => { - const url = String(input) - if (url.startsWith(downloadBaseURL)) { + const requestUrl = new URL(String(input)) + const primaryBaseUrl = new URL(downloadBaseURL) + if (requestUrl.origin === primaryBaseUrl.origin) { throw new Error('Primary unavailable') } return {