Skip to content

detectors: Spanish social security number (NUSS), validated by its control - #29

Merged
yagobski merged 1 commit into
yagobski:mainfrom
claudiomartinsosa75-lgtm:feat/spanish-social-security
Oct 19, 2026
Merged

yagobski merged 1 commit into
yagobski:mainfrom
claudiomartinsosa75-lgtm:feat/spanish-social-security

Conversation

@claudiomartinsosa75-lgtm

Copy link
Copy Markdown
Contributor

Follows #23 (DNI/NIE) with the other Spanish government identifier that turns up in HR and health records: the social security number (NUSS, número de afiliación). Today it produces no finding.

Two digits of province, eight of number, two of control. The control is the province and number modulo 97 (a number below ten million counts as number + province × 10^7, the published rule), so a match is checked rather than guessed from the shape; 28 12345678 40 is the usual example and comes out right.

  • Grouped with one consistent separator (28/12345678/40, 28 12345678 40, 28-12345678-40): matches on its own.
  • A bare run of twelve digits is also an order or a reference, so it needs its label next to it: NUSS, NAF, número de afiliación, Seguridad Social.
  • Wrong control, mixed separators or a longer token: no match.

Registered like the DNI/NIE: spanish_social_security_number, HIGH, in group:government_ids and at AgentRisk level 4. Those were the only places listing national_insurance_number outside the tests.

Tests in tests/test_pii_spanish_nuss.py (control arithmetic, both forms, negatives, registration); the values are made up. Locally: ruff, SPDX and mypy clean; the full suite shows no new failures. CHANGELOG entry at the bottom of Added. Merges cleanly together with #27 and #28.

Refs Privatris/AgentLeak#4.

…ntrol

Two digits of province, eight of number, two of control; the control is the
province and number modulo 97, so a match is checked, not guessed from the
shape. Grouped with one consistent separator it matches on its own; a bare
run of twelve digits only next to its label (NUSS, NAF, numero de
afiliacion, Seguridad Social). Registered as spanish_social_security_number
in group:government_ids and at AgentRisk level 4.

Refs Privatris/AgentLeak#4.
@yagobski
yagobski merged commit 2a2ec11 into yagobski:main Oct 19, 2026
5 checks passed
nikhilred2619 pushed a commit to nikhilred2619/agentleak that referenced this pull request Nov 3, 2026
…ntrol (yagobski#29)

Two digits of province, eight of number, two of control; the control is the
province and number modulo 97, so a match is checked, not guessed from the
shape. Grouped with one consistent separator it matches on its own; a bare
run of twelve digits only next to its label (NUSS, NAF, numero de
afiliacion, Seguridad Social). Registered as spanish_social_security_number
in group:government_ids and at AgentRisk level 4.

Refs Privatris/AgentLeak#4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants