56dfa091f9
The api-key credential-isolation guard in this PR only removes the env-derived Bearer when `anthropic._types.Omit` can be imported. When the sentinel is unavailable (older/exotic SDK layout), `_new_sdk_client` fell through to a bare api-key client whose SDK env fallback re-reads ANTHROPIC_AUTH_TOKEN and ships `Authorization: Bearer ***` to third-party endpoints — the compatibility path failed open (P2, reported by @egilewski). Fail closed instead: when Omit is unavailable, build the client with a copy-safe httpx request hook that strips Authorization on every request. `http_client` propagates through `with_options()`/`copy()`, so the original client and every copy are covered without depending on the SDK's header-omission internals — the same custom-client shape already used by `_build_anthropic_client_with_bearer_hook`. Adds a real-loopback e2e test that simulates Omit unavailable and asserts no Bearer leak on the original client and on a `with_options()` copy, while x-api-key and request success are preserved. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>