fix(agent-os): redact keyword secrets whose key is quoted #4581
All Vouch review confidence checks passed
Residual risk 0.35 = Change Risk (0.66) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 386 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.356
Shallow Review Depth
shallow_review_depth
0.344
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #4581"
general
weight: 0.35
MohammadHaroonAbuomar
Related Issue
None; see #3479 (closed for account reasons).
Problem & Solution
Problem. "Generic API secret" runs the keyword straight into
\s*[:=], so quoted keys ({"api_key": "..."},{'client_secret': '...'}) never match.intercept_tool_responsejson.dumpsstructured results first, so such a tool response is "Response clean".Solution. A quoted-key branch (plain or escaped quote) captures only the value in a
secretgroup, andfind_matchesreports that span. Output stays valid JSON:{"api_key": "[REDACTED]"}. Unquoted values stop at,}]. Only a value exactly[REDACTED]is skipped (SANITIZE re-check); no other value-shape exemptions. The scanner keeps one finding per identical span. Other output is unchanged.Impact on Your Work
Secrets in structured MCP tool output reach the model unredacted.
Timeline
None.
Alternatives Considered
Redacting key and value together breaks JSON; #3479 reviewers asked for value-only spans.
Type of Change
Package(s) Affected
Testing
Unit Testing
43 new tests (JSON/dict spellings, round-trips,
matched_text, negatives, AWS pins, scanner and gateway). Againstmainsource: 21 fail. Fixed: 261 pass. Full suite: same 12 pre-existing failures both sides.Manual Testing
From
agent-governance-python/agent-os:python -c "import sys; sys.path.insert(0,'src'); from agent_os.credential_redactor import CredentialRedactor as R; print(R.redact('{\"api_key\": \"Zx81kQ0pLm77Qa\"}'))"mainprints the secret; this branch prints{"api_key": "[REDACTED]"}.<details><summary>Limits and follow-ups</summary>
A redacted number is not valid JSON. Not changed: Rust
redactor.rs:90, quotedpassword/AccountKey.</details>
Checklist
Attribution & Prior Art
Prior art: #3479 (LHMQ878) addressed this gap. This fix was written independently, following that review thread.
AI Assistance
Prepared with AI assistance: an AI coding assistant (Claude) reproduced the gap, wrote the fix and tests, and drafted this description. I reviewed every change before submitting.
IP, Patents, and Licensing
John B Joseph, Co-founder & CPTO, Purplecop Security