@radicaltools/cli 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +237 -22
  2. package/dist/hub-catalogue/concern/concern-api-evolution.radical +935 -0
  3. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1112 -0
  4. package/dist/hub-catalogue/concern/concern-authentication.radical +685 -0
  5. package/dist/hub-catalogue/concern/concern-authorization.radical +1464 -0
  6. package/dist/hub-catalogue/concern/concern-availability.radical +804 -0
  7. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1118 -0
  8. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1304 -0
  9. package/dist/hub-catalogue/concern/concern-capacity.radical +802 -0
  10. package/dist/hub-catalogue/concern/concern-communication-style.radical +1202 -0
  11. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1081 -0
  12. package/dist/hub-catalogue/concern/concern-data-store.radical +960 -0
  13. package/dist/hub-catalogue/concern/concern-decomposition.radical +1143 -0
  14. package/dist/hub-catalogue/concern/concern-deployment.radical +952 -0
  15. package/dist/hub-catalogue/concern/concern-encryption.radical +1055 -0
  16. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1340 -0
  17. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1151 -0
  18. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1079 -0
  19. package/dist/hub-catalogue/concern/concern-messaging.radical +940 -0
  20. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +864 -0
  21. package/dist/hub-catalogue/concern/concern-observability.radical +1048 -0
  22. package/dist/hub-catalogue/concern/concern-personal-data.radical +1434 -0
  23. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1153 -0
  24. package/dist/hub-catalogue/concern/concern-secrets.radical +1026 -0
  25. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1312 -0
  26. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1306 -0
  27. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1193 -0
  28. package/dist/index.js +9204 -5242
  29. package/package.json +5 -3
@@ -0,0 +1,1434 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-personal-data",
4
+ "category": "concern",
5
+ "name": "Personal data",
6
+ "description": "Data about people in the stores: on what basis it is kept, for how long, where it may go, and how a person gets it or has it erased.",
7
+ "tags": [
8
+ "privacy",
9
+ "gdpr",
10
+ "personal-data",
11
+ "retention",
12
+ "erasure",
13
+ "compliance"
14
+ ],
15
+ "requiredMetamodel": "c4-ddd-governance-builtin",
16
+ "concern": {
17
+ "id": "personal-data",
18
+ "trigger": "LIST NODES WHERE type = \"database\" AND external != true",
19
+ "why": "these stores keep data, and whether any of it is about people decides on what basis it is kept, for how long, where it may go and how it is erased.",
20
+ "group": "data"
21
+ },
22
+ "sources": [
23
+ {
24
+ "title": "Regulation (EU) 2016/679, General Data Protection Regulation (GDPR)",
25
+ "url": "https://eur-lex.europa.eu/eli/reg/2016/679/oj"
26
+ },
27
+ {
28
+ "title": "EDPB guidelines, recommendations and best practices (consent, data subject rights, transfers)",
29
+ "url": "https://www.edpb.europa.eu/our-work-tools/general-guidance/guidelines-recommendations-best-practices_en"
30
+ },
31
+ {
32
+ "title": "ICO, UK GDPR guidance and resources",
33
+ "url": "https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/"
34
+ }
35
+ ],
36
+ "templateParams": [
37
+ {
38
+ "key": "PERSONAL",
39
+ "title": "Personal data",
40
+ "label": "Does it keep data about people?",
41
+ "hint": "Names, e-mail and IP addresses, device and customer ids, and anything else that can be tied to a person count (GDPR Art. 4(1)); so do log lines that carry them.",
42
+ "defaultValue": "yes",
43
+ "options": [
44
+ {
45
+ "value": "yes",
46
+ "label": "yes, data about people",
47
+ "description": "Any field, log line or event that identifies a person directly or with other data the organisation holds. Pick it when the store keeps accounts, customers, employees, addresses, IPs or user ids; retention, rights, location and security become requirements."
48
+ },
49
+ {
50
+ "value": "no",
51
+ "label": "no, nothing that identifies a person",
52
+ "description": "Only data about things: products, prices, telemetry without user or device ids. Pick it only when no column, log line or event can be tied to a person; the decision records it and a scan keeps it true."
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "key": "SPECIAL",
58
+ "title": "Special categories",
59
+ "label": "Does it keep health, biometric or other special-category data?",
60
+ "hint": "GDPR Art. 9 forbids processing health, genetic, biometric, ethnic, religious, political, trade-union and sex-life data unless one of its exceptions applies, and a large-scale use needs a data protection impact assessment (Art. 35).",
61
+ "defaultValue": "no",
62
+ "options": [
63
+ {
64
+ "value": "no",
65
+ "label": "no special categories",
66
+ "description": "None of the Art. 9 categories and no criminal records (Art. 10). Pick it for ordinary customer, order and account data."
67
+ },
68
+ {
69
+ "value": "yes",
70
+ "label": "special-category data",
71
+ "description": "Health or fitness readings, diagnoses, biometrics used to identify, genetic data, beliefs, ethnicity or sexual orientation, even inferred. Pick it whenever such a field exists or can be derived; it adds field-level encryption, read logging and an impact assessment."
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "key": "REGION",
77
+ "title": "Location",
78
+ "label": "Where may the personal data be kept and processed?",
79
+ "hint": "Chapter V of the GDPR allows a transfer outside the EU/EEA only to a country with an adequacy decision or under safeguards such as standard contractual clauses; backups, logs, support tools and every processor count.",
80
+ "defaultValue": "eu",
81
+ "options": [
82
+ {
83
+ "value": "eu",
84
+ "label": "in the EU/EEA only",
85
+ "description": "Stores, backups, logs and every processor stay in EU/EEA regions. Pick it when customers or contracts demand it, for public-sector or health data, or simply to need no transfer mechanism at all."
86
+ },
87
+ {
88
+ "value": "adequate",
89
+ "label": "in the EU/EEA or a country with an adequacy decision",
90
+ "description": "Also the UK, Switzerland, Japan, Canada, the US (certified under the Data Privacy Framework) and the other countries the Commission has found adequate (Art. 45). Pick it when a processor you need runs there and nowhere else."
91
+ },
92
+ {
93
+ "value": "any",
94
+ "label": "anywhere, under standard contractual clauses",
95
+ "description": "Transfers to any country with the Commission's standard contractual clauses and a transfer impact assessment per processor (Art. 46, EDPB Recommendations 01/2020). Pick it when global processors or follow-the-sun support are needed and someone owns the assessments."
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "key": "ERASURE",
101
+ "title": "Erasure",
102
+ "label": "How is a person's data erased?",
103
+ "hint": "Erasure (Art. 17) and retention (Art. 5(1)(e)) have to reach every copy: replicas, caches, logs, exports and backups that cannot be edited.",
104
+ "defaultValue": "delete",
105
+ "options": [
106
+ {
107
+ "value": "delete",
108
+ "label": "deletion",
109
+ "description": "Rows and documents are deleted where they live; backups age out and a restore re-applies the erasures made since it was taken. Pick it when the stores are few and known, and backups are kept for weeks rather than years."
110
+ },
111
+ {
112
+ "value": "anonymise",
113
+ "label": "anonymisation in place",
114
+ "description": "Identifiers are replaced or generalised so the records no longer relate to anyone, and the records stay for statistics and accounting. Pick it when the business needs the history (orders, revenue) after the person is gone."
115
+ },
116
+ {
117
+ "value": "crypto",
118
+ "label": "crypto-shredding",
119
+ "description": "Each person's fields are encrypted with a key of their own; destroying the key erases them in every store, log and backup at once. Pick it when the data spreads to backups, event streams or archives you cannot edit, and you can run a key management service."
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ "key": "BASIS",
125
+ "title": "Lawful basis",
126
+ "label": "On what lawful basis is most of it processed?",
127
+ "hint": "Every purpose needs one of the six bases of Art. 6(1), and the basis decides which rights apply and what has to be recorded: consent must be provable and as easy to withdraw as to give; legitimate interests can be objected to.",
128
+ "defaultValue": "contract",
129
+ "options": [
130
+ {
131
+ "value": "contract",
132
+ "label": "contract or legal obligation",
133
+ "description": "Data needed to deliver what the person signed up for, or that the law requires you to keep (Art. 6(1)(b), (c)). Pick it for accounts, orders, invoices; purpose limitation is what must be enforced."
134
+ },
135
+ {
136
+ "value": "consent",
137
+ "label": "consent, recorded per purpose",
138
+ "description": "The person opted in to a purpose such as marketing or personalisation (Art. 6(1)(a), Art. 7). Pick it when the processing is optional for the service; each consent is recorded and its withdrawal stops the processing."
139
+ },
140
+ {
141
+ "value": "legitimate",
142
+ "label": "legitimate interests",
143
+ "description": "Processing the person would reasonably expect, such as fraud prevention or analytics on their use, after a balancing test (Art. 6(1)(f)). Pick it when consent does not fit and you have documented the test; objections (Art. 21) must be honoured."
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ "key": "RETENTION_MONTHS",
149
+ "label": "After how many months unused is personal data erased?",
150
+ "defaultValue": "24",
151
+ "type": "number"
152
+ },
153
+ {
154
+ "key": "ERASE_DAYS",
155
+ "label": "Within how many days is an erasure request done (at most 30)?",
156
+ "defaultValue": "30",
157
+ "type": "number"
158
+ },
159
+ {
160
+ "key": "BACKUP_DAYS",
161
+ "label": "For how many days are backups kept?",
162
+ "defaultValue": "35",
163
+ "type": "number"
164
+ }
165
+ ]
166
+ },
167
+ "nodes": [
168
+ {
169
+ "id": "need",
170
+ "type": "need",
171
+ "label": "People's data handled lawfully",
172
+ "x": 0,
173
+ "y": 0,
174
+ "kind": "brief",
175
+ "source": "Hub concern pack: Personal data",
176
+ "description": "The system keeps data about people. Data protection law and the people themselves expect it to be processed only for a stated purpose on a lawful basis, kept no longer than needed, kept where the law allows, protected against leaks, handed over when a person asks and erased when they ask, every copy included. The organisation also has to be able to show, at any time, what it keeps, why, where and for how long."
177
+ },
178
+ {
179
+ "id": "req-record",
180
+ "type": "requirement",
181
+ "label": "Record of processing",
182
+ "x": 260,
183
+ "y": 0,
184
+ "ears_type": "ubiquitous",
185
+ "action": "keep a record of processing that names, for every store and field holding personal data, its purpose, lawful basis, retention period, recipients and location, and update it in the same change that adds or alters such a field",
186
+ "rationale": "The controller has to keep a record of processing activities (GDPR Art. 30) and be able to show compliance (Art. 5(2)); a record updated in the same change cannot drift from the schema.",
187
+ "hubWhen": {
188
+ "PERSONAL": [
189
+ "yes"
190
+ ]
191
+ }
192
+ },
193
+ {
194
+ "id": "req-retain",
195
+ "type": "requirement",
196
+ "label": "Unused data expires",
197
+ "x": 260,
198
+ "y": 130,
199
+ "ears_type": "event-driven",
200
+ "trigger": "personal data has not been used for {{RETENTION_MONTHS}} months and no legal obligation requires keeping it",
201
+ "action": "erase it by {{ERASURE}} within 7 days, in every store, cache and export",
202
+ "rationale": "Storage limitation (GDPR Art. 5(1)(e)) and data minimisation (Art. 5(1)(c)): data not kept cannot leak, and a fixed period is what the record of processing can state.",
203
+ "hubWhen": {
204
+ "PERSONAL": [
205
+ "yes"
206
+ ]
207
+ }
208
+ },
209
+ {
210
+ "id": "req-access",
211
+ "type": "requirement",
212
+ "label": "Own data on request",
213
+ "x": 260,
214
+ "y": 260,
215
+ "ears_type": "event-driven",
216
+ "trigger": "a person whose identity has been verified asks for the data kept about them",
217
+ "action": "deliver all of it from every store, as JSON, within 30 days, together with the purposes, recipients, retention periods and source of each part",
218
+ "rationale": "The right of access (GDPR Art. 15) and the right to data portability in a structured, commonly used, machine-readable format (Art. 20), both within one month (Art. 12(3)).",
219
+ "hubWhen": {
220
+ "PERSONAL": [
221
+ "yes"
222
+ ]
223
+ }
224
+ },
225
+ {
226
+ "id": "req-erase",
227
+ "type": "requirement",
228
+ "label": "Erasure on request",
229
+ "x": 260,
230
+ "y": 390,
231
+ "ears_type": "event-driven",
232
+ "trigger": "a verified person's erasure request is accepted",
233
+ "action": "erase their data by {{ERASURE}} in every store, replica, cache, log and export within {{ERASE_DAYS}} days, keep only what a legal obligation requires, tell every recipient it was disclosed to, and confirm to the person",
234
+ "rationale": "The right to erasure (GDPR Art. 17) within one month (Art. 12(3)), passed on to the recipients (Art. 19); records the law requires (invoices) are an exception of Art. 17(3)(b).",
235
+ "hubWhen": {
236
+ "PERSONAL": [
237
+ "yes"
238
+ ]
239
+ }
240
+ },
241
+ {
242
+ "id": "req-backups",
243
+ "type": "requirement",
244
+ "label": "Erasures survive restores",
245
+ "x": 260,
246
+ "y": 520,
247
+ "ears_type": "unwanted-behaviour",
248
+ "unwanted_condition": "a backup taken before an erasure is restored",
249
+ "action": "re-apply every erasure recorded since the backup was taken before the restored store serves a request, and let backups expire after {{BACKUP_DAYS}} days",
250
+ "rationale": "Backups cannot be edited, so they are put \"beyond use\" until they expire (ICO, right to erasure); a restore must not bring erased people back (GDPR Art. 17).",
251
+ "hubWhen": {
252
+ "PERSONAL": [
253
+ "yes"
254
+ ],
255
+ "ERASURE": [
256
+ "delete",
257
+ "anonymise"
258
+ ]
259
+ }
260
+ },
261
+ {
262
+ "id": "req-anonymise",
263
+ "type": "requirement",
264
+ "label": "Anonymised for good",
265
+ "x": 260,
266
+ "y": 650,
267
+ "ears_type": "ubiquitous",
268
+ "action": "replace direct identifiers with random values without keeping any mapping, and generalise the remaining quasi-identifiers (birth date, postcode, gender) until every combination of them occurs in at least 5 records",
269
+ "rationale": "Anonymous data is outside the GDPR only when the person can no longer be identified by any reasonably likely means (Recital 26); pseudonymised data with a key is still personal (Art. 4(5)). k-anonymity of 5 is a common floor (Article 29 Working Party, Opinion 05/2014 on anonymisation techniques).",
270
+ "hubWhen": {
271
+ "PERSONAL": [
272
+ "yes"
273
+ ],
274
+ "ERASURE": [
275
+ "anonymise"
276
+ ]
277
+ }
278
+ },
279
+ {
280
+ "id": "req-shred",
281
+ "type": "requirement",
282
+ "label": "Erasure by key destruction",
283
+ "x": 260,
284
+ "y": 780,
285
+ "ears_type": "event-driven",
286
+ "trigger": "a person's erasure request is accepted, or their data passes its retention period",
287
+ "action": "destroy the person's data key within 24 hours, and its copies in key backups within {{BACKUP_DAYS}} days, so that their fields in every store, event, log and backup can no longer be decrypted",
288
+ "rationale": "Encrypted data whose key no longer exists cannot be read by anyone, which reaches backups and event streams that cannot be edited (GDPR Art. 17, ICO on erasure of backups).",
289
+ "hubWhen": {
290
+ "PERSONAL": [
291
+ "yes"
292
+ ],
293
+ "ERASURE": [
294
+ "crypto"
295
+ ]
296
+ }
297
+ },
298
+ {
299
+ "id": "req-protect",
300
+ "type": "requirement",
301
+ "label": "Protected at rest and in transit",
302
+ "x": 260,
303
+ "y": 910,
304
+ "ears_type": "ubiquitous",
305
+ "action": "encrypt personal data in transit with TLS 1.2 or later and at rest with AES-256, give staff access to it only through roles that need it, and review those roles every 6 months",
306
+ "rationale": "Security of processing (GDPR Art. 32(1)(a), (b)) and integrity and confidentiality (Art. 5(1)(f)); encryption also decides whether a breach must be told to the people affected (Art. 34(3)(a)).",
307
+ "hubWhen": {
308
+ "PERSONAL": [
309
+ "yes"
310
+ ]
311
+ }
312
+ },
313
+ {
314
+ "id": "req-breach",
315
+ "type": "requirement",
316
+ "label": "Breaches reported in time",
317
+ "x": 260,
318
+ "y": 1040,
319
+ "ears_type": "event-driven",
320
+ "trigger": "a breach of personal data is detected",
321
+ "action": "notify the supervisory authority within 72 hours of becoming aware of it, unless it is unlikely to result in a risk to people, tell the people affected without undue delay when the risk is high, and record every breach in the breach register",
322
+ "rationale": "GDPR Art. 33(1) sets 72 hours for the notification, Art. 34 the duty to tell the people affected, Art. 33(5) the register of all breaches.",
323
+ "hubWhen": {
324
+ "PERSONAL": [
325
+ "yes"
326
+ ]
327
+ }
328
+ },
329
+ {
330
+ "id": "req-region-eu",
331
+ "type": "requirement",
332
+ "label": "Kept in the EU/EEA",
333
+ "x": 260,
334
+ "y": 1170,
335
+ "ears_type": "ubiquitous",
336
+ "action": "store and process personal data only in EU/EEA regions, with backups, logs, support tools and every processor included",
337
+ "rationale": "No transfer outside the EU/EEA, so none of the conditions of GDPR Chapter V (Art. 44-49) has to be met or proven.",
338
+ "hubWhen": {
339
+ "PERSONAL": [
340
+ "yes"
341
+ ],
342
+ "REGION": [
343
+ "eu"
344
+ ]
345
+ }
346
+ },
347
+ {
348
+ "id": "req-region-adequate",
349
+ "type": "requirement",
350
+ "label": "Only to adequate countries",
351
+ "x": 260,
352
+ "y": 1300,
353
+ "ears_type": "ubiquitous",
354
+ "action": "transfer personal data outside the EU/EEA only to countries covered by an adequacy decision of the European Commission, and list every processor with its country in the processor register",
355
+ "rationale": "A transfer on the basis of an adequacy decision needs no further authorisation (GDPR Art. 45(1)); the register is part of the record of processing (Art. 30(1)(e)).",
356
+ "hubWhen": {
357
+ "PERSONAL": [
358
+ "yes"
359
+ ],
360
+ "REGION": [
361
+ "adequate"
362
+ ]
363
+ }
364
+ },
365
+ {
366
+ "id": "req-region-scc",
367
+ "type": "requirement",
368
+ "label": "Transfers under safeguards",
369
+ "x": 260,
370
+ "y": 1430,
371
+ "ears_type": "event-driven",
372
+ "trigger": "personal data is to be sent to a processor in a country outside the EU/EEA without an adequacy decision",
373
+ "action": "sign the Commission's standard contractual clauses and complete a transfer impact assessment before the first transfer, record both in the processor register, and review the assessment every 12 months",
374
+ "rationale": "Without an adequacy decision a transfer needs appropriate safeguards (GDPR Art. 46(2)(c)) and an assessment of the destination's law (CJEU C-311/18 Schrems II, EDPB Recommendations 01/2020).",
375
+ "hubWhen": {
376
+ "PERSONAL": [
377
+ "yes"
378
+ ],
379
+ "REGION": [
380
+ "any"
381
+ ]
382
+ }
383
+ },
384
+ {
385
+ "id": "req-special",
386
+ "type": "requirement",
387
+ "label": "Special categories guarded",
388
+ "x": 260,
389
+ "y": 1560,
390
+ "ears_type": "ubiquitous",
391
+ "action": "process special-category data only under an Art. 9(2) condition recorded per person, encrypt those fields at field level with keys only the services that need them can use, and log every read with the reader, the time and the purpose, keeping the log 12 months",
392
+ "rationale": "Special categories may be processed only under an exception of GDPR Art. 9(2), most often explicit consent; field-level encryption and read logs are the appropriate measures of Art. 32 for data whose leak harms most.",
393
+ "hubWhen": {
394
+ "PERSONAL": [
395
+ "yes"
396
+ ],
397
+ "SPECIAL": [
398
+ "yes"
399
+ ]
400
+ }
401
+ },
402
+ {
403
+ "id": "req-dpia",
404
+ "type": "requirement",
405
+ "label": "Impact assessed first",
406
+ "x": 260,
407
+ "y": 1690,
408
+ "ears_type": "event-driven",
409
+ "trigger": "a change adds a new purpose, store or recipient for special-category data",
410
+ "action": "complete and approve a data protection impact assessment, with the data protection officer's advice, before the change is deployed",
411
+ "rationale": "Large-scale processing of special categories requires a DPIA before it starts (GDPR Art. 35(1), (3)(b)), with the DPO consulted (Art. 35(2)).",
412
+ "hubWhen": {
413
+ "PERSONAL": [
414
+ "yes"
415
+ ],
416
+ "SPECIAL": [
417
+ "yes"
418
+ ]
419
+ }
420
+ },
421
+ {
422
+ "id": "req-purpose",
423
+ "type": "requirement",
424
+ "label": "Used only for its purpose",
425
+ "x": 260,
426
+ "y": 1820,
427
+ "ears_type": "unwanted-behaviour",
428
+ "unwanted_condition": "a service the record of processing does not list for a field's purpose tries to read it",
429
+ "action": "refuse the read through the database role or API it uses, and log the attempt",
430
+ "rationale": "Data collected for a contract may not be reused for unrelated purposes (purpose limitation, GDPR Art. 5(1)(b), Art. 6(1)(b), (4)); access rights enforce what the record states.",
431
+ "hubWhen": {
432
+ "PERSONAL": [
433
+ "yes"
434
+ ],
435
+ "BASIS": [
436
+ "contract"
437
+ ]
438
+ }
439
+ },
440
+ {
441
+ "id": "req-consent",
442
+ "type": "requirement",
443
+ "label": "Consent provable and revocable",
444
+ "x": 260,
445
+ "y": 1950,
446
+ "ears_type": "event-driven",
447
+ "trigger": "a person gives or withdraws consent for a purpose",
448
+ "action": "record it with the purpose, the version of the wording shown, the time and the channel, and on withdrawal stop processing for that purpose within 24 hours, with withdrawing taking no more steps than giving",
449
+ "rationale": "The controller must be able to demonstrate consent (GDPR Art. 7(1)), and withdrawing it must be as easy as giving it (Art. 7(3); EDPB Guidelines 05/2020 on consent).",
450
+ "hubWhen": {
451
+ "PERSONAL": [
452
+ "yes"
453
+ ],
454
+ "BASIS": [
455
+ "consent"
456
+ ]
457
+ }
458
+ },
459
+ {
460
+ "id": "req-objection",
461
+ "type": "requirement",
462
+ "label": "Objections honoured",
463
+ "x": 260,
464
+ "y": 2080,
465
+ "ears_type": "event-driven",
466
+ "trigger": "a person objects to processing based on legitimate interests",
467
+ "action": "stop that processing for them within 7 days unless a documented compelling ground overrides it, and stop direct marketing at once without exception",
468
+ "rationale": "The right to object (GDPR Art. 21(1)), absolute for direct marketing (Art. 21(2), (3)); legitimate interests need a documented balancing test (Art. 6(1)(f)).",
469
+ "hubWhen": {
470
+ "PERSONAL": [
471
+ "yes"
472
+ ],
473
+ "BASIS": [
474
+ "legitimate"
475
+ ]
476
+ }
477
+ },
478
+ {
479
+ "id": "req-none",
480
+ "type": "requirement",
481
+ "label": "No personal data kept",
482
+ "x": 260,
483
+ "y": 2210,
484
+ "ears_type": "ubiquitous",
485
+ "action": "keep no data that identifies a person, directly or with other data the organisation holds, in its stores, events or logs",
486
+ "rationale": "Recorded as a requirement and scanned for, the absence of personal data is checked rather than assumed (GDPR Art. 4(1), Recital 26).",
487
+ "hubWhen": {
488
+ "PERSONAL": [
489
+ "no"
490
+ ]
491
+ }
492
+ },
493
+ {
494
+ "id": "sc-record",
495
+ "type": "scenario",
496
+ "label": "New field recorded",
497
+ "x": 520,
498
+ "y": 0,
499
+ "given": "a migration that adds a column with personal data",
500
+ "when": "the change is built",
501
+ "then": "it fails unless the record of processing names the column with purpose, basis, retention, recipients and location",
502
+ "hubWhen": {
503
+ "PERSONAL": [
504
+ "yes"
505
+ ]
506
+ }
507
+ },
508
+ {
509
+ "id": "sc-retain",
510
+ "type": "scenario",
511
+ "label": "Old data expires",
512
+ "x": 520,
513
+ "y": 130,
514
+ "given": "an account unused for {{RETENTION_MONTHS}} months and another used last week",
515
+ "when": "the retention job runs",
516
+ "then": "within 7 days nothing identifies the first in any store; the second is untouched",
517
+ "hubWhen": {
518
+ "PERSONAL": [
519
+ "yes"
520
+ ]
521
+ }
522
+ },
523
+ {
524
+ "id": "sc-access",
525
+ "type": "scenario",
526
+ "label": "Data handed over",
527
+ "x": 520,
528
+ "y": 260,
529
+ "given": "a verified person with an account, orders and support tickets",
530
+ "when": "they ask for their data",
531
+ "then": "within 30 days they receive one JSON file holding all of it, with purposes, recipients and retention periods",
532
+ "hubWhen": {
533
+ "PERSONAL": [
534
+ "yes"
535
+ ]
536
+ }
537
+ },
538
+ {
539
+ "id": "sc-erase",
540
+ "type": "scenario",
541
+ "label": "Person erased",
542
+ "x": 520,
543
+ "y": 390,
544
+ "given": "a person with an account, orders, log entries and a copy at a processor",
545
+ "when": "their erasure request is accepted",
546
+ "then": "within {{ERASE_DAYS}} days nothing identifies them in any store, log or export, the processor is told, invoices remain, and the person is told",
547
+ "hubWhen": {
548
+ "PERSONAL": [
549
+ "yes"
550
+ ]
551
+ }
552
+ },
553
+ {
554
+ "id": "sc-backups",
555
+ "type": "scenario",
556
+ "label": "Restore keeps erasures",
557
+ "x": 520,
558
+ "y": 520,
559
+ "given": "a backup taken before a person was erased",
560
+ "when": "the backup is restored",
561
+ "then": "the person is erased again before the store serves its first request",
562
+ "hubWhen": {
563
+ "PERSONAL": [
564
+ "yes"
565
+ ],
566
+ "ERASURE": [
567
+ "delete",
568
+ "anonymise"
569
+ ]
570
+ }
571
+ },
572
+ {
573
+ "id": "sc-anonymise",
574
+ "type": "scenario",
575
+ "label": "No one singled out",
576
+ "x": 520,
577
+ "y": 650,
578
+ "given": "the anonymised records of erased people",
579
+ "when": "they are grouped by birth year, postcode prefix and gender",
580
+ "then": "no group holds fewer than 5 records and no table maps them back",
581
+ "hubWhen": {
582
+ "PERSONAL": [
583
+ "yes"
584
+ ],
585
+ "ERASURE": [
586
+ "anonymise"
587
+ ]
588
+ }
589
+ },
590
+ {
591
+ "id": "sc-shred",
592
+ "type": "scenario",
593
+ "label": "Key destroyed",
594
+ "x": 520,
595
+ "y": 780,
596
+ "given": "a person whose fields are in the store, an event stream and last night's backup",
597
+ "when": "their erasure is accepted and 24 hours pass",
598
+ "then": "their key is gone and decrypting any of those copies fails",
599
+ "hubWhen": {
600
+ "PERSONAL": [
601
+ "yes"
602
+ ],
603
+ "ERASURE": [
604
+ "crypto"
605
+ ]
606
+ }
607
+ },
608
+ {
609
+ "id": "sc-protect",
610
+ "type": "scenario",
611
+ "label": "Encrypted everywhere",
612
+ "x": 520,
613
+ "y": 910,
614
+ "given": "the store, its replicas and backups",
615
+ "when": "their encryption settings and the roles with read access are listed",
616
+ "then": "all are encrypted with AES-256, connections refuse TLS below 1.2, and every role with access was reviewed in the last 6 months",
617
+ "hubWhen": {
618
+ "PERSONAL": [
619
+ "yes"
620
+ ]
621
+ }
622
+ },
623
+ {
624
+ "id": "sc-breach",
625
+ "type": "scenario",
626
+ "label": "Breach reported",
627
+ "x": 520,
628
+ "y": 1040,
629
+ "given": "a log export with e-mail addresses found on a public bucket",
630
+ "when": "it is reported to the on-call team",
631
+ "then": "the authority is notified within 72 hours and the breach is in the register with its facts, effects and remedy",
632
+ "hubWhen": {
633
+ "PERSONAL": [
634
+ "yes"
635
+ ]
636
+ }
637
+ },
638
+ {
639
+ "id": "sc-region-eu",
640
+ "type": "scenario",
641
+ "label": "Nothing leaves the EU",
642
+ "x": 520,
643
+ "y": 1170,
644
+ "given": "the deployment, its backups and every processor in the register",
645
+ "when": "their regions and countries are listed",
646
+ "then": "all are in the EU/EEA",
647
+ "hubWhen": {
648
+ "PERSONAL": [
649
+ "yes"
650
+ ],
651
+ "REGION": [
652
+ "eu"
653
+ ]
654
+ }
655
+ },
656
+ {
657
+ "id": "sc-region-adequate",
658
+ "type": "scenario",
659
+ "label": "Only adequate countries",
660
+ "x": 520,
661
+ "y": 1300,
662
+ "given": "the processor register",
663
+ "when": "it is checked against the Commission's adequacy list",
664
+ "then": "every processor outside the EU/EEA is in a country on that list",
665
+ "hubWhen": {
666
+ "PERSONAL": [
667
+ "yes"
668
+ ],
669
+ "REGION": [
670
+ "adequate"
671
+ ]
672
+ }
673
+ },
674
+ {
675
+ "id": "sc-region-scc",
676
+ "type": "scenario",
677
+ "label": "Transfer safeguarded",
678
+ "x": 520,
679
+ "y": 1430,
680
+ "given": "a new support tool hosted outside the EU/EEA and adequate countries",
681
+ "when": "it is to receive customer data",
682
+ "then": "no data is sent before its clauses and impact assessment are in the processor register",
683
+ "hubWhen": {
684
+ "PERSONAL": [
685
+ "yes"
686
+ ],
687
+ "REGION": [
688
+ "any"
689
+ ]
690
+ }
691
+ },
692
+ {
693
+ "id": "sc-special",
694
+ "type": "scenario",
695
+ "label": "Health field guarded",
696
+ "x": 520,
697
+ "y": 1560,
698
+ "given": "a record with a diagnosis",
699
+ "when": "a service without the key and then a clinician's service read it",
700
+ "then": "the first gets only ciphertext; the second reads it and the read is logged with reader, time and purpose",
701
+ "hubWhen": {
702
+ "PERSONAL": [
703
+ "yes"
704
+ ],
705
+ "SPECIAL": [
706
+ "yes"
707
+ ]
708
+ }
709
+ },
710
+ {
711
+ "id": "sc-dpia",
712
+ "type": "scenario",
713
+ "label": "No DPIA, no deploy",
714
+ "x": 520,
715
+ "y": 1690,
716
+ "given": "a change that sends health data to a new analytics store",
717
+ "when": "it is to be deployed",
718
+ "then": "the deployment waits until its DPIA is approved",
719
+ "hubWhen": {
720
+ "PERSONAL": [
721
+ "yes"
722
+ ],
723
+ "SPECIAL": [
724
+ "yes"
725
+ ]
726
+ }
727
+ },
728
+ {
729
+ "id": "sc-purpose",
730
+ "type": "scenario",
731
+ "label": "Other purpose refused",
732
+ "x": 520,
733
+ "y": 1820,
734
+ "given": "the marketing service, which the record does not list for order addresses",
735
+ "when": "it queries the order addresses",
736
+ "then": "the query is refused and logged",
737
+ "hubWhen": {
738
+ "PERSONAL": [
739
+ "yes"
740
+ ],
741
+ "BASIS": [
742
+ "contract"
743
+ ]
744
+ }
745
+ },
746
+ {
747
+ "id": "sc-consent",
748
+ "type": "scenario",
749
+ "label": "Consent withdrawn",
750
+ "x": 520,
751
+ "y": 1950,
752
+ "given": "a person who consented to personalised offers with wording version 3",
753
+ "when": "they withdraw it in one click",
754
+ "then": "the record shows both events with version and channel, and no offer is personalised for them after 24 hours",
755
+ "hubWhen": {
756
+ "PERSONAL": [
757
+ "yes"
758
+ ],
759
+ "BASIS": [
760
+ "consent"
761
+ ]
762
+ }
763
+ },
764
+ {
765
+ "id": "sc-objection",
766
+ "type": "scenario",
767
+ "label": "Objection honoured",
768
+ "x": 520,
769
+ "y": 2080,
770
+ "given": "a person included in usage analytics and marketing e-mails",
771
+ "when": "they object",
772
+ "then": "marketing stops at once and analytics excludes them within 7 days",
773
+ "hubWhen": {
774
+ "PERSONAL": [
775
+ "yes"
776
+ ],
777
+ "BASIS": [
778
+ "legitimate"
779
+ ]
780
+ }
781
+ },
782
+ {
783
+ "id": "sc-none",
784
+ "type": "scenario",
785
+ "label": "Nothing personal stored",
786
+ "x": 520,
787
+ "y": 2210,
788
+ "given": "the store's schema, a sample of its rows and a day of logs",
789
+ "when": "they are scanned for personal data",
790
+ "then": "nothing is found",
791
+ "hubWhen": {
792
+ "PERSONAL": [
793
+ "no"
794
+ ]
795
+ }
796
+ },
797
+ {
798
+ "id": "adr-delete",
799
+ "type": "adr",
800
+ "label": "Personal data erased by deletion",
801
+ "x": 780,
802
+ "y": 0,
803
+ "concern": "personal-data",
804
+ "status": "accepted",
805
+ "date": "",
806
+ "context": "This store keeps data, and some of it may be about people. The forces: data protection law (GDPR) limits why personal data may be processed, for how long it is kept and where it may go, and gives people the rights to get, take away and erase it, each within one month; copies multiply (replicas, backups, logs, exports, analytics, processors) and every one of them has to follow; health, biometric and other special categories carry a higher bar; erasing must not break the records others still need (invoices, the audit trail); and the controller has to be able to prove all of it (accountability, Art. 5(2)).",
807
+ "decision": "Personal data is kept only in the stores and fields the record of processing names, each field classified in the schema (a column comment or a data-catalogue tag in OpenMetadata or DataHub). Lawful basis: {{BASIS}}. Location: {{REGION}}. Erasure is deletion: one erasure routine knows every store; it publishes a PersonErased event that each owning service handles by deleting the person's rows (ON DELETE CASCADE where the schema allows), replacing them with a tombstone where invoices must stay. Logs carry user ids rather than names or addresses and are kept no longer than {{ERASE_DAYS}} days in the log store (Loki or OpenSearch retention). Backups expire after {{BACKUP_DAYS}} days and a restore replays the erasure ledger before serving. Unused data is erased after {{RETENTION_MONTHS}} months by a daily job. Choose deletion over crypto-shredding when the copies are few and known and backups are short-lived.",
808
+ "consequences": "• Erasure is simple to understand and to prove: the rows are gone.\n• Every new store, cache or export must join the erasure routine, or it leaks the people erased.\n• Erased people live on in backups for up to {{BACKUP_DAYS}} days; the erasure ledger is what keeps them from coming back on a restore.\n• Records the business needs later (revenue per month) must be aggregated before the deletion.",
809
+ "alternatives": "1. Anonymisation in place: keeps the history for statistics, but anonymisation must hold against re-identification.\n2. Crypto-shredding: reaches backups and streams at once, at the cost of a key per person and a key service on every read.\n3. Handling requests by hand: slow, error-prone and hard to prove.",
810
+ "hubWhen": {
811
+ "PERSONAL": [
812
+ "yes"
813
+ ],
814
+ "ERASURE": [
815
+ "delete"
816
+ ]
817
+ }
818
+ },
819
+ {
820
+ "id": "adr-anonymise",
821
+ "type": "adr",
822
+ "label": "Personal data erased by anonymisation",
823
+ "x": 780,
824
+ "y": 130,
825
+ "concern": "personal-data",
826
+ "status": "accepted",
827
+ "date": "",
828
+ "context": "This store keeps data, and some of it may be about people. The forces: data protection law (GDPR) limits why personal data may be processed, for how long it is kept and where it may go, and gives people the rights to get, take away and erase it, each within one month; copies multiply (replicas, backups, logs, exports, analytics, processors) and every one of them has to follow; health, biometric and other special categories carry a higher bar; erasing must not break the records others still need (invoices, the audit trail); and the controller has to be able to prove all of it (accountability, Art. 5(2)).",
829
+ "decision": "Personal data is kept only in the stores and fields the record of processing names, each field classified in the schema (a column comment or a data-catalogue tag in OpenMetadata or DataHub). Lawful basis: {{BASIS}}. Location: {{REGION}}. Erasure is anonymisation in place: direct identifiers (name, e-mail, phone, address, IP, external ids) are overwritten with random values and no mapping is kept; quasi-identifiers are generalised (birth date to year, postcode to its first two characters) until every combination occurs at least 5 times, which a dbt test checks; free-text fields are cleared. Logs carry user ids only and are kept no longer than {{ERASE_DAYS}} days. Backups expire after {{BACKUP_DAYS}} days and a restore replays the erasure ledger before serving. Unused data is anonymised after {{RETENTION_MONTHS}} months by a daily job. Use ARX or sdcMicro to measure re-identification risk when the quasi-identifiers change. Choose anonymisation when orders, revenue or usage history must outlive the person.",
830
+ "consequences": "• History stays usable for reporting and accounting without anyone in it.\n• Anonymisation that can be undone is pseudonymisation and still personal data: the k-anonymity check and the removal of free text are not optional.\n• Each new column must be classified as identifier, quasi-identifier or neither, or anonymisation misses it.\n• Backups still hold the original records until they expire after {{BACKUP_DAYS}} days.",
831
+ "alternatives": "1. Deletion in every store: simplest to prove, loses the history.\n2. Crypto-shredding: reaches backups at once, but the records become unreadable rather than anonymous.\n3. Pseudonymisation with a kept key: reversible, so it erases nothing (GDPR Art. 4(5)).",
832
+ "hubWhen": {
833
+ "PERSONAL": [
834
+ "yes"
835
+ ],
836
+ "ERASURE": [
837
+ "anonymise"
838
+ ]
839
+ }
840
+ },
841
+ {
842
+ "id": "adr-crypto",
843
+ "type": "adr",
844
+ "label": "Personal data erased by crypto-shredding",
845
+ "x": 780,
846
+ "y": 260,
847
+ "concern": "personal-data",
848
+ "status": "accepted",
849
+ "date": "",
850
+ "context": "This store keeps data, and some of it may be about people. The forces: data protection law (GDPR) limits why personal data may be processed, for how long it is kept and where it may go, and gives people the rights to get, take away and erase it, each within one month; copies multiply (replicas, backups, logs, exports, analytics, processors) and every one of them has to follow; health, biometric and other special categories carry a higher bar; erasing must not break the records others still need (invoices, the audit trail); and the controller has to be able to prove all of it (accountability, Art. 5(2)).",
851
+ "decision": "Personal data is kept only in the stores and fields the record of processing names, each field classified in the schema. Lawful basis: {{BASIS}}. Location: {{REGION}}. Every personal field is encrypted in the application with a data key of its own per person (envelope encryption, AES-256-GCM), the data keys wrapped by a key in a key management service: AWS KMS, Google Cloud KMS or Azure Key Vault on that cloud, HashiCorp Vault (Transit) on premises or across clouds; libraries such as AWS Encryption SDK or Google Tink do the envelope work. Erasure destroys the person's data key within 24 hours, which makes their fields in every store, event, log and backup unreadable; key backups expire after {{BACKUP_DAYS}} days. Unused data is shredded the same way after {{RETENTION_MONTHS}} months. Searchable fields (e-mail for sign-in) are kept as keyed hashes (HMAC) next to the ciphertext.",
852
+ "consequences": "• One key deletion erases a person everywhere, immutable backups and event streams included.\n• Every read of a personal field decrypts: a key cache and the key service's availability are on the hot path.\n• Searching, sorting and joining on encrypted fields is not possible; keyed hashes cover exact matches only.\n• A lost key store loses everyone's data: the key service needs its own backup and recovery, shorter-lived than {{BACKUP_DAYS}} days for destroyed keys.",
853
+ "alternatives": "1. Deletion in every store: no key service, but backups and streams keep the person until they expire.\n2. Anonymisation in place: keeps readable history, but must hold against re-identification.\n3. One key per store (transparent disk encryption): protects against stolen disks, erases no one.",
854
+ "hubWhen": {
855
+ "PERSONAL": [
856
+ "yes"
857
+ ],
858
+ "ERASURE": [
859
+ "crypto"
860
+ ]
861
+ }
862
+ },
863
+ {
864
+ "id": "adr-special",
865
+ "type": "adr",
866
+ "label": "Special categories encrypted and logged",
867
+ "x": 780,
868
+ "y": 390,
869
+ "concern": "personal-data",
870
+ "status": "accepted",
871
+ "date": "",
872
+ "context": "This store keeps data, and some of it may be about people. The forces: data protection law (GDPR) limits why personal data may be processed, for how long it is kept and where it may go, and gives people the rights to get, take away and erase it, each within one month; copies multiply (replicas, backups, logs, exports, analytics, processors) and every one of them has to follow; health, biometric and other special categories carry a higher bar; erasing must not break the records others still need (invoices, the audit trail); and the controller has to be able to prove all of it (accountability, Art. 5(2)). Here the store keeps special-category data (GDPR Art. 9), whose leak harms most and whose processing is forbidden unless an exception applies.",
873
+ "decision": "Special-category fields are kept in their own tables or documents, encrypted at field level (pgcrypto or application-side envelope encryption with keys in the key management service) with keys only the services named in the record of processing may use. Each person's Art. 9(2) condition, usually explicit consent, is recorded with its date. Every read of these fields is logged with reader, time and purpose (pgAudit for direct database access, the service's own audit log otherwise) and the log is kept 12 months. A data protection impact assessment is approved before any new purpose, store or recipient, and the change that brings one links it.",
874
+ "consequences": "• A leak of the main tables or a backup does not expose the special categories.\n• Analytics on these fields needs its own approved purpose and key, which slows ad-hoc analysis on purpose.\n• Read logs grow with use and are themselves personal data with a 12-month retention.\n• The DPIA becomes a release gate for changes that touch these fields.",
875
+ "alternatives": "1. Treat them like other personal data: simpler, but falls short of Art. 9 and Art. 32 for the data whose leak harms most.\n2. A separate system for special categories only: the strongest separation, but a second system to run and integrate.",
876
+ "hubWhen": {
877
+ "PERSONAL": [
878
+ "yes"
879
+ ],
880
+ "SPECIAL": [
881
+ "yes"
882
+ ]
883
+ }
884
+ },
885
+ {
886
+ "id": "adr-no-personal",
887
+ "type": "adr",
888
+ "label": "No personal data kept",
889
+ "x": 780,
890
+ "y": 520,
891
+ "concern": "personal-data",
892
+ "status": "accepted",
893
+ "date": "",
894
+ "context": "This store keeps data, and some of it may be about people. The forces: data protection law (GDPR) limits why personal data may be processed, for how long it is kept and where it may go, and gives people the rights to get, take away and erase it, each within one month; copies multiply (replicas, backups, logs, exports, analytics, processors) and every one of them has to follow; health, biometric and other special categories carry a higher bar; erasing must not break the records others still need (invoices, the audit trail); and the controller has to be able to prove all of it (accountability, Art. 5(2)). Here the store keeps no data about people.",
895
+ "decision": "The store keeps no data that identifies a person, directly or with other data the organisation holds; its events and logs carry none either (no user, device or session ids, no IP addresses). A scan with Microsoft Presidio of the schema, a sample of rows and a day of logs keeps it true. A feature that needs personal data needs this decision superseded first.",
896
+ "consequences": "• No retention, erasure, access or transfer obligations here.\n• Logs and analytics lose the user dimension: per-user debugging and funnels need a store that takes on the obligations.\n• A personal field added by accident fails the scan rather than staying unnoticed.",
897
+ "alternatives": "1. Keep personal data with limits, when a feature needs it: superseding this decision with the personal-data pack.\n2. Pseudonymous ids only: still personal data under GDPR Art. 4(5), so it would not lift the obligations.",
898
+ "hubWhen": {
899
+ "PERSONAL": [
900
+ "no"
901
+ ]
902
+ }
903
+ },
904
+ {
905
+ "id": "ff-retention",
906
+ "type": "fitness-fn",
907
+ "label": "Retention and erasure on time",
908
+ "x": 1040,
909
+ "y": 0,
910
+ "category": "operational",
911
+ "threshold": "0 personal records unused for more than {{RETENTION_MONTHS}} months, and 0 erasure requests open for more than {{ERASE_DAYS}} days",
912
+ "description": "A daily data test returns the records past retention and the erasure requests past their deadline; any row fails it and alerts the data owner.\n\nTool: dbt (a singular data test, run daily by the scheduler)\n\n```sql\n-- tests/personal_data_on_time.sql: every row returned is a failure\nselect 'past retention' as problem, cast(customer_id as text) as id\nfrom {{ ref('customers') }}\nwhere last_used_at < now() - interval '{{RETENTION_MONTHS}} months'\n and erased_at is null\n and legal_hold is not true\nunion all\nselect 'erasure overdue', cast(request_id as text)\nfrom {{ ref('erasure_requests') }}\nwhere completed_at is null\n and accepted_at < now() - interval '{{ERASE_DAYS}} days'\n```",
913
+ "hubWhen": {
914
+ "PERSONAL": [
915
+ "yes"
916
+ ]
917
+ }
918
+ },
919
+ {
920
+ "id": "ff-record",
921
+ "type": "fitness-fn",
922
+ "label": "Every field classified",
923
+ "x": 1040,
924
+ "y": 130,
925
+ "category": "structural",
926
+ "threshold": "0 columns in the migrated schema without a classification (personal or not-personal) in their comment",
927
+ "description": "In CI, after the migrations run against an empty database, a query lists the columns without a classification; a new column fails the build until it is classified, and a personal one until the record of processing names it.\n\nTool: psql in the CI pipeline, against the migrated schema\n\n```sql\n-- fails the build when it returns a row\nselect c.table_name, c.column_name\nfrom information_schema.columns c\njoin pg_class t on t.relname = c.table_name\njoin pg_namespace n on n.oid = t.relnamespace and n.nspname = c.table_schema\nleft join pg_description d on d.objoid = t.oid and d.objsubid = c.ordinal_position\nwhere c.table_schema = 'public'\n and coalesce(d.description, '') !~ '^(personal|not-personal)( |:|$)';\n```",
928
+ "hubWhen": {
929
+ "PERSONAL": [
930
+ "yes"
931
+ ]
932
+ }
933
+ },
934
+ {
935
+ "id": "ff-pii-scan",
936
+ "type": "fitness-fn",
937
+ "label": "Personal data where declared",
938
+ "x": 1040,
939
+ "y": 260,
940
+ "category": "structural",
941
+ "threshold": "0 personal data findings with a score of 0.6 or more in a day of logs and a sample of rows outside the fields classified as personal",
942
+ "description": "A nightly job exports a day of logs and a sample of rows from the fields not classified as personal and scans them for e-mail addresses, phone numbers, IP addresses, card numbers, IBANs and names; it reports the place and kind of each finding, never the value.\n\nTool: Microsoft Presidio (presidio-analyzer)\n\n```python\n# scan.py <file>: exits 1 when the file holds personal data\nimport sys\nfrom presidio_analyzer import AnalyzerEngine\n\nENTITIES = [\"EMAIL_ADDRESS\", \"PHONE_NUMBER\", \"IP_ADDRESS\", \"CREDIT_CARD\", \"IBAN_CODE\", \"PERSON\"]\nanalyzer = AnalyzerEngine()\nfound = 0\nwith open(sys.argv[1], encoding=\"utf-8\") as f:\n for n, line in enumerate(f, 1):\n for r in analyzer.analyze(text=line, entities=ENTITIES, language=\"en\", score_threshold=0.6):\n print(f\"{sys.argv[1]}:{n}: {r.entity_type}\") # never print the value\n found += 1\nsys.exit(1 if found else 0)\n```"
943
+ },
944
+ {
945
+ "id": "ff-erasure",
946
+ "type": "fitness-fn",
947
+ "label": "Erasure reaches every store",
948
+ "x": 1040,
949
+ "y": 390,
950
+ "category": "structural",
951
+ "threshold": "0 occurrences of an erased person's identifiers in any store after the erasure routine, and 0 after a restore of an older backup",
952
+ "description": "An integration test seeds one person with a unique e-mail across every store the record of processing names, runs the erasure routine, and searches each store for the e-mail and the person's id; it then restores a backup taken before the erasure and searches again after the ledger replay.\n\nTool: Vitest with Testcontainers (PostgreSQL and the other stores of the deployment)\n\n```ts\nit('erases a person from every store, and keeps them erased after a restore', async () => {\n const email = `erase-${crypto.randomUUID()}@example.test`\n const person = await seedEverywhere({ email }) // account, orders, tickets, search index\n const backup = await takeBackup()\n await erasure.run(person.id)\n for (const store of stores) expect(await store.find(email, person.id)).toEqual([])\n await restore(backup) // replays the erasure ledger before serving\n for (const store of stores) expect(await store.find(email, person.id)).toEqual([])\n})\n```",
953
+ "hubWhen": {
954
+ "PERSONAL": [
955
+ "yes"
956
+ ],
957
+ "ERASURE": [
958
+ "delete",
959
+ "anonymise"
960
+ ]
961
+ }
962
+ },
963
+ {
964
+ "id": "ff-k-anonymity",
965
+ "type": "fitness-fn",
966
+ "label": "Anonymised records not singled out",
967
+ "x": 1040,
968
+ "y": 520,
969
+ "category": "operational",
970
+ "threshold": "Every combination of quasi-identifiers among anonymised records occurs in at least 5 records (k ≥ 5)",
971
+ "description": "A daily data test groups the anonymised records by their quasi-identifiers and returns every group smaller than 5.\n\nTool: dbt (a singular data test)\n\n```sql\n-- tests/anonymised_k5.sql: every row returned is a group that singles people out\nselect birth_year, postcode_prefix, gender, count(*) as k\nfrom {{ ref('customers') }}\nwhere anonymised_at is not null\ngroup by birth_year, postcode_prefix, gender\nhaving count(*) < 5\n```",
972
+ "hubWhen": {
973
+ "PERSONAL": [
974
+ "yes"
975
+ ],
976
+ "ERASURE": [
977
+ "anonymise"
978
+ ]
979
+ }
980
+ },
981
+ {
982
+ "id": "ff-shred",
983
+ "type": "fitness-fn",
984
+ "label": "Shredded data unreadable",
985
+ "x": 1040,
986
+ "y": 650,
987
+ "category": "structural",
988
+ "threshold": "After an erasure, 0 of the person's encrypted fields decrypt in the store, the event stream or a backup, and their key is scheduled for deletion within 24 hours",
989
+ "description": "An integration test against a local KMS writes a person's fields, copies the ciphertext as a backup would, erases the person and expects the key to be pending deletion and every decryption to fail.\n\nTool: Vitest with LocalStack (AWS KMS) or a Vault dev server\n\n```ts\nit('makes every copy of an erased person unreadable', async () => {\n const person = await createPerson({ email: 'shred@example.test' })\n const copies = [await store.rawFields(person.id), await events.rawFields(person.id)] // ciphertext, as backups hold it\n await erasure.run(person.id)\n const key = await kms.send(new DescribeKeyCommand({ KeyId: person.keyId }))\n expect(key.KeyMetadata?.KeyState).toBe('PendingDeletion')\n for (const fields of copies) await expect(decryptFields(fields)).rejects.toThrow()\n})\n```",
990
+ "hubWhen": {
991
+ "PERSONAL": [
992
+ "yes"
993
+ ],
994
+ "ERASURE": [
995
+ "crypto"
996
+ ]
997
+ }
998
+ },
999
+ {
1000
+ "id": "ff-region",
1001
+ "type": "fitness-fn",
1002
+ "label": "Deployed in EU regions",
1003
+ "x": 1040,
1004
+ "y": 780,
1005
+ "category": "structural",
1006
+ "threshold": "0 providers, backup copies or processors outside EU/EEA regions in the infrastructure plan and the processor register",
1007
+ "description": "In CI the Terraform plan (terraform show -json) is checked by a policy that fails on any provider or backup copy destination outside the allowed EU regions; the same run checks processors.yaml, the processor register.\n\nTool: Open Policy Agent (conftest)\n\n```rego\npackage main\nimport rego.v1\n\neu_regions := {\"eu-central-1\", \"eu-central-2\", \"eu-west-1\", \"eu-west-3\", \"eu-north-1\", \"eu-south-1\", \"eu-south-2\"}\n\ndeny contains msg if {\n some name, p in input.configuration.provider_config\n p.name == \"aws\"\n region := p.expressions.region.constant_value\n not region in eu_regions\n msg := sprintf(\"provider %s deploys to %s, outside the EU\", [name, region])\n}\n\ndeny contains msg if {\n some r in input.resource_changes\n r.type == \"aws_backup_plan\"\n some rule in r.change.after.rule\n some copy in rule.copy_action\n not regex.match(\"arn:aws:backup:eu-\", copy.destination_vault_arn)\n msg := sprintf(\"backup plan %s copies outside the EU\", [r.address])\n}\n```",
1008
+ "hubWhen": {
1009
+ "PERSONAL": [
1010
+ "yes"
1011
+ ],
1012
+ "REGION": [
1013
+ "eu"
1014
+ ]
1015
+ }
1016
+ },
1017
+ {
1018
+ "id": "ff-adequacy",
1019
+ "type": "fitness-fn",
1020
+ "label": "Processors in adequate countries",
1021
+ "x": 1040,
1022
+ "y": 910,
1023
+ "category": "process",
1024
+ "threshold": "0 processors in the register outside the EU/EEA and the countries with an adequacy decision",
1025
+ "description": "In CI a policy checks processors.yaml, the processor register kept in the repository, against the EU/EEA and the adequacy list; the list is updated when the Commission adopts or withdraws a decision.\n\nTool: Open Policy Agent (conftest)\n\n```rego\npackage main\nimport rego.v1\n\neea := {\"AT\",\"BE\",\"BG\",\"HR\",\"CY\",\"CZ\",\"DK\",\"EE\",\"FI\",\"FR\",\"DE\",\"GR\",\"HU\",\"IE\",\"IT\",\"LV\",\"LT\",\"LU\",\"MT\",\"NL\",\"PL\",\"PT\",\"RO\",\"SK\",\"SI\",\"ES\",\"SE\",\"IS\",\"LI\",\"NO\"}\n# Adequacy decisions (GDPR Art. 45); US only for companies certified under the Data Privacy Framework\nadequate := {\"AD\",\"AR\",\"CA\",\"FO\",\"GG\",\"IL\",\"IM\",\"JP\",\"JE\",\"NZ\",\"KR\",\"CH\",\"GB\",\"UY\",\"US\"}\n\ndeny contains msg if {\n some p in input.processors\n not p.country in eea\n not p.country in adequate\n msg := sprintf(\"processor %s is in %s, which has no adequacy decision\", [p.name, p.country])\n}\n\ndeny contains msg if {\n some p in input.processors\n p.country == \"US\"\n not p.dpf_certified\n msg := sprintf(\"processor %s is in the US but not certified under the Data Privacy Framework\", [p.name])\n}\n```",
1026
+ "hubWhen": {
1027
+ "PERSONAL": [
1028
+ "yes"
1029
+ ],
1030
+ "REGION": [
1031
+ "adequate"
1032
+ ]
1033
+ }
1034
+ },
1035
+ {
1036
+ "id": "ff-scc",
1037
+ "type": "fitness-fn",
1038
+ "label": "Transfers have clauses and assessment",
1039
+ "x": 1040,
1040
+ "y": 1040,
1041
+ "category": "process",
1042
+ "threshold": "0 processors outside the EU/EEA without signed standard contractual clauses and a transfer impact assessment reviewed in the last 12 months",
1043
+ "description": "In CI a policy checks processors.yaml, the processor register: every processor outside the EU/EEA needs the date its clauses were signed and the date of its transfer impact assessment, not older than 12 months.\n\nTool: Open Policy Agent (conftest)\n\n```rego\npackage main\nimport rego.v1\n\neea := {\"AT\",\"BE\",\"BG\",\"HR\",\"CY\",\"CZ\",\"DK\",\"EE\",\"FI\",\"FR\",\"DE\",\"GR\",\"HU\",\"IE\",\"IT\",\"LV\",\"LT\",\"LU\",\"MT\",\"NL\",\"PL\",\"PT\",\"RO\",\"SK\",\"SI\",\"ES\",\"SE\",\"IS\",\"LI\",\"NO\"}\nyear_ns := 365 * 24 * 60 * 60 * 1000000000\n\ndeny contains msg if {\n some p in input.processors\n not p.country in eea\n not p.scc_signed\n msg := sprintf(\"processor %s in %s has no standard contractual clauses\", [p.name, p.country])\n}\n\ndeny contains msg if {\n some p in input.processors\n not p.country in eea\n time.now_ns() - time.parse_rfc3339_ns(sprintf(\"%sT00:00:00Z\", [p.tia_reviewed])) > year_ns\n msg := sprintf(\"processor %s: transfer impact assessment older than 12 months\", [p.name])\n}\n```",
1044
+ "hubWhen": {
1045
+ "PERSONAL": [
1046
+ "yes"
1047
+ ],
1048
+ "REGION": [
1049
+ "any"
1050
+ ]
1051
+ }
1052
+ },
1053
+ {
1054
+ "id": "ff-special",
1055
+ "type": "fitness-fn",
1056
+ "label": "Special fields encrypted",
1057
+ "x": 1040,
1058
+ "y": 1170,
1059
+ "category": "structural",
1060
+ "threshold": "Every column classified as special category is stored as ciphertext (bytea), and 0 roles outside the record of processing may read it",
1061
+ "description": "A database test run in CI after the migrations asserts that each special-category column holds ciphertext and that only the listed roles have SELECT on its table, and that pgAudit logs reads of it.\n\nTool: pgTAP (run with pg_prove)\n\n```sql\nBEGIN;\nSELECT plan(4);\nSELECT col_type_is('health', 'conditions', 'diagnosis', 'bytea', 'diagnosis is stored encrypted');\nSELECT table_privs_are('health', 'conditions', 'care_service', ARRAY['SELECT', 'INSERT', 'UPDATE']);\nSELECT table_privs_are('health', 'conditions', 'reporting', ARRAY[]::text[], 'reporting cannot read diagnoses');\nSELECT ok(current_setting('pgaudit.log') ~ 'read', 'pgAudit logs reads');\nSELECT * FROM finish();\nROLLBACK;\n```",
1062
+ "hubWhen": {
1063
+ "PERSONAL": [
1064
+ "yes"
1065
+ ],
1066
+ "SPECIAL": [
1067
+ "yes"
1068
+ ]
1069
+ }
1070
+ }
1071
+ ],
1072
+ "relations": [
1073
+ {
1074
+ "id": "req-record--derives--need",
1075
+ "sourceId": "req-record",
1076
+ "targetId": "need",
1077
+ "relationType": "derives"
1078
+ },
1079
+ {
1080
+ "id": "req-retain--derives--need",
1081
+ "sourceId": "req-retain",
1082
+ "targetId": "need",
1083
+ "relationType": "derives"
1084
+ },
1085
+ {
1086
+ "id": "req-access--derives--need",
1087
+ "sourceId": "req-access",
1088
+ "targetId": "need",
1089
+ "relationType": "derives"
1090
+ },
1091
+ {
1092
+ "id": "req-erase--derives--need",
1093
+ "sourceId": "req-erase",
1094
+ "targetId": "need",
1095
+ "relationType": "derives"
1096
+ },
1097
+ {
1098
+ "id": "req-backups--derives--need",
1099
+ "sourceId": "req-backups",
1100
+ "targetId": "need",
1101
+ "relationType": "derives"
1102
+ },
1103
+ {
1104
+ "id": "req-anonymise--derives--need",
1105
+ "sourceId": "req-anonymise",
1106
+ "targetId": "need",
1107
+ "relationType": "derives"
1108
+ },
1109
+ {
1110
+ "id": "req-shred--derives--need",
1111
+ "sourceId": "req-shred",
1112
+ "targetId": "need",
1113
+ "relationType": "derives"
1114
+ },
1115
+ {
1116
+ "id": "req-protect--derives--need",
1117
+ "sourceId": "req-protect",
1118
+ "targetId": "need",
1119
+ "relationType": "derives"
1120
+ },
1121
+ {
1122
+ "id": "req-breach--derives--need",
1123
+ "sourceId": "req-breach",
1124
+ "targetId": "need",
1125
+ "relationType": "derives"
1126
+ },
1127
+ {
1128
+ "id": "req-region-eu--derives--need",
1129
+ "sourceId": "req-region-eu",
1130
+ "targetId": "need",
1131
+ "relationType": "derives"
1132
+ },
1133
+ {
1134
+ "id": "req-region-adequate--derives--need",
1135
+ "sourceId": "req-region-adequate",
1136
+ "targetId": "need",
1137
+ "relationType": "derives"
1138
+ },
1139
+ {
1140
+ "id": "req-region-scc--derives--need",
1141
+ "sourceId": "req-region-scc",
1142
+ "targetId": "need",
1143
+ "relationType": "derives"
1144
+ },
1145
+ {
1146
+ "id": "req-special--derives--need",
1147
+ "sourceId": "req-special",
1148
+ "targetId": "need",
1149
+ "relationType": "derives"
1150
+ },
1151
+ {
1152
+ "id": "req-dpia--derives--need",
1153
+ "sourceId": "req-dpia",
1154
+ "targetId": "need",
1155
+ "relationType": "derives"
1156
+ },
1157
+ {
1158
+ "id": "req-purpose--derives--need",
1159
+ "sourceId": "req-purpose",
1160
+ "targetId": "need",
1161
+ "relationType": "derives"
1162
+ },
1163
+ {
1164
+ "id": "req-consent--derives--need",
1165
+ "sourceId": "req-consent",
1166
+ "targetId": "need",
1167
+ "relationType": "derives"
1168
+ },
1169
+ {
1170
+ "id": "req-objection--derives--need",
1171
+ "sourceId": "req-objection",
1172
+ "targetId": "need",
1173
+ "relationType": "derives"
1174
+ },
1175
+ {
1176
+ "id": "req-none--derives--need",
1177
+ "sourceId": "req-none",
1178
+ "targetId": "need",
1179
+ "relationType": "derives"
1180
+ },
1181
+ {
1182
+ "id": "sc-record--verifies--req-record",
1183
+ "sourceId": "sc-record",
1184
+ "targetId": "req-record",
1185
+ "relationType": "verifies"
1186
+ },
1187
+ {
1188
+ "id": "sc-retain--verifies--req-retain",
1189
+ "sourceId": "sc-retain",
1190
+ "targetId": "req-retain",
1191
+ "relationType": "verifies"
1192
+ },
1193
+ {
1194
+ "id": "sc-access--verifies--req-access",
1195
+ "sourceId": "sc-access",
1196
+ "targetId": "req-access",
1197
+ "relationType": "verifies"
1198
+ },
1199
+ {
1200
+ "id": "sc-erase--verifies--req-erase",
1201
+ "sourceId": "sc-erase",
1202
+ "targetId": "req-erase",
1203
+ "relationType": "verifies"
1204
+ },
1205
+ {
1206
+ "id": "sc-backups--verifies--req-backups",
1207
+ "sourceId": "sc-backups",
1208
+ "targetId": "req-backups",
1209
+ "relationType": "verifies"
1210
+ },
1211
+ {
1212
+ "id": "sc-anonymise--verifies--req-anonymise",
1213
+ "sourceId": "sc-anonymise",
1214
+ "targetId": "req-anonymise",
1215
+ "relationType": "verifies"
1216
+ },
1217
+ {
1218
+ "id": "sc-shred--verifies--req-shred",
1219
+ "sourceId": "sc-shred",
1220
+ "targetId": "req-shred",
1221
+ "relationType": "verifies"
1222
+ },
1223
+ {
1224
+ "id": "sc-protect--verifies--req-protect",
1225
+ "sourceId": "sc-protect",
1226
+ "targetId": "req-protect",
1227
+ "relationType": "verifies"
1228
+ },
1229
+ {
1230
+ "id": "sc-breach--verifies--req-breach",
1231
+ "sourceId": "sc-breach",
1232
+ "targetId": "req-breach",
1233
+ "relationType": "verifies"
1234
+ },
1235
+ {
1236
+ "id": "sc-region-eu--verifies--req-region-eu",
1237
+ "sourceId": "sc-region-eu",
1238
+ "targetId": "req-region-eu",
1239
+ "relationType": "verifies"
1240
+ },
1241
+ {
1242
+ "id": "sc-region-adequate--verifies--req-region-adequate",
1243
+ "sourceId": "sc-region-adequate",
1244
+ "targetId": "req-region-adequate",
1245
+ "relationType": "verifies"
1246
+ },
1247
+ {
1248
+ "id": "sc-region-scc--verifies--req-region-scc",
1249
+ "sourceId": "sc-region-scc",
1250
+ "targetId": "req-region-scc",
1251
+ "relationType": "verifies"
1252
+ },
1253
+ {
1254
+ "id": "sc-special--verifies--req-special",
1255
+ "sourceId": "sc-special",
1256
+ "targetId": "req-special",
1257
+ "relationType": "verifies"
1258
+ },
1259
+ {
1260
+ "id": "sc-dpia--verifies--req-dpia",
1261
+ "sourceId": "sc-dpia",
1262
+ "targetId": "req-dpia",
1263
+ "relationType": "verifies"
1264
+ },
1265
+ {
1266
+ "id": "sc-purpose--verifies--req-purpose",
1267
+ "sourceId": "sc-purpose",
1268
+ "targetId": "req-purpose",
1269
+ "relationType": "verifies"
1270
+ },
1271
+ {
1272
+ "id": "sc-consent--verifies--req-consent",
1273
+ "sourceId": "sc-consent",
1274
+ "targetId": "req-consent",
1275
+ "relationType": "verifies"
1276
+ },
1277
+ {
1278
+ "id": "sc-objection--verifies--req-objection",
1279
+ "sourceId": "sc-objection",
1280
+ "targetId": "req-objection",
1281
+ "relationType": "verifies"
1282
+ },
1283
+ {
1284
+ "id": "sc-none--verifies--req-none",
1285
+ "sourceId": "sc-none",
1286
+ "targetId": "req-none",
1287
+ "relationType": "verifies"
1288
+ },
1289
+ {
1290
+ "id": "ff-retention--implements--adr-delete",
1291
+ "sourceId": "ff-retention",
1292
+ "targetId": "adr-delete",
1293
+ "relationType": "implements"
1294
+ },
1295
+ {
1296
+ "id": "ff-retention--implements--adr-anonymise",
1297
+ "sourceId": "ff-retention",
1298
+ "targetId": "adr-anonymise",
1299
+ "relationType": "implements"
1300
+ },
1301
+ {
1302
+ "id": "ff-retention--implements--adr-crypto",
1303
+ "sourceId": "ff-retention",
1304
+ "targetId": "adr-crypto",
1305
+ "relationType": "implements"
1306
+ },
1307
+ {
1308
+ "id": "ff-record--implements--adr-delete",
1309
+ "sourceId": "ff-record",
1310
+ "targetId": "adr-delete",
1311
+ "relationType": "implements"
1312
+ },
1313
+ {
1314
+ "id": "ff-record--implements--adr-anonymise",
1315
+ "sourceId": "ff-record",
1316
+ "targetId": "adr-anonymise",
1317
+ "relationType": "implements"
1318
+ },
1319
+ {
1320
+ "id": "ff-record--implements--adr-crypto",
1321
+ "sourceId": "ff-record",
1322
+ "targetId": "adr-crypto",
1323
+ "relationType": "implements"
1324
+ },
1325
+ {
1326
+ "id": "ff-pii-scan--implements--adr-delete",
1327
+ "sourceId": "ff-pii-scan",
1328
+ "targetId": "adr-delete",
1329
+ "relationType": "implements"
1330
+ },
1331
+ {
1332
+ "id": "ff-pii-scan--implements--adr-anonymise",
1333
+ "sourceId": "ff-pii-scan",
1334
+ "targetId": "adr-anonymise",
1335
+ "relationType": "implements"
1336
+ },
1337
+ {
1338
+ "id": "ff-pii-scan--implements--adr-crypto",
1339
+ "sourceId": "ff-pii-scan",
1340
+ "targetId": "adr-crypto",
1341
+ "relationType": "implements"
1342
+ },
1343
+ {
1344
+ "id": "ff-pii-scan--implements--adr-no-personal",
1345
+ "sourceId": "ff-pii-scan",
1346
+ "targetId": "adr-no-personal",
1347
+ "relationType": "implements"
1348
+ },
1349
+ {
1350
+ "id": "ff-erasure--implements--adr-delete",
1351
+ "sourceId": "ff-erasure",
1352
+ "targetId": "adr-delete",
1353
+ "relationType": "implements"
1354
+ },
1355
+ {
1356
+ "id": "ff-erasure--implements--adr-anonymise",
1357
+ "sourceId": "ff-erasure",
1358
+ "targetId": "adr-anonymise",
1359
+ "relationType": "implements"
1360
+ },
1361
+ {
1362
+ "id": "ff-k-anonymity--implements--adr-anonymise",
1363
+ "sourceId": "ff-k-anonymity",
1364
+ "targetId": "adr-anonymise",
1365
+ "relationType": "implements"
1366
+ },
1367
+ {
1368
+ "id": "ff-shred--implements--adr-crypto",
1369
+ "sourceId": "ff-shred",
1370
+ "targetId": "adr-crypto",
1371
+ "relationType": "implements"
1372
+ },
1373
+ {
1374
+ "id": "ff-region--implements--adr-delete",
1375
+ "sourceId": "ff-region",
1376
+ "targetId": "adr-delete",
1377
+ "relationType": "implements"
1378
+ },
1379
+ {
1380
+ "id": "ff-region--implements--adr-anonymise",
1381
+ "sourceId": "ff-region",
1382
+ "targetId": "adr-anonymise",
1383
+ "relationType": "implements"
1384
+ },
1385
+ {
1386
+ "id": "ff-region--implements--adr-crypto",
1387
+ "sourceId": "ff-region",
1388
+ "targetId": "adr-crypto",
1389
+ "relationType": "implements"
1390
+ },
1391
+ {
1392
+ "id": "ff-adequacy--implements--adr-delete",
1393
+ "sourceId": "ff-adequacy",
1394
+ "targetId": "adr-delete",
1395
+ "relationType": "implements"
1396
+ },
1397
+ {
1398
+ "id": "ff-adequacy--implements--adr-anonymise",
1399
+ "sourceId": "ff-adequacy",
1400
+ "targetId": "adr-anonymise",
1401
+ "relationType": "implements"
1402
+ },
1403
+ {
1404
+ "id": "ff-adequacy--implements--adr-crypto",
1405
+ "sourceId": "ff-adequacy",
1406
+ "targetId": "adr-crypto",
1407
+ "relationType": "implements"
1408
+ },
1409
+ {
1410
+ "id": "ff-scc--implements--adr-delete",
1411
+ "sourceId": "ff-scc",
1412
+ "targetId": "adr-delete",
1413
+ "relationType": "implements"
1414
+ },
1415
+ {
1416
+ "id": "ff-scc--implements--adr-anonymise",
1417
+ "sourceId": "ff-scc",
1418
+ "targetId": "adr-anonymise",
1419
+ "relationType": "implements"
1420
+ },
1421
+ {
1422
+ "id": "ff-scc--implements--adr-crypto",
1423
+ "sourceId": "ff-scc",
1424
+ "targetId": "adr-crypto",
1425
+ "relationType": "implements"
1426
+ },
1427
+ {
1428
+ "id": "ff-special--implements--adr-special",
1429
+ "sourceId": "ff-special",
1430
+ "targetId": "adr-special",
1431
+ "relationType": "implements"
1432
+ }
1433
+ ]
1434
+ }