fix(#3961): add Anthropic OAuth tokens to fail-closed floor (agent-absent CI/test env)

The registry-derived scrub union is best-effort and returns empty when
hermes_cli.auth can't be imported (WebUI-only CI/test env). That made
ANTHROPIC_TOKEN / CLAUDE_CODE_OAUTH_TOKEN scrubbing depend on the agent being
installed, so the quota-subprocess regression failed on CI (agent absent) while
passing locally (agent present). Add both token names to the fail-closed floor
set so the scrub covers them regardless of the registry import — strictly more
correct (defense-in-depth) and deterministic across environments.

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
This commit is contained in:
nesquena-hermesandrodboev committed 2026-06-22 21:07:54 +00:00
1 parent c55ba5df11
commit 4ae41c6d7a
1 file changed
+6
+6
View File
@@ -904,6 +904,12 @@ def filter_runtime_env_for_gateway_parity(env: dict[str, str]) -> dict[str, str]
# inheriting the server-process credential (#3961 residual cross-profile leak).
_NON_REGISTRY_AGENT_CREDENTIAL_ENV_NAMES: tuple[str, ...] = (
"CUSTOM_API_KEY",
# Anthropic OAuth/token aliases. These ARE in the agent auth registry, but
# are duplicated here as a fail-closed floor so the scrub still covers them
# when the agent package can't be imported (e.g. a WebUI-only CI/test env
# where hermes_cli.auth is absent) — the registry union is best-effort.
"ANTHROPIC_TOKEN",
"CLAUDE_CODE_OAUTH_TOKEN",
"AZURE_ANTHROPIC_KEY",
"AZURE_FOUNDRY_API_KEY",
"AZURE_CLIENT_ID",