feat(0pt): PII-Gate GDPR-guardrail for personal-data sources (fail-closed)

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.
This commit is contained in:
2026-09-15 02:40:52 +02:00
committed by admin
parent 9cf797b5c8
commit 12080fc517
6 changed files with 678 additions and 1 deletions
+8
View File
@@ -63,6 +63,13 @@ export interface Source {
adapter_id?: string;
/** Mirrors dim_source.access (docs/03-data-model.md). */
access?: SourceAccess;
/**
* Explicit self-flag that this source CAN expose personuppgifter. When
* true (or when the source is a known directory domain like ratsit.se),
* the PiiGateService requires a PiiPolicy with a recorded lawful basis
* before any storage/query (fail-closed, GDPR art. 6).
*/
touches_personal_data?: boolean;
description?: string;
status: SourceStatus;
correlation_id?: string;
@@ -86,6 +93,7 @@ export interface CreateSourceInput {
name: string;
adapter_id?: string;
access?: SourceAccess;
touches_personal_data?: boolean;
description?: string;
status?: SourceStatus;
correlation_id?: string;