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

test: exact host membership in MITM hosts test — CodeQL FP (#660)

Diego Rodrigues de Sa e Souza3b2a2f02a94c
diff --git a/tests/unit/mitm-tool-hosts.test.ts b/tests/unit/mitm-tool-hosts.test.ts
index 9023cfabf7..eee684019b 100644
--- a/tests/unit/mitm-tool-hosts.test.ts
+++ b/tests/unit/mitm-tool-hosts.test.ts
@@ -21,6 +21,9 @@ test("MITM_TOOL_HOSTS stays in sync with the canonical MITM target registry", ()
});
test("getMitmToolHosts returns the hosts for a known tool and [] for unknown ids", () => {
- assert.ok(getMitmToolHosts("antigravity").includes("cloudcode-pa.googleapis.com"));
+ // Exact array-element membership (getMitmToolHosts returns string[]). Use `.some(===)`
+ // rather than `.includes()` so CodeQL's js/incomplete-url-substring-sanitization does not
+ // misread this Array.includes as a String.includes URL-substring check (false positive).
+ assert.ok(getMitmToolHosts("antigravity").some((h) => h === "cloudcode-pa.googleapis.com"));
assert.deepEqual(getMitmToolHosts("does-not-exist"), []);
});