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>
This commit is contained in:
Tatsat (Tats) Mishra 🐉
2026-11-30 11:57:40 +13:00
committed by GitHub
parent 206711cbe5
commit acc4ca70ab
+3 -2
View File
@@ -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 {