Skip to content

fix(audit): scrub the five provider key shapes in both capture paths - #507

Merged
blitzcrieg1 merged 1 commit into
masterfrom
fix/provider-capture-scrub-017
Nov 27, 2026
Merged

blitzcrieg1 merged 1 commit into
masterfrom
fix/provider-capture-scrub-017

Conversation

@blitzcrieg1

Copy link
Copy Markdown
Owner

PR #495 added DLP rules for OpenRouter, Groq, Replicate, Perplexity and xAI keys, but the capture scrubbers did not know those shapes, so a key captured in a command or nested arguments was stored as sent.

Changes:

  • Add the five provider key patterns to both the recorder (core/audit/redaction.py) and the hook (hooks/ingest.py) scrub lists; the mirror test keeps them in sync.
  • Scrub the full command before truncating to COMMAND_MAX_LEN, so a token cut at the storage cap cannot survive half masked.
  • New parametrized test covers each provider shape in both capture paths, including mixed case, a near-miss length, and the truncation boundary.
  • README collected-test count 3034 -> 3044.

Verification (run locally in the worktree, PYTHONPATH=apps/orchestrator):

  • pytest tests/test_redaction.py 91 passed
  • pytest tests/test_readme_claims.py tests/test_redaction.py 107 passed
  • full suite: 2964 passed, 8 skipped; the 72 failures are identical on clean master in this environment (pre-existing, unrelated: session_tree/trusted_host), plus the readme count test fixed by the README bump
  • agentmetry benchmark 112 cases, 18 rules, 61/61 firings, 0 missed, 0 false positives (unchanged)
  • ruff check clean on changed files, git diff --check clean

PR #495 added DLP rules for OpenRouter, Groq, Replicate, Perplexity and
xAI keys, but the capture scrubbers did not know those shapes, so a key
captured in a command or in nested arguments was stored as sent. Add the
five patterns to both the recorder and the hook scrub lists (the mirror
test keeps them in sync) and scrub the full command before truncating to
COMMAND_MAX_LEN so a token cut at the storage cap cannot survive half
masked. README collected-test count 3034 -> 3044.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <[email protected]>
@blitzcrieg1
blitzcrieg1 merged commit 4220517 into master Nov 27, 2026
10 checks passed
@blitzcrieg1
blitzcrieg1 deleted the fix/provider-capture-scrub-017 branch November 27, 2026 14:31
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