Skip to content

redactPhones partially redacts long digit runs, leaking the tail #47

Description

@royalpinto007

Found by @BabuBahir while writing tests for #19.

redactPhones("Tracking number: 9400111899223856928490")
// actual:   "Tracking number: [PHONE REDACTED]90"
// expected: either fully redacted, or left alone

The phone pattern in lib/utils/pii.ts matches a bounded slice of a 22-digit run and leaves the remaining digits in place. Partial redaction is worse than no redaction, because the output looks sanitised while still exposing part of the original value.

Two defensible fixes, pick one and say which in the PR:

  1. Require a digit-run boundary so an over-long run is not treated as a phone number at all.
  2. Consume the whole run when it starts matching, so nothing is left behind.

Done when: the case above no longer leaves trailing digits, a regression test covers it, and the existing tests still pass. Note #19 is adding tests for this file, so coordinate to avoid conflicts.

Comment to claim this. There is a 2-open-claim limit per person so more people get a turn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaimedSomeone asked first and is working on this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions