mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(security): replace includes with startsWith for CodeQL url sanitization
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user