Skip to content

fix(security): normalize SENSITIVE_KEYS so api_key dict entries actually redact (#11762) - #11764

Merged
mrveiss merged 2 commits into
Dev_new_guifrom
issue-11762
Jul 15, 2026
Merged

mrveiss merged 2 commits into
Dev_new_guifrom
issue-11762

Conversation

@mrveiss

@mrveiss mrveiss commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Closes #11762

Thinking Path

redact_dict normalizes each dict key (.lower().replace("_","").replace("-","") → api_key → apikey) but SENSITIVE_KEYS stored the un-normalized forms api_key/apiKey/api-key — none can ever match, so API-key entries were only redacted if their VALUE happened to match the long-key regexes (sk- requires 20+ chars). Realistic keys leaked unredacted. Production consumer: llc/services/replay_service.py redacts replay exports through this module. Found because #11730 exposed that this module's own test file never ran (never real-loaded in conftest).

What Changed

  • llm_shared/credential_redaction.py: SENSITIVE_KEYS stored in normalized form (apikey, …) with a comment stating the invariant; the three un-normalized variants collapse to one entry.
  • autobot-backend/conftest.py: real-load llm_shared.credential_redaction so the co-located tests actually run from now on.

Verification

  • llm_shared/tests/test_credential_redaction.py: was 4 failed / uncollectable → 6 passed (incl. test_redact_dict_simple, test_redact_dict_variations, test_safe_repr — the leaking cases).
  • llc/tests/test_replay.py (production consumer suite): passes.
  • Startup imports 344 passed; flake8 clean. No direct importers of SENSITIVE_KEYS exist (grep).

Model Used

Claude Fable 5

@github-actions

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Auto-regenerated (py3.14) to match the backend schema so the required
verify-generated-types gate passes. Triggered by auto-fix-generated-types.yml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant