mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Port the release/v3.8.44 fix to main so the code-scanning alert closes on
the default branch. Parse the URL and assert on the exact hostname instead
of a substring match — `includes("www.kimi.com")` would also accept a
hostile host like `www.kimi.com.evil.net` or `evil.net/?x=www.kimi.com`
(js/incomplete-url-substring-sanitization).
This commit is contained in:
committed by
GitHub
parent
b729a8f273
commit
5bc11f4d0e
@@ -679,8 +679,13 @@ test("Kimi Web: targets www.kimi.com (international)", async () => {
|
||||
credentials: { apiKey: "kimi-auth=eyJ.eyJzdWI.signature" },
|
||||
});
|
||||
assert.ok(result.response instanceof Response);
|
||||
assert.ok(result.url.includes("www.kimi.com"), `got ${result.url}`);
|
||||
assert.ok(!result.url.includes("moonshot.cn"));
|
||||
// Parse the URL and assert on the exact hostname rather than a substring
|
||||
// match — `includes("www.kimi.com")` would also accept a hostile host like
|
||||
// `www.kimi.com.evil.net` or `evil.net/?x=www.kimi.com` (CodeQL
|
||||
// js/incomplete-url-substring-sanitization).
|
||||
const host = new URL(result.url).hostname;
|
||||
assert.equal(host, "www.kimi.com", `got ${result.url}`);
|
||||
assert.notEqual(host, "www.moonshot.cn", `got ${result.url}`);
|
||||
} finally {
|
||||
restore.restore();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user