Repository navigation
fix(pii): stop reporting timestamps, matrices, and vectors as PII - #304
Conversation
Tier 1 PII scans judged numeric values by shape alone, so ordinary technical content produced findings and some of them failed the gate. Credit cards: - Skip a card-shaped number when a timestamp or digest label directly precedes it (timestamp_microseconds:, event_timestamp:, unix_time, "created_at_epoch":, sha256:, checksum=). The label must end at the number and is searched in a 100-character window, so a timestamp field does not hide a card in a later field. - Reject digits embedded in a longer ASCII token (hex digest, id_1707938736269577, 1707938736269577_suffix). An underscore counts only when it joins the number to a letter or digit, so Markdown emphasis (_4532015112830366_, __4532015112830366__) is still reported, and the classes stay ASCII so a card written next to CJK or Thai letters is still reported. - Compare numeric test-card exceptions with each candidate's digits in any grouping instead of excluding the whole line, and add other widely published processor test cards. Phone numbers: drop an international candidate that starts inside a scientific-notation literal such as the +00 exponent of 1.000000e+00; other candidates on the line are still checked. GPS coordinates: require a geospatial cue on the line, the two lines before it, or the file name. Cues include GPS, latitude/longitude, lat/lng and latlong/lonlat keys, WGS 84, degrees, RFC 5870 geo: URIs, Google/Apple/OpenStreetMap/Bing map links, and GeoJSON geometry, Feature, collection, or "geometry" members. Technical labels (waypoint, quaternion, pose, vector, calibration, pixel coordinates) outweigh location/office/address wording but not a GPS cue. Docs, YAML comments, and the CHANGELOG describe the new rules. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Automated review: 9 findings (0 P1, 5 P2, 4 P3); 8 posted inline.
Findings outside the diff or about the description:
PR_DESCRIPTION: P3: The Merge order section says that #262 (release v0.7.0) editsCHANGELOG.md, and that if it merges first this entry should move under a new## Unreleased. #262 already merged on 2026-10-30 and #302 reverted it the same day, so it will not merge again. Currentmainhas no 0.7.0 section: the heading after## Unreleasedis## 0.6.0, and this entry is already in the Unreleased / Fixed list. As written, the note could send a maintainer looking for a new## Unreleasedheading that #262 will never add, or lead them to move an entry that is already in the right place.
Suggested fix: Drop the #262 bullet, or make it general, for example: "If a release PR merges before this one, move this entry under the new ## Unreleased."
Conflicted files: CHANGELOG.md. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ropped - Card boundary: a card after a backslash escape (\n, \t, \r) or a percent-encoded byte (%3D) is reported again, and the ASCII classes are scoped case-sensitive so IGNORECASE no longer lets them match the dotless i or the Kelvin sign. - Timestamp labels: epoch and unix_time take the same unit suffixes as timestamp (epoch_us, epoch_micros, unix_time_us). - GPS cues accept plurals (locations, offices, addresses, latitudes) and camelCase keys (homeLocation, gpsCoords); the unsplit text is still searched so GeoJSON types such as FeatureCollection match. - A strong cue in the nearby lines or file name now outweighs a nearby "<pixel|camera|world> coordinates" label. - Degrees and the degree sign are soft cues, so a technical label on the line wins over rotation wording in degrees. - Every position inside a GeoJSON geometry's "coordinates" array is cued, found by one linear token pass per file, so pretty-printed Polygon and Multi* geometries are reported again. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
State which GPS cues are strong and which are soft, that vector labels such as waypoint count only on the pair's own line while "<pixel|camera|...> coordinates" also counts nearby, and that every position inside a GeoJSON geometry's coordinates array is reported. Update the CHANGELOG entry to match. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
The exemptions are where the risk is, so I ran a batch of card, phone, SSN and coordinate lines through main and this branch and compared. SSNs and normal phone formats are unchanged, and a card next to a timestamp or a test card, after \n or %3D, or in a plural or camelCase location key is reported as it should be. Two cases still hide real data that main reports: a technical word after a labelled coordinate pair, and a card behind a payment word and an underscore.
Conflicted: CHANGELOG.md (kept both Unreleased / Fixed entries). Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
GPS cue words now accept plurals and a numeric suffix, so geolocations:, latlngs, lats:, lat1/lon1, location1: and homeLocation2 keep their cue. The GeoJSON type and geometry keys count double-quoted, single-quoted or bare, so Python dicts, JS objects and one-line YAML geometry stay reported; a bare type value must use GeoJSON's spelling. Nested coordinates arrays are merged before their lines are marked, so deeply nested input stays linear. Docs, CHANGELOG and pattern comments state that block-style YAML geometry is cued only through the two-line window. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ter a payment word A technical word (scale, vector, roi, calibration) now labels a coordinate pair only when it comes before the pair, so "Location: 37.77, -122.41 (map scale 1:5000)" is still reported. A card joined to a payment word by an underscore (card_4532..., cc_4532...) is reported again; other identifiers such as id_1707938736269577 stay skipped. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
Follow-up on the current head. Both cases from my last review are fixed: Location: 37.774929, -122.419416 (map scale 1:5000) and the vector tiles line are reported again, and card_, CARD_...png and cc_ prefixes keep the card. I compared a few more lines against main and two narrower gaps remain, inline. Neither is blocking.
…bels reported Split payment identifiers at camelCase boundaries and evaluate GPS labels for each coordinate pair. Signed-off-by: Christopher Kevin <[email protected]>
Pick up the PII timestamp, matrix, and vector false-positive fix (#304); no conflicts. Its numeric filters run before the waiver filter. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
Resolve the CHANGELOG.md conflict: keep main's PII entry (#304) and add this PR's refusal-fallback entry after it. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Tier 1 PII scans judged numeric values by their shape alone. This PR checks each numeric candidate against its context as well.
Credit cards
timestamp_microseconds:,epoch nanoseconds =,"unix_time":,sha256:,checksum=,"sha256" ". Underscores separate words, so snake_case prefixes count too:event_timestamp:,"created_at_epoch":,file_sha256:. CamelCase prefixes such aseventTimestampare not covered. The label check looks at no more than 100 characters before the number and must end right at the number. So a timestamp field does not hide a card number in a later field on the same line.(?<![\d.])...(?!\d)to(?<![A-Za-z0-9.])(?<![A-Za-z0-9]_)...(?![A-Za-z0-9])(?!_[A-Za-z0-9]). Digits embedded in a longer ASCII token, such as a hex digest,id_1707938736269577or1707938736269577_suffix, no longer match. An underscore blocks a match only when it joins the number to a letter or digit, so a card in Markdown underscore emphasis (_4532015112830366_,__4532015112830366__) is still reported, as onmain. The classes are ASCII on purpose. Python's\wwould also match CJK, Hangul, Thai and accented letters, and Chinese, Japanese, Korean and Thai prose often writes a number directly between letters (カード番号は4532015112830366です). Such a card is still reported, as it is onmain. The float guard and the long-digit-run guard still apply.4111111111111111,5500-0000-0000-0004, ...) are now compared with each candidate's digits, and they no longer exclude the whole line. A test card written with spaces (4111 1111 1111 1111) is excepted. A test card no longer hides a different card number on the same line.4242424242424242,4000056655665556,4012888888881881,5555555555554444,5105105105105100,2223003122003222,6011111111111117and3530111333300000. A payment skill that lists several of them on one line, such asCards: 4111111111111111, 4242424242424242, still passes.Phone numbers
+00exponent of1.000000e+00. Other candidates on the line are still checked, so a real number after a matrix value is reported. The literal lookup is bounded to a 128-character window around the candidate.GPS coordinates
latlon/latlong/lonlat/lnglatkeys, WGS 84, degrees or°;geo:URI, or a map link:maps.google.*,google.<tld>/maps,maps.apple.com,openstreetmap.orgorbing.com/maps. Host forms are bounded, so long lines stay linear;"type"ofPoint,LineString,Polygon, theirMultiforms,Feature,FeatureCollectionorGeometryCollection, or a"geometry": {member (it comes before"coordinates"when keys are sorted).Feature, the collection types andgeometryare matched case-sensitively, as GeoJSON spells them, so"type": "feature"in other JSON is not a cue;gps_coordinates:andstart_latcount as cues.waypoint,quaternion,pose,vector,calibration,roi,scale,coordinates =, and<pixel|texture|camera|...> coordinates. These labels outweigh location/office/address wording. They do not outweigh a GPS or latitude/longitude cue nearby.Docs
docs/tier1-validation.mdx(thepiiaccordion) and the comments inpii_patterns.yamldescribe the rules, including the location forms that are no longer reported.Why
Ordinary technical content in a skill produced PII findings, and some of them blocked the gate:
timestamp_microseconds: 1707938736269577) were reported as CRITICAL credit cards.validate <skill> --checks pii --tiers 1on such a file ended with "Possible credit card number" and exit 1. It now passes with exit 0.1.000000e+00 0.000000e+00 ...) were reported as the phone number+00 0.000000. Because only the first match on a line was considered, that false positive could also hide a real phone number later on the line.known=4111111111111111; card_number=4532015112830366, was dropped completely, so the real card was missed.Behavior changes to note
test card,exampleorfor testing. Textual exceptions are matched case-sensitively, as onmain, soTest cards:does not trigger thetest cardexception. A line that lists only listed test cards passes, in any grouping. A line with only newly listed numbers (for exampleVisa 4012 8888 8888 1881, Discover 6011111111111117) also passes now. Onmainit failed.37.123456, -12.654321;coordinates: 37.7749, -122.4194;Meet me at 37.7749, -122.4194;home: 37.774929, -122.419416.LineStringwith one position per line and four positions gives one finding instead of four. The file is still flagged. A position whose only cue is a"type"after"coordinates"is reported when a"geometry": {line is within two lines above it.Location: 37.7749, -122.4194,"latitude_longitude": ...,latlong: ..., a GeoJSONPointorFeature, a file namedgps_points.txt, a map link such ashttps://www.google.com/maps/@37.774929,-122.419416,17zorhttps://maps.apple.com/?ll=..., and ageo:37.774929,-122.419416URI.Merge order
timestamp_microseconds: 1707938736269577 id: 1234567812345678 card: 4532015112830366is not reported: the timestamp is filtered, and the Luhn check still looks only at the first remaining candidate (the non-Luhn ID).mainreported the timestamp on that line. With fix(tier1): avoid false positives for argument hints and GUIDs #273 merged the card is reported. The two branches merge cleanly, so land this PR after fix(tier1): avoid false positives for argument hints and GUIDs #273 or together with it._scan_lines_for_patternloop and adds methods next to_is_numeric_pii_false_positive. Whichever merges second keeps both: this PR'sexcepted_card_digits/line_exceptionsfiltering and feat(plugin): Add Plugin evaluation support across all tiers #28's author-email and URL-userinfo filters.CHANGELOG.md. If it merges first, move this entry under the new## Unreleased.Kept from public
matched_valueis the first candidate that survives filtering.%,viewport,~,np.array, ...). Only numeric test-card exceptions moved to a per-candidate check. The 15-digit378282246310005stays in the list but no longer has any effect, because the card pattern matches 16 digits only.0.8603333333333333), the long-digit-run guard and the Luhn check are unchanged. The ASCII class covers digits, so the long-digit-run guard still holds..csvis still not in the scannable extensions, so no CSV-column logic is introduced.Tests
tests/validators/test_security.pyadds 70 cases. 37 of them fail on unmodifiedmain. The other 33 are controls that must keep passing.unix_timeand digest labels in YAML, JSON and plain text, including snake_case prefixes (event_timestamp:,"created_at_epoch":,file_sha256:);checksumword;_…_and__…__);_scan_file_for_pii, so they hold whether or not a report redacts card numbers.Eforms.coordinates =/coordinates:assignments, and an unlabelled pair;"type": "Mesh"and a lower-case"type": "feature".lng,LatLng(, snake_case YAML keys, alocation.jsonfile name and agps_points.txtfile name;Points;"type"after"coordinates", and aFeaturebbox;/maps/@,.co.uk/maps,maps.google.com/?q=), Apple and Bing map links, ageo:URI, andlatlong,latlon,lonlatandlnglatkeys.pytest tests/validators tests/golden tests/test_cli.py tests/test_commands.py tests/reporting tests/cli tests/test_oss_boundary.py tests/test_oss_source_hygiene.py tests/test_oss_packaging.py tests/test_publication_evidence.py tests/inference/test_finding_verifier.py tests/test_quality_policy_gate.py tests/test_public_benchmark_gate.py tests/test_ci_change_classifier.py tests/test_benchmark_rollout_docs.py tests/test_checks_routing.py -n 8: 5,362 passed, 1 skipped.SKILL.mdlists4111111111111111, 4242424242424242.validate <skill> --checks pii --tiers 1exits 1 onmainwith a CRITICAL credit-card finding. On this branch it exits 0 with no findings. A skill withカード番号は4532015112830366ですorUse _4532015112830366_ at checkoutexits 1 with a CRITICAL credit-card finding on both. A skill withevent_timestamp: 1707938736269577andfile_sha256: 1707938736269577exits 1 onmainand 0 on this branch. A skill whoseSKILL.mdsaysOpen https://www.google.com/maps/@37.774929,-122.419416,17z to find my houseshows the same PII advisory on both.main.ruff check .passes.ruff formatadds no new formatting differences in the changed files.scripts/check_oss_boundary.pypasses.🤖 Generated with Claude Code