From 4ae41c6d7aaca98bcc5cdd267e10098fcd2a7458 Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Mon, 22 Jun 2026 21:07:54 +0000 Subject: [PATCH] fix(#3961): add Anthropic OAuth tokens to fail-closed floor (agent-absent CI/test env) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- api/profiles.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/profiles.py b/api/profiles.py index e6aebaad..7b8eccdf 100644 --- a/api/profiles.py +++ b/api/profiles.py @@ -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",