mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-11 23:49:01 +02:00
fix(redact): stop the E.164 phone pattern flagging compact timestamps
Bare 14-digit runs like 20260727202423 (YYYYMMDDHHMMSS backup/log stamps) matched the phone regex and produced MEDIUM PII findings. Reject a separator-free 14-digit span whose fields parse as a plausible date-time; real numbers carry a + or spacing, so phone coverage is unchanged. Contributed by @abkrim (PR #2428). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
85954e604a
commit
a03f571147
@@ -203,8 +203,9 @@ describe("PII patterns", () => {
|
||||
scan("bob@acme.co", { repoVisibility: "private", repoPublicEmails: ["bob@acme.co"] }).findings,
|
||||
).toHaveLength(0);
|
||||
});
|
||||
test("phone E.164", () => {
|
||||
test("phone E.164 flags, skips compact timestamps", () => {
|
||||
expect(ids("call +14155550123 now")).toContain("pii.phone.e164");
|
||||
expect(ids("backup stamp 20260727202423 ran late")).not.toContain("pii.phone.e164");
|
||||
});
|
||||
test("ssn flags valid, skips 000 octet", () => {
|
||||
expect(ids("ssn 123-45-6789")).toContain("pii.ssn");
|
||||
|
||||
Reference in New Issue
Block a user