feat(memory-defense): detect international and Chinese PII - #3577
feat(memory-defense): detect international and Chinese PII#3577oldnicke wants to merge 1 commit into
Conversation
39b5e98 to
f9a5f89
Compare
r266-tech
left a comment
There was a problem hiding this comment.
Reviewed PR #3577 at head f9a5f89bd8ebe9627fb428fb478ef8538bd0f67a from snapshot snapshot_42730654edccdd2d9eaf5a3ca26f16e72; the supplied verification confirms checkout matches the authority-bound external PR head and git diff --check exited 0.
The PR description reports 233 focused Memory Defense tests passing plus lint and pre-commit checks; DB-backed Memory Defense cases were not run against a current test database.
High: The postal-address detector stops at the first comma/semicolon/sentence punctuation and caps the match at 120 characters, so Shipping address: 123 Main St, Apt 4, Springfield, IL 62704 is only partially redacted, leaving the apartment, city, state, and postal code in persisted content. Extend address matching to cover comma-delimited components while bounding unrelated prose, and add English and Chinese multi-component regression tests.
Medium: The contextual person-name and address alternatives have no leading label boundary and do not constrain the address value, so username: Alice can match the embedded name: substring and server address: localhost can be redacted as an address. Require a separator/word boundary before context labels, add stronger value/context constraints, and cover username, server address, and IP address with negative tests.
Medium: A 16-digit value prefixed with 62 that fails the new bank-card Luhn validator still falls through to the older generic credit_card pattern, which accepts 13-16 digits, so the invalid candidate is redacted anyway. Define precedence for invalid 62-prefixed 16-digit candidates and add a regression test for that shape.
Low: Only the English control-plane catalog was updated to report 52 Memory Defense patterns; the nine other actively loaded locale catalogs still report 45. Synchronize the 52-pattern text across all active locale catalogs or derive the displayed count from a single source.
f9a5f89 to
7cc3303
Compare
96bee53 to
7ae1319
Compare
|
@r266-tech Thanks for the detailed review. I addressed all of the requested changes in the latest commit ( Addressed items:
Validation:
The DB-backed Memory Defense cases still require a current local test database and were not included in the focused local run. Could you please take another look and re-review the updated commit? |
|
Thanks for the review. I’ve addressed all of the requested changes in the latest commit. All tests, lint, pre-commit, documentation checks, and CI are passing, and the PR is mergeable. Could you please re-review it when you have a chance? If everything looks good, would you mind merging it? Thanks! |
Add locale-aware patterns for email, phone numbers, PRC identity and bank card numbers, plus context-bound person name and postal address detection. Validate PRC identity checksums and Luhn card numbers, fully mask PII hit previews, and document the expanded pattern set. Fixes vectorize-io#3574.
7ae1319 to
1ef2394
Compare
Fixes #3574.
Summary
main62candidates from falling through to generic credit-card redactionTesting
uv run --no-sync pytest -p no:xdist -o addopts="" tests/test_memory_defense.py -q -k "redaction_samples or redaction_patterns or each_redaction or apply_redaction"(241 passed, 56 deselected)./scripts/hooks/lint.shnode hindsight-docs/scripts/sync-coding-agents-doc.mjs --checkThe DB-backed Memory Defense cases still require a local test database with the current
entities.entity_kindmigration.