fix(security): expand Password PII patterns to catch pass: and natural language forms #60
No reviewers
Labels
No Label
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sarman/tftsr-devops_investigation#60
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/pii-detection-bypass"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Live audit logs confirmed
was_pii_redacted: falsewith plaintext credentials reaching the AI provider.Two credential patterns were not matched by
PiiDetector:1. Abbreviated key form (
pass: abc123!!)The pattern only matched
password|passwd|pwd. The common credential file keypass:was not in the alternation.2. Natural language form (
Is the password password123 good)No pattern existed for the case where
passwordprecedes a value without a=/:separator. Plaintext credentials disclosed in natural-language messages were not redacted.Fix
Key-value pattern
pass,passphrase,secretto the alternation\bword boundary to prevent substring false positives (bypass:,compass:)Natural language pattern
password <value>/password is <value>password strength,password policy)Tests
5 new regression tests added:
test_detect_pass_abbreviation— confirmspass: abc123!!is caughttest_detect_password_natural_language— confirmspassword password123andpassword is hunter2are caught;password strengthandpassword policyare NOT flaggedtest_password_no_false_positive_bypass— confirmsbypass:is not flaggedtest_detect_password_keyword— confirms originalpassword:,passwd=,pwd:still worktest_detect_secret_keyword— confirmssecret:andpassphrase:workVerification
cargo test: 233/233 passcargo clippy -- -D warnings: cleancargo fmt --check: cleanAutomated PR Review (qwen3-coder-next via liteLLM):\n\nSummary
The PR expands password PII detection to catch abbreviated forms like
pass:and natural language patterns likepassword value. However, the natural language regex has a critical flaw: it permits matching plain English phrases like “password strength” when they are followed by a digit/special character in an adjacent word, creating false positives and potential over-redaction of non-sensitive text.Findings
Evidence:
r"(?i)\b(?:password|passwd|passphrase)\s+(?:is\s+|was\s+)?[A-Za-z0-9!@#$%^&*_\-+=@#,.]*[0-9!@#$%^&*_\-+=@#][A-Za-z0-9!@#$%^&*_\-+=@#,.]*"— matches"password strength 123"because[A-Za-z0-9!@#$%^&*_\-+=@#,.]*greedily consumes"strength"(no digit), then123satisfies[0-9!], and the pattern does not enforce that the immediately following word must be a password valueFix: Restrict to match only sequences where the value follows a delimiter (
is,was, or colon-like) or enforce word boundary and non- alphabetic start on the value portion; e.g., change tor"(?i)\b(?:password|passwd|passphrase)\s+(?:is\s+|was\s+)?(?[!@#$%^&*_\-+=@#0-9])[A-Za-z0-9!@#$%^&*_\-+=@#,.]*"Verdict: REQUEST CHANGES