PiiGateService makes any future personal-data source (ratsit.se and other directory domains) technically GDPR-OK before the first byte is stored: - recorded legal basis (art. 6) with basis_ref evidence, no policy => fail-closed - data minimisation via field allowlist (art. 5(1)(c)) - storage limitation + enforceRetention purge (art. 5(1)(e)) - sha256-only identity keys + log redaction (art. 25/32) - accessStatement / erase subject-rights surfaces (art. 15/17) - robots/rate confirmation required for web+api sources; no stealth/bypass - audit trail via AUD0 at risk L3 (0pt.pii_*) - gate enabled by default in SourceQueryService 10 new tests; full suite 166 pass | 1 skip; typecheck (blocking gate) clean.
3.4 KiB
3.4 KiB
PII Guardrail — GDPR requirement for personal-data sources (0pt)
Status: enforced, fail-closed. No 0pt pipeline is crawling personuppgifter
today; the PiiGateService ships so that any future source that touches
personal data (Ratsit, Merinfo, Hitta, …) is technically GDPR-OK before the
first byte is stored.
The rule
- Classify. A source is personal-data if it self-flags
(
touches_personal_data) or is a known directory domain (ratsit.se, merinfo.se, hitta.se, mrkoll.se, eniro.se, birthday.se, upplysning.se). - No policy → no processing.
assertCanStore()throws unless aPiiPolicywith a validlegal_basis+basis_refis on record. - Everything is evidenced. Each decision is emitted to AUD0 at risk L3
(
0pt.pii_policy_created | pii_data_retained | pii_erased | pii_retention_purged).
GDPR article mapping
| Requirement | Implementation |
|---|---|
| Legal basis — art. 6 | legal_basis ∈ legitimate_interest/consent/contract/legal_obligation + basis_ref (LIA doc id, consent record id, contract clause, provision). Cannot be empty. |
| Data minimisation — art. 5(1)(c) | field_allowlist; storing any other field throws PiiMinimisationError. Empty allowlist = nothing stored. |
| Storage limitation — art. 5(1)(e) | retention_days; enforceRetention() purges expired rows. 0 = fetch-and-drop, nothing persisted. |
| Integrity/confidentiality — art. 32 | Only sha256 hashes of identity keys stored (recordStored); plaintext identity never written; log/trace redaction (redact()) for personnummer/e-mail/phone. |
| Right of access — art. 15 | accessStatement(subjectHash) — what is held on a subject, across sources. |
| Right to erasure — art. 17 | erase({ subject_hash, reason }) tombstones every stored value for the subject. |
| Data protection by design — art. 25 | Gate defaults ON in SourceQueryService; no bypass knobs. |
When someone requests a personal-data source (e.g. Ratsit)
- Confirm the source is actually needed and no anonymised/official alternative exists (official register > directory listing).
- Write the Legitimate Interest Assessment (or record consent /
contract / legal obligation) and store its id in
basis_ref. LIA minimum: purpose, necessity, individuals' rights impact, mitigations. - VERIFY current terms + robots.txt + availability on the live site. Do not hardcode "catsit.com allows" — re-check each enable.
- Set
robots_and_rate_confirmed: true+ aSourceRatePolicymatching the source's own limits (legacy N0D default forratsit.sewas1/min— treat that as a ceiling, not a target). - Define the minimum
field_allowlist(e.g. onlystreet_address, notphone). - Invoke
recordStoredfor every stored value and runenforceRetentionon a schedule (e.g. daily cron). - Record a DPIA note if processing is "large scale" (art. 35) — bulk directory scraping of living persons is large-scale by default.
Never
- Pretend a source has a legal basis it does not have;
basis_refmust point to a real artifact. - Store identity keys in plaintext (
pseudonymize_keysdefaults to true). - Use stealth/bot-bypass/rate-evasion — excluded by CLAUDE.md §1 regardless of GDPR.
- Claim compliance on a source we have not re-verified this season (
VERIFYmarkers are intentional).