Repository navigation
fix(redact): parcel IDs are not phone numbers - #2591
Closed
Two-Six-Alpha-1115 wants to merge 1 commit into
Closed
Two-Six-Alpha-1115 wants to merge 1 commit into
Two-Six-Alpha-1115 wants to merge 1 commit into
Conversation
A county tax-map parcel ID (APN) reads as a national-format phone number to `pii.phone.e164` — the same collision class as the digit-only UUID that `insideUuid` already guards. `12-3456789.000` matches, and so does its normalized `123456789000`. This is not a rare edge. Land, title and property-tax repos carry APNs by the hundred; a single title branch pushed 2 MEDIUM findings, and the same shape recurs in every fixture, mart and smoke in the domain. A guardrail that cries wolf on the domain's primary identifier is one people learn to wave through, which is how a real HIGH finding eventually gets ignored. The guard is deliberately narrow, in two tiers: 1. The DOTTED form is exempt on its own shape. No phone convention puts a dot before a trailing 3-4 digit group after a 4-8 digit middle. Hyphen-only variants (22-0001-000) are NOT shape-exempted — those genuinely are phone-shaped. 2. A DIGITS-ONLY span is phone-shaped in isolation, so it earns the exemption only by evidence: it must be the exact digit-normalization of a punctuated APN within the surrounding window. Fixtures and marts carry the pair; a real phone number has no such twin. This reads the document's own evidence instead of guessing from digits. Verified against the unmodified engine over inputs spanning every rule family (AWS, PEM, GitHub PAT, email, IP, credit card, SSN, timestamp, UUID, nine phone formats): exactly one behavior changed, the APN pair. The new test pins both directions and was proven red under mutation — stubbing the guard to `return true` (the dangerous blanket-exemption failure) fails 12 of 15; `return false` fails 3.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
4 of 9 tasks
Owner
|
Thank you — this landed in v1.67.0.0 (credited in the CHANGELOG). Closing since the fix is on main. 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
A county tax-map parcel ID (APN) reads as a national-format phone number to
pii.phone.e164— the same collision class as the digit-only UUID thatinsideUuidalready guards.The regex is deliberately loose to catch international formats, and an APN satisfies it in both its punctuated and normalized forms.
This isn't a rare edge. Land, title and property-tax repos carry APNs by the hundred — one title branch tripped 2 MEDIUM findings on nothing but synthetic fixtures, and the same shape recurs in every fixture, mart and smoke in the domain. A guardrail that cries wolf on the domain's primary identifier is one people learn to wave through, which is how a real HIGH finding eventually gets ignored. That's the reason to fix it rather than live with the noise.
The guard
looksLikeParcelId(span, match), wired into the existingvalidatealongsideinsideUuidandlooksLikeCompactTimestamp, following the same context-window approachinsideUuiduses. Two deliberately separate tiers:Dotted form, exempt on shape. No phone convention puts a dot before a trailing 3–4 digit group after a 4–8 digit middle, so this cannot swallow a real number. Hyphen-only variants (
22-0001-000) are not shape-exempted — those genuinely are phone-shaped.Digits-only form, exempt only on evidence. A bare digit run is phone-shaped in isolation, so it must be the exact digit-normalization of a punctuated APN within a 400-char window. Fixtures and marts always carry the pair; a real phone number has no such twin nearby. This reads the document's own evidence instead of guessing from digits.
Verification
A/B against the unmodified engine over inputs spanning every rule family — AWS key, PEM, GitHub PAT, email, public IP, credit card, SSN, compact timestamp, UUID, and nine phone formats. Exactly one behavior changed: the APN pair. Everything else byte-identical.
New test pins both directions (
test/redact-parcel-id-false-positive.test.ts, 15 cases):Proven red under mutation. Stubbing the guard to
return true— the dangerous blanket-exemption failure, which would quietly gut the pattern — fails 12 of 15. Stubbing toreturn falsefails 3. Restored: 15/15 with the source byte-identical.Existing suites green:
redact-pattern-lint49/49,gstack-config-redact-keys6/6,browse/proxy-redact8/8.HIGH detection is untouched — PEM, GitHub PAT and Slack token all still block.