Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

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

diegosouzapw67740a00bd94
diff --git a/tests/unit/chatcore-translation-paths.test.mjs b/tests/unit/chatcore-translation-paths.test.mjs
index 5d1f849580..dbb33677af 100644
--- a/tests/unit/chatcore-translation-paths.test.mjs
+++ b/tests/unit/chatcore-translation-paths.test.mjs
@@ -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);