7 Commits

Author SHA1 Message Date
Anurag Mewar ce73ef8617 fix: auth support for macOS Keychain-backed Claude Code login 2026-05-29 18:58:23 +05:30
Mark Atwood 1d25b239d2 auth: add opt-in api_key mode via --allow-api-key
Adds a fourth auth mode (api_key) for users who want to bill against
their own Anthropic API account instead of through a Claude Code
subscription. The mode is opt-in to preserve the existing 'subscription
only' default — users who have ANTHROPIC_API_KEY set in their shell for
other tools won't accidentally be billed metered rates here.

Opt-in via either:
  --allow-api-key            (CLI flag on auth-check and run)
  AUDIT_ALLOW_API_KEY=1      (env var; useful for CI)

When opted in, the precedence matches the underlying SDK:
  gateway > api_key > oauth_token > keychain_login

ANTHROPIC_AUTH_TOKEN is scrubbed in api_key mode so a stale gateway
token can't outrank the API key (rung 2 > rung 3 in SDK precedence).

Default behavior is unchanged: with allow_api_key=False (or absent),
ANTHROPIC_API_KEY is scrubbed and one of the subscription modes wins,
exactly matching the original behavior.

Tests: 54/54 pass (4 new api_key-mode tests; existing tests updated to
explicitly assert the upstream default-scrub behavior they relied on).

Error message updated to mention --allow-api-key when the user has set
ANTHROPIC_API_KEY but no subscription auth, so the failure mode is
self-explanatory.
2026-05-21 09:19:03 -07:00
Simone Margaritelli 6dd18433d0 open auth 2026-05-19 14:01:51 +02:00
Simone Margaritelli 0f44307aee new: integrated stuff from my stuff 2026-05-19 13:32:01 +02:00
Simone Margaritelli 75d32c8ec7 fix: schema errors handling 2026-05-19 10:24:59 +02:00
Simone Margaritelli 80d746e4f7 things 2026-05-18 22:43:41 +02:00
Simone Margaritelli d03e6b0360 initial: 8-stage vulnerability discovery harness 2026-05-18 17:42:41 +02:00