fix: stop treating bare digit runs as SSN/PHONE by default (#158)#162
Open
sidmohan0 wants to merge 1 commit into
Open
fix: stop treating bare digit runs as SSN/PHONE by default (#158)#162sidmohan0 wants to merge 1 commit into
sidmohan0 wants to merge 1 commit into
Conversation
Structured tool output (tab ids, row ids, timestamps) contains bare nine- and ten-digit integers that matched the SSN and PHONE patterns, producing a constant stream of false-positive warnings that train users to ignore the firewall. SSN now requires a dash or space delimiter and PHONE requires a separator, parentheses, or a +country prefix by default. Delimited/formatted numbers still match; pass strict_numeric=False to restore undelimited matching (v4.4.0 parity). Threads strict_numeric through scan/redact and both agent adapters; updates corpus fixtures and regex tests that encoded the old bare-digit behavior. Broader SSA/NANP structural validation is deferred to the v5 validator layer.
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.
Closes #158.
The bug
Dogfooding the Claude Code hook in real agent sessions, browser/MCP tool output like
{"tabId": <9-digit>, "tabGroupId": <10-digit>}triggeredSSN/PHONEwarnings on nearly every tool call. Any bare 9-digit integer matched the SSN pattern and any bare 10-digit matched PHONE, so sessions touching tab ids, row ids, epoch timestamps, or ticket numbers got a constant stream of advisory noise — which trains users to ignore the firewall entirely, the one failure mode a security tool can't survive.The fix
strict_numeric(defaultTrue) onscan()/redact():NNN-NN-NNNN/NNN NN NNNN). Space delimiters are newly supported.+countryprefix.strict_numeric=Falserestores undelimited matching (v4.4.0 parity) as an opt-in.Threaded through both agent adapters (they run strict). The hook README and plugin README document an
^\d{9}$|^\d{10}$allowlist pattern as belt-and-braces.The exact #158 payload now yields zero findings; a delimited SSN still matches.
Scope
This is a behavior change shipped as a patch with a prominent CHANGELOG note — flagging in case you'd rather signal it as 4.8.0. It deliberately reverses the v4.4.0 bare-9-digit SSN parity that was restored earlier (that parity is exactly what #158 is complaining about); parity is preserved as
strict_numeric=False.Broader structural validation (SSA area/group ranges, NANP area/exchange must start 2-9) is deferred to the v5 validator layer (DFPY-110) — it would reject the invalid placeholder values several test fixtures use, which is a larger change than a hotfix warrants.
Test plan
tests/test_numeric_precision.py(12 tests: bare-not-matched, delimited-still-matched, opt-in parity, the False positives: numeric IDs in structured tool output flagged as SSN/PHONE #158 JSON payload)ssn-no-dashes/phone-plain-digits/passport-log, regex parametrize flips, DE-VAT parity test, allowlist-timestamp test) — dropping only bare-numeric expectations, preserving all else (e.g.PERSON)