Files
OmniRoute/open-sse/executors
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-10 13:49:08 -03:00
2026-06-26 02:51:06 -03:00
2026-06-26 02:51:06 -03:00
2026-06-17 02:43:21 -03:00
2026-06-25 13:17:40 -03:00
2026-06-17 19:26:32 -03:00
2026-06-07 07:20:02 -03:00
2026-06-25 13:17:40 -03:00
2026-05-23 01:46:59 -03:00
2026-06-25 13:17:40 -03:00
2026-06-26 02:51:06 -03:00
2026-06-22 03:17:02 -03:00
2026-06-23 03:08:29 -03:00
2026-06-26 02:51:06 -03:00
2026-06-23 17:06:18 -03:00
2026-05-29 12:44:29 -03:00
2026-06-20 07:09:43 -03:00
2026-06-23 03:08:29 -03:00
2026-06-26 02:51:06 -03:00
2026-06-10 13:49:08 -03:00
2026-06-25 13:17:40 -03:00
2026-06-19 06:49:01 -03:00
2026-05-29 12:44:29 -03:00
2026-06-25 13:17:40 -03:00
2026-06-20 07:09:43 -03:00
2026-05-24 18:05:58 -03:00
2026-05-29 12:44:29 -03:00
2026-06-26 02:51:06 -03:00
2026-06-20 07:09:43 -03:00
2026-05-26 23:51:47 -03:00
2026-06-25 13:17:40 -03:00
2026-06-17 02:43:21 -03:00
2026-05-29 12:44:29 -03:00
2026-05-29 12:44:29 -03:00
2026-06-25 13:17:40 -03:00
2026-06-26 02:51:06 -03:00
2026-06-12 23:49:22 -03:00
2026-05-24 18:05:58 -03:00
2026-06-09 15:56:24 -03:00
2026-05-29 12:44:29 -03:00
2026-05-29 12:44:29 -03:00
2026-06-10 13:49:08 -03:00
2026-06-16 01:00:40 -03:00
2026-06-16 01:00:40 -03:00
2026-05-26 23:51:47 -03:00