Files
OmniRoute/open-sse
Diego Rodrigues de Sa e Souza b3207ab010 fix(security): exact-host Anthropic baseUrl check (CodeQL js/incomplete-url-substring-sanitization #674) (#5129)
The anthropic-compatible Bearer-fallback gate decided whether a configured baseUrl
targeted the official api.anthropic.com host via a substring `.includes("api.anthropic.com")`.
A look-alike upstream such as `https://api.anthropic.com.evil.test` or
`https://evil.test/?x=api.anthropic.com` matched the substring and was wrongly treated as
official, suppressing the Bearer fallback meant for third-party gateways
(CodeQL #674, js/incomplete-url-substring-sanitization, high).

Replace the substring test with an exported `isOfficialAnthropicBaseUrl()` helper that
parses the URL and compares the hostname for exact equality. Empty baseUrl stays official;
scheme-less hosts are parsed with an assumed https://; an unparseable baseUrl falls back to
third-party (Bearer emitted) as the safer default. Behavior for legitimate official/third-party
baseUrls is unchanged.

Adds tests/unit/anthropic-official-baseurl-host.test.ts covering official, look-alike,
scheme-less, and unparseable inputs plus a static guard that the substring pattern is gone.
2026-06-26 23:14:27 -03:00
..
2026-06-26 02:51:06 -03:00
2026-06-26 02:51:06 -03:00
2026-05-26 23:51:47 -03:00
2026-06-22 03:17:02 -03:00
2026-06-26 02:51:06 -03:00
2026-06-26 02:51:06 -03:00
2026-06-26 02:51:06 -03:00
2026-06-26 02:51:06 -03:00
2026-06-12 23:49:22 -03:00