fix(security): replace includes with startsWith for CodeQL url sanitization

This commit is contained in:
diegosouzapw
2026-04-07 23:56:10 -03:00
parent 6fada51fe8
commit 67740a00bd

View File

@@ -806,7 +806,7 @@ test("chatCore refreshes GitHub credentials after 401 and retries with the refre
refreshedCredentials = updated;
},
responseFactory(captured, seenCalls) {
if (captured.url.includes("https://api.github.com/copilot_internal/v2/token")) {
if (captured.url.startsWith("https://api.github.com/copilot_internal/v2/token")) {
return new Response(
JSON.stringify({
token: "copilot-refreshed-token",
@@ -820,7 +820,7 @@ test("chatCore refreshes GitHub credentials after 401 and retries with the refre
}
const providerCalls = seenCalls.filter((entry) =>
entry.url.includes("https://api.githubcopilot.com/")
entry.url.startsWith("https://api.githubcopilot.com/")
);
if (providerCalls.length === 1) {
return new Response(
@@ -839,7 +839,7 @@ test("chatCore refreshes GitHub credentials after 401 and retries with the refre
});
const payload = await result.response.json();
const providerCalls = calls.filter((entry) => entry.url.includes("https://api.githubcopilot.com/"));
const providerCalls = calls.filter((entry) => entry.url.startsWith("https://api.githubcopilot.com/"));
assert.equal(result.success, true);
assert.equal(providerCalls.length, 2);