microsoft / microsoft/agent-governance-toolkit
credential_redactor: docs imply redact() scrubs PII, but it covers secrets only; SSN patterns diverge
- Dominant language
- Python
- Stars
- 6.3k
- Forks
- 1.1k
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 142
Description
Found during a code-quality / docs pass.
In `agent_os/credential_redactor.py` (around lines 101-199), `redact()` / `redact_data_structure()` iterate only `PATTERNS` (secret-like material), not `PII_PATTERNS` (email / phone / SSN / credit-card / IP). So PII is *detected* by `find_pii_matches()` but **not removed** by `redact()`. The class docstring's 'redact sensitive material' phrasing can lead a caller to assume PII is scrubbed when persisting/returning data.
Suggestion: either add an opt-in `redact_pii=True` path, or clarify in the docstring that `redact()` is secrets-only.
Separately, the SSN pattern here (`\d{3}-\d{2}-\d{4}`) is narrower than the one in `integrations/base.py` (which also accepts space/dot/no-separator) — reconciling to one shared pattern would avoid divergent detection.
Contributor guide
Research direction
Start in agent_os/credential_redactor.py around lines 101-199, comparing redact(), redact_data_structure(), PATTERNS, and PII_PATTERNS; then compare the SSN pattern with integrations/base.py. Confirm whether the intended fix is an opt-in PII path or secrets-only documentation, and reconcile the SSN behavior if required; done means the documented and actual redaction and detection scopes agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100