Skip to content

Validate international phone digit counts and whole-number boundaries #263

Closed

Description

@senamakel

The international phone rule in crates/tinymemory-api/src/safety/rules.rs uses a repetition over digits and separators, although its comment promises 7–15 digits. This rule is preserved from OpenHuman by PR259; the ownership migration does not change detection behavior.

A synthetic public-API probe of scan and redact_identifiers confirms:

  • +1234567 (seven digits): no hit, unchanged.
  • +123456789012345678 (18 digits): one PhoneNumber hit and redaction.
  • +1 2 (two digits plus separators): one PhoneNumber hit and redaction.

Validate normalized digit counts and define whole-number boundaries so a too-long number cannot be accepted by truncating its prefix. Add focused regressions for 7/15-digit boundaries, 6/16-or-more digits, and separator-heavy values; preserve intended US-format behavior and address overlap with #261.

Activity

  1. added
    priority: p2
    on Oct 11, 2026
  2. tinysweeper commented on Oct 11, 2026

    @tinysweeper

    The international phone rule in crates/tinymemory-api/src/safety/rules.rs documents a 7–15 digit range but its digit/separator repetition accepts out-of-range values: a 2-digit separator-heavy string is redacted as a PhoneNumber and an 18-digit string is accepted (potentially via prefix truncation). Fix requires normalizing digit counts, enforcing whole-number boundaries, and adding regressions at the 6/7/15/16-digit edges plus separator-heavy inputs. It is a correctness bug in detection rather than a crash or data-loss path, so p2; it is related to but distinct from #261 (overlapping phone-rule counts), which it merely needs to be reconciled with.

    Labelled priority: p2.

  3. added theissue type on Oct 11, 2026
  4. M3gA-Mind commented on Nov 11, 2026

    @M3gA-Mind
    Collaborator

    All three cases still reproduce on main. #265 fixes them, verified merged onto main. One CodeRabbit point is still open there (non-ASCII digits get past the 7–15 count), and once that's addressed it can merge ahead of #268 and #278.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions