Skip to content

[VDR][v0.5.0] Credential leakage #2222

Closed

Description

@anwithk

Secrets reach stdout and captured logs. Both findings trigger precisely when a user is debugging an auth failure and is most likely to paste output into a bug report. Both are single-file changes.

Findings: 2 (2 medium)
Code paths: nemo_gym/global_config.py, nemo_gym/server_utils.py
Source: DX review Gym-1-20260730170035 · target ref e446e4f4 · 2026-07-30
Tracker: #2214

Findings

Tracked here rather than as separate sub-issues (below the critical/high bar for individual issues, but in scope for this workstream).

  • 🟡 ERR-40044b75 — Secret masking matches only 'key'/'token' substrings, leaking password/secret/credential values
  • 🟡 ERR-fcaebf7d — Debug request logging prints the Authorization header, exposing the API key
Detail for the findings above

🟡 ERR-40044b75 — Secret masking matches only 'key'/'token' substrings, leaking password/secret/credential values

Severity: medium
Path: nemo_gym/global_config.py:431
Found by: error-quality-auditor
Status: new in this review

_recursively_hide_secrets_helper masks a value only when the key name contains the substring 'token' or 'key'. Any credential stored under a differently-named key is echoed verbatim by gym env resolve, which users are directed to run and routinely paste into bug reports. I confirmed db_password, client_secret, auth_credential, and bearer_auth all round-trip in plaintext while policy_api_key was correctly masked.

Suggested fix: Broaden the predicate to a shared constant covering password, secret, credential, passwd, bearer, auth, session, cookie, salt, and signature; match case-insensitively. Consider inverting to an allowlist of known-safe config keys given that env.yaml is user-extensible.

Evidence
$ gym env resolve ... (env.yaml with fake canaries) -> 38:policy_api_key: '****' | 40:db_password: CANARYPASSWORD | 41:client_secret: CANARYSECRET | 42:auth_credential: CANARYCRED

🟡 ERR-fcaebf7d — Debug request logging prints the Authorization header, exposing the API key

Severity: medium
Path: nemo_gym/server_utils.py:271
Found by: error-quality-auditor
Status: new in this review

When global_aiohttp_client_request_debug is enabled, raise_for_status prints Request info: {response.request_info} on every non-OK response. aiohttp.RequestInfo.__repr__ includes the full outgoing header multidict, so the bearer token is written to stdout and into any captured job log. Since this flag is exactly what a user turns on while debugging a 401, the leak triggers precisely when someone is most likely to share the output.

Suggested fix: Log only response.request_info.method and .url, or pass the headers through a redacting formatter that replaces Authorization/api-key/cookie values with **** before printing.

Evidence
repr(RequestInfo(...)) -> RequestInfo(url=URL('http://x/v1/responses'), method='POST', headers=<CIMultiDict('Authorization': 'Bearer sk-FAKE-CANARY')>, ...)

Filed from an automated first-time-developer DX review. Severity reflects impact on a new user: 🔴 critical = blocks usage entirely · 🟠 high = significant friction, workaround required · 🟡 medium = causes confusion · 🔵 low = cosmetic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    vdr

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions