@radicaltools/cli 0.3.0 → 0.3.1
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.
- package/README.md +121 -16
- package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
- package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
- package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
- package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
- package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
- package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
- package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
- package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
- package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
- package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
- package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
- package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
- package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
- package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
- package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
- package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
- package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
- package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
- package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
- package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
- package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
- package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
- package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
- package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
- package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
- package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
- package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
- package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
- package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
- package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
- package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
- package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
- package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
- package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
- package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
- package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
- package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
- package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
- package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
- package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
- package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
- package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
- package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
- package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
- package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
- package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
- package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
- package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
- package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
- package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
- package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
- package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
- package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
- package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
- package/dist/index.js +3680 -2074
- package/package.json +1 -1
|
@@ -0,0 +1,1399 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hub": {
|
|
3
|
+
"id": "concern-retention",
|
|
4
|
+
"category": "concern",
|
|
5
|
+
"name": "Retention and deletion",
|
|
6
|
+
"description": "How long each kind of business record is kept and on what legal basis, how a legal hold stops its deletion, what happens when a person asks to erase a record the law still requires, and how records go when their period ends.",
|
|
7
|
+
"tags": [
|
|
8
|
+
"compliance",
|
|
9
|
+
"retention",
|
|
10
|
+
"records-management",
|
|
11
|
+
"legal-hold",
|
|
12
|
+
"deletion",
|
|
13
|
+
"gdpr"
|
|
14
|
+
],
|
|
15
|
+
"requiredMetamodel": "c4-ddd-governance-builtin",
|
|
16
|
+
"concern": {
|
|
17
|
+
"id": "retention",
|
|
18
|
+
"trigger": "LIST NODES WHERE type = \"database\" AND external != true",
|
|
19
|
+
"why": "these stores keep business records, so how long each kind is kept, what stops its deletion and how it goes at the end has to be decided.",
|
|
20
|
+
"group": "compliance"
|
|
21
|
+
},
|
|
22
|
+
"sources": [
|
|
23
|
+
{
|
|
24
|
+
"title": "Regulation (EU) 2016/679 (GDPR), Articles 4(5), 5, 17(3) and 18, and Recital 26 (text quoted at gdpr-info.eu)",
|
|
25
|
+
"url": "https://eur-lex.europa.eu/eli/reg/2016/679/oj"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"title": "German Federal Data Protection Act (BDSG), Section 35: restriction in place of erasure (official English translation)",
|
|
29
|
+
"url": "https://www.gesetze-im-internet.de/englisch_bdsg/englisch_bdsg.html"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"title": "ISO 15489-1:2016, Records management: Concepts and principles",
|
|
33
|
+
"url": "https://www.iso.org/standard/62542.html"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"title": "NIST SP 800-88 Rev. 2, Guidelines for Media Sanitization (cryptographic erase)",
|
|
37
|
+
"url": "https://csrc.nist.gov/pubs/sp/800/88/r2/final"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"title": "Amazon S3 User Guide: Expiring objects (S3 Lifecycle)",
|
|
41
|
+
"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-expire-general-considerations.html"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"title": "Amazon S3 User Guide: Locking objects with Object Lock (legal holds)",
|
|
45
|
+
"url": "https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"title": "AWS KMS API Reference: ScheduleKeyDeletion",
|
|
49
|
+
"url": "https://docs.aws.amazon.com/kms/latest/APIReference/API_ScheduleKeyDeletion.html"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"title": "pg_partman documentation: retention in part_config",
|
|
53
|
+
"url": "https://github.com/pgpartman/pg_partman/blob/development/doc/pg_partman.md"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"title": "Microsoft Purview Records Management",
|
|
57
|
+
"url": "https://learn.microsoft.com/en-us/purview/records-management"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"title": "Microsoft Graph v1.0: retentionLabel resource type",
|
|
61
|
+
"url": "https://learn.microsoft.com/en-us/graph/api/resources/security-retentionlabel?view=graph-rest-1.0"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "OpenText Information Archive",
|
|
65
|
+
"url": "https://www.opentext.com/products/infoarchive"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"templateParams": [
|
|
69
|
+
{
|
|
70
|
+
"key": "SCHEDULE",
|
|
71
|
+
"title": "Schedule",
|
|
72
|
+
"label": "Where does the retention schedule live?",
|
|
73
|
+
"hint": "The schedule says, for each kind of record, where it is kept, on what legal basis, for how long and from which event the period counts. Where it lives decides who changes it, how the deletion reads it and what an auditor is shown (ISO 15489-1: records controls and disposition).",
|
|
74
|
+
"defaultValue": "file",
|
|
75
|
+
"options": [
|
|
76
|
+
{
|
|
77
|
+
"value": "file",
|
|
78
|
+
"label": "a schedule file in the repository",
|
|
79
|
+
"description": "retention/schedule.json holds one row per table: record category, legal basis, period, the event it counts from, owner and date of the last legal review; a daily deletion job reads it, and changes go through a pull request the records owner approves. Pick it when the system owns its records and the organisation runs no records-management tool; most product teams can run it."
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"value": "tool",
|
|
83
|
+
"label": "a records-management tool",
|
|
84
|
+
"description": "The categories, periods and triggers live in the organisation's records-management tool, such as Microsoft Purview Records Management (retention labels in a file plan) or OpenText Information Archive; the repository maps each table to a category and a daily deletion job applies its period. Pick it when the organisation already runs such a tool and a records manager owns the schedule for all its systems."
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"value": "store",
|
|
88
|
+
"label": "each store's own lifecycle configuration",
|
|
89
|
+
"description": "No schedule outside the stores: each period is set where the data lives, as pg_partman retention on time-partitioned tables, S3 lifecycle rules, DynamoDB or MongoDB TTL. Pick it only when every kind of record is kept a fixed time from a date it carries, sits in tables or buckets of its own, and a hold may cover a whole table or a single object."
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"key": "DELETE",
|
|
95
|
+
"title": "Disposal",
|
|
96
|
+
"label": "How do records go when their period ends?",
|
|
97
|
+
"hint": "A delete in the primary store does not reach backups, archives or event streams that cannot be edited; this decides what is left in them and for how long. Only with a schedule file or a records-management tool: with each store's own lifecycle configuration, the store deletes. Erasing a person's data on request is decided in the Personal data pack.",
|
|
98
|
+
"defaultValue": "hard",
|
|
99
|
+
"options": [
|
|
100
|
+
{
|
|
101
|
+
"value": "hard",
|
|
102
|
+
"label": "deletion by a scheduled job",
|
|
103
|
+
"description": "A daily job deletes the expired rows in batches, with their dependent rows, search entries and cached copies; backups age out as the Backup and recovery pack keeps them. Pick it by default, when backups are kept for weeks rather than years."
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"value": "crypto",
|
|
107
|
+
"label": "crypto-shredding of a key per record group",
|
|
108
|
+
"description": "Each record group (one category and fiscal year) is encrypted under a key of its own; at the end of the period the job deletes the rows and destroys the key, which makes every copy unreadable, backups and archives included. Pick it when copies are kept for years or cannot be edited (locked backups, event logs, archives) and you run a key management service."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"value": "aggregate",
|
|
112
|
+
"label": "anonymised totals, then deletion",
|
|
113
|
+
"description": "Before the rows are deleted, the job rolls them up into totals per month and category with no identifier and no group of fewer than 5 records. Pick it when finance or analytics need the history (revenue per month, volumes) after the records themselves must go."
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"key": "HOLD",
|
|
119
|
+
"title": "Legal hold",
|
|
120
|
+
"label": "Can disposal be stopped for a lawsuit, an investigation or an audit?",
|
|
121
|
+
"hint": "When a dispute or an investigation is expected, the records that may matter have to be preserved, even past their period; a deletion that does not know about it destroys evidence. With each store's own lifecycle configuration, a hold covers a single object version (S3 Object Lock) or a whole table, never one row.",
|
|
122
|
+
"defaultValue": "flag",
|
|
123
|
+
"options": [
|
|
124
|
+
{
|
|
125
|
+
"value": "flag",
|
|
126
|
+
"label": "a legal hold set by named roles",
|
|
127
|
+
"description": "A hold names a matter and covers records, a record group or a category; disposal skips everything it covers until it is lifted, and only named roles may set or lift one. Pick it for any system whose records could matter in a dispute or an audit, which is most that keep invoices or contracts."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"value": "none",
|
|
131
|
+
"label": "no legal hold",
|
|
132
|
+
"description": "Disposal is never suspended for a single matter; a preservation request stops disposal of whole categories by a reviewed change. Pick it only when the records have no evidential value, or the organisation preserves evidence elsewhere (an eDiscovery export) and accepts that risk; the decision records it."
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"key": "CONFLICT",
|
|
138
|
+
"title": "Erasure vs. keeping",
|
|
139
|
+
"label": "What happens when a person asks to be erased but the law still requires their records?",
|
|
140
|
+
"hint": "Erasure does not apply to what a legal obligation requires keeping (GDPR Art. 17(3)(b)), but what is kept may then serve that obligation only (Art. 5(1)(b)). Erasing everything else is the Personal data pack's; this decides what the kept records look like until their period ends.",
|
|
141
|
+
"defaultValue": "restrict",
|
|
142
|
+
"options": [
|
|
143
|
+
{
|
|
144
|
+
"value": "restrict",
|
|
145
|
+
"label": "restriction until the period ends",
|
|
146
|
+
"description": "The kept records stay as they are, marked restricted: only the compliance role can read them, and only to meet the obligation (a tax audit, a court order); at the end of the period they go with the rest. Pick it by default, and whenever the law requires the record kept as issued, as tax rules usually do for an invoice."
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"value": "pseudonymise",
|
|
150
|
+
"label": "pseudonymisation of the kept records",
|
|
151
|
+
"description": "The person's name, address and contact details in the kept records are replaced with a pseudonym now; the link back is kept apart, readable only by the compliance role, and destroyed with the records. Pick it when the kept facts (amounts, dates) are still used in daily work such as reporting, and the compliance officer confirms that the law does not require the record kept as issued."
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"key": "DISPOSE_DAYS",
|
|
157
|
+
"label": "Within how many days after its period ends is a record disposed of?",
|
|
158
|
+
"defaultValue": "30",
|
|
159
|
+
"type": "number"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"key": "REVIEW_MONTHS",
|
|
163
|
+
"label": "How often does the compliance officer review the periods (months)? (schedule file or records-management tool only)",
|
|
164
|
+
"defaultValue": "12",
|
|
165
|
+
"type": "number"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"key": "HOLD_ROLES",
|
|
169
|
+
"label": "Who may set and lift a legal hold? (a legal hold set by named roles only)",
|
|
170
|
+
"defaultValue": "legal counsel, compliance officer"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"key": "ACCOUNTING_YEARS",
|
|
174
|
+
"label": "Invoices and accounting records: kept how many years after the end of the fiscal year they belong to? (an example; set it from your legal reading)",
|
|
175
|
+
"defaultValue": "10",
|
|
176
|
+
"type": "number"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"key": "CONTRACT_YEARS",
|
|
180
|
+
"label": "Contracts: kept how many years after the contract ends? (an example; set it from your legal reading)",
|
|
181
|
+
"defaultValue": "6",
|
|
182
|
+
"type": "number"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"key": "TRANSACTION_YEARS",
|
|
186
|
+
"label": "Payment transactions: kept how many years after the transaction date? (an example; set it from your legal reading)",
|
|
187
|
+
"defaultValue": "5",
|
|
188
|
+
"type": "number"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
"nodes": [
|
|
193
|
+
{
|
|
194
|
+
"id": "need",
|
|
195
|
+
"type": "need",
|
|
196
|
+
"label": "Records kept as long as required, and no longer",
|
|
197
|
+
"x": 0,
|
|
198
|
+
"y": 0,
|
|
199
|
+
"kind": "brief",
|
|
200
|
+
"source": "Hub concern pack: Retention and deletion",
|
|
201
|
+
"description": "The system keeps business records that law or contract requires for a set period, and must keep each one exactly that long: not deleted before its period ends or while a legal hold covers it, and disposed of in every copy once the period is over, including when the person it concerns asked to be erased in the meantime. Which law applies and which period follows from it is the organisation's legal reading, made by its compliance officer or data protection officer; the periods in this pack are examples to set, and nothing in it is legal advice. The snippets assume PostgreSQL with the schema owned by the migrator role and disposal run as the retention_job role, the deletion job in src/retention (job.ts exports runDisposal, holds.ts the legal holds) with its tests under tests/retention, the schedule and its companions under retention/ (schedule.json, labels.json, holds.json, transient-tables.txt listing the tables that hold no records), and the buckets that hold records named in RECORD_BUCKETS by the infrastructure code."
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "req-schedule",
|
|
205
|
+
"type": "requirement",
|
|
206
|
+
"label": "Every table has a schedule row",
|
|
207
|
+
"x": 260,
|
|
208
|
+
"y": 0,
|
|
209
|
+
"ears_type": "ubiquitous",
|
|
210
|
+
"action": "keep one row in retention/schedule.json for every table, naming its record category, legal basis, period in years, the event the period counts from, its owner and the date of its last legal review, no older than {{REVIEW_MONTHS}} months, or category \"none\" with the reason it holds no records; and change the file only through a pull request the records owner approves",
|
|
211
|
+
"rationale": "A record without a written period is kept forever or deleted by guesswork; storage limitation (GDPR Art. 5(1)(e)) and disposition by an authorised rule (ISO 15489-1) both need the period where the deletion job reads it, and accountability (Art. 5(2)) needs to show who set it and when.",
|
|
212
|
+
"hubWhen": {
|
|
213
|
+
"SCHEDULE": [
|
|
214
|
+
"file"
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"id": "req-tool-mapping",
|
|
220
|
+
"type": "requirement",
|
|
221
|
+
"label": "Every table maps to a label",
|
|
222
|
+
"x": 260,
|
|
223
|
+
"y": 130,
|
|
224
|
+
"ears_type": "ubiquitous",
|
|
225
|
+
"action": "map every table in retention/schedule.json to a retention label of the records-management tool and to the date column its period counts from, or to category \"none\" with the reason it holds no records, and keep the tool's labels exported to retention/labels.json no more than {{REVIEW_MONTHS}} months ago",
|
|
226
|
+
"rationale": "The tool owns the periods but not the tables; a table that maps to no label, or to one the tool no longer has, is kept forever or disposed of by guesswork (ISO 15489-1; GDPR Art. 5(1)(e)).",
|
|
227
|
+
"hubWhen": {
|
|
228
|
+
"SCHEDULE": [
|
|
229
|
+
"tool"
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"id": "req-store-config",
|
|
235
|
+
"type": "requirement",
|
|
236
|
+
"label": "Every table and bucket has its period",
|
|
237
|
+
"x": 260,
|
|
238
|
+
"y": 260,
|
|
239
|
+
"ears_type": "ubiquitous",
|
|
240
|
+
"action": "set the period of every table and bucket that holds records in the store's own configuration (pg_partman retention with expired partitions dropped, an S3 lifecycle expiration rule), and hold no row longer than its period plus one partition interval and {{DISPOSE_DAYS}} days",
|
|
241
|
+
"rationale": "With no schedule outside the stores, the configuration is the schedule: a table without it keeps everything forever (GDPR Art. 5(1)(e)). pg_partman keeps every partition while retention is NULL and by default only detaches expired ones (pg_partman documentation).",
|
|
242
|
+
"hubWhen": {
|
|
243
|
+
"SCHEDULE": [
|
|
244
|
+
"store"
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"id": "req-dispose",
|
|
250
|
+
"type": "requirement",
|
|
251
|
+
"label": "Expired records disposed of",
|
|
252
|
+
"x": 260,
|
|
253
|
+
"y": 390,
|
|
254
|
+
"ears_type": "event-driven",
|
|
255
|
+
"trigger": "the retention period of a record ends, counted from the event its schedule names (the end of the fiscal year it belongs to, the end of a contract, the date of a transaction)",
|
|
256
|
+
"action": "dispose of it within {{DISPOSE_DAYS}} days in the primary store, its replicas, caches and search indexes, and in the exports the system keeps, unless a legal hold covers it",
|
|
257
|
+
"rationale": "Storage limitation (GDPR Art. 5(1)(e)) for records about people, and disposition as a records process of its own (ISO 15489-1). Backups are not edited: they age out as the Backup and recovery pack keeps them."
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"id": "req-not-early",
|
|
261
|
+
"type": "requirement",
|
|
262
|
+
"label": "Nothing deleted early",
|
|
263
|
+
"x": 260,
|
|
264
|
+
"y": 520,
|
|
265
|
+
"ears_type": "unwanted-behaviour",
|
|
266
|
+
"unwanted_condition": "an application, script or person other than disposal tries to delete or truncate records before their period ends",
|
|
267
|
+
"action": "refuse it, because no login role but the one that runs disposal and the one that owns the schema may delete from or truncate a table that holds records",
|
|
268
|
+
"rationale": "A record deleted early cannot be produced when the obligation that required it is invoked; a missing privilege stops what a code review misses."
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
"id": "req-fail-closed",
|
|
272
|
+
"type": "requirement",
|
|
273
|
+
"label": "Unknown means keep",
|
|
274
|
+
"x": 260,
|
|
275
|
+
"y": 650,
|
|
276
|
+
"ears_type": "unwanted-behaviour",
|
|
277
|
+
"unwanted_condition": "the schedule cannot be read, or a table that holds rows has no row in it",
|
|
278
|
+
"action": "dispose of nothing from that table, or from any table when the schedule cannot be read, and alert the records owner the same day",
|
|
279
|
+
"rationale": "A deletion job that guesses a default period destroys records that may still be required; doing nothing and saying so costs only a few days of storage.",
|
|
280
|
+
"hubWhen": {
|
|
281
|
+
"SCHEDULE": [
|
|
282
|
+
"file",
|
|
283
|
+
"tool"
|
|
284
|
+
]
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"id": "req-overdue",
|
|
289
|
+
"type": "requirement",
|
|
290
|
+
"label": "Overdue records reported",
|
|
291
|
+
"x": 260,
|
|
292
|
+
"y": 780,
|
|
293
|
+
"ears_type": "ubiquitous",
|
|
294
|
+
"action": "report every week, per table, the records whose period ended more than {{DISPOSE_DAYS}} days ago and that no legal hold covers, and open a ticket for the records owner when any table has one",
|
|
295
|
+
"rationale": "A deletion job that silently stopped looks like one that works; the report is the evidence that disposal happens, which accountability asks for (GDPR Art. 5(2)).",
|
|
296
|
+
"hubWhen": {
|
|
297
|
+
"SCHEDULE": [
|
|
298
|
+
"file",
|
|
299
|
+
"tool"
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"id": "req-hold",
|
|
305
|
+
"type": "requirement",
|
|
306
|
+
"label": "Held records kept",
|
|
307
|
+
"x": 260,
|
|
308
|
+
"y": 910,
|
|
309
|
+
"ears_type": "state-driven",
|
|
310
|
+
"precondition": "a legal hold covers a record, its record group or its category",
|
|
311
|
+
"action": "keep the record unchanged past the end of its period, skip it in every disposal run, and dispose of it in the first run after the last hold on it is lifted if its period has ended",
|
|
312
|
+
"rationale": "Records that may matter in an expected dispute or investigation must not be destroyed while it lasts; as with an S3 Object Lock legal hold, the hold is independent of the retention period and has no end date until it is lifted (Amazon S3 Object Lock).",
|
|
313
|
+
"hubWhen": {
|
|
314
|
+
"HOLD": [
|
|
315
|
+
"flag"
|
|
316
|
+
],
|
|
317
|
+
"SCHEDULE": [
|
|
318
|
+
"file",
|
|
319
|
+
"tool"
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"id": "req-hold-roles",
|
|
325
|
+
"type": "requirement",
|
|
326
|
+
"label": "Holds only by named roles",
|
|
327
|
+
"x": 260,
|
|
328
|
+
"y": 1040,
|
|
329
|
+
"ears_type": "event-driven",
|
|
330
|
+
"trigger": "someone sets or lifts a legal hold",
|
|
331
|
+
"action": "accept it only from {{HOLD_ROLES}}, with a matter reference and the records, groups, categories, tables or objects it covers, and record who did it and when in the audit trail",
|
|
332
|
+
"rationale": "A hold anyone can lift is not a hold, and one anyone can set stops disposal without a reason; S3 likewise lets only principals with s3:PutObjectLegalHold place or remove one (Amazon S3 Object Lock).",
|
|
333
|
+
"hubWhen": {
|
|
334
|
+
"HOLD": [
|
|
335
|
+
"flag"
|
|
336
|
+
]
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
"id": "req-hold-store",
|
|
341
|
+
"type": "requirement",
|
|
342
|
+
"label": "Stores stop for a hold",
|
|
343
|
+
"x": 260,
|
|
344
|
+
"y": 1170,
|
|
345
|
+
"ears_type": "ubiquitous",
|
|
346
|
+
"action": "hold an object by an S3 Object Lock legal hold on its version, and a table by setting its pg_partman retention to none and listing it with its matter in retention/holds.json",
|
|
347
|
+
"rationale": "With the periods in the stores, the stores themselves have to stop: S3 Lifecycle takes no action on noncurrent versions under Object Lock and refuses a permanent delete of a held version (Amazon S3 documentation); pg_partman drops nothing while retention is NULL (pg_partman documentation).",
|
|
348
|
+
"hubWhen": {
|
|
349
|
+
"HOLD": [
|
|
350
|
+
"flag"
|
|
351
|
+
],
|
|
352
|
+
"SCHEDULE": [
|
|
353
|
+
"store"
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"id": "req-conflict-restrict",
|
|
359
|
+
"type": "requirement",
|
|
360
|
+
"label": "Kept records restricted",
|
|
361
|
+
"x": 260,
|
|
362
|
+
"y": 1300,
|
|
363
|
+
"ears_type": "event-driven",
|
|
364
|
+
"trigger": "a person's erasure request is accepted and covers records the schedule still requires",
|
|
365
|
+
"action": "keep those records unchanged but restricted, readable only by the compliance role and only to meet the obligation, tell the person which categories are kept, on what legal basis and until when, and dispose of them with the rest when their period ends",
|
|
366
|
+
"rationale": "The right to erasure does not apply to what a legal obligation requires (GDPR Art. 17(3)(b)), and what is kept may not be used for other purposes (Art. 5(1)(b)). Some national laws put restriction of processing (Art. 18) in place of erasure here: Germany's BDSG Section 35(3) does so where erasure would conflict with retention periods set by statute or contract.",
|
|
367
|
+
"hubWhen": {
|
|
368
|
+
"CONFLICT": [
|
|
369
|
+
"restrict"
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"id": "req-conflict-pseudo",
|
|
375
|
+
"type": "requirement",
|
|
376
|
+
"label": "Kept records pseudonymised",
|
|
377
|
+
"x": 260,
|
|
378
|
+
"y": 1430,
|
|
379
|
+
"ears_type": "event-driven",
|
|
380
|
+
"trigger": "a person's erasure request is accepted and covers records the schedule still requires",
|
|
381
|
+
"action": "replace the person's name, address and contact details in those records with a pseudonym when the rest of their data is erased, keep the link from pseudonym to person in a separate table only the compliance role can read, tell the person which categories are kept, on what legal basis and until when, and destroy the link and the records together when the period ends",
|
|
382
|
+
"rationale": "The right to erasure does not apply to what a legal obligation requires (GDPR Art. 17(3)(b)); pseudonymised data stays personal data while the additional information exists (Art. 4(5), Recital 26), so the link is kept apart, guarded and destroyed with the records.",
|
|
383
|
+
"hubWhen": {
|
|
384
|
+
"CONFLICT": [
|
|
385
|
+
"pseudonymise"
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"id": "req-shred",
|
|
391
|
+
"type": "requirement",
|
|
392
|
+
"label": "Group key destroyed",
|
|
393
|
+
"x": 260,
|
|
394
|
+
"y": 1560,
|
|
395
|
+
"ears_type": "event-driven",
|
|
396
|
+
"trigger": "the period of a record group (one category and fiscal year) ends and no legal hold covers any record of it",
|
|
397
|
+
"action": "delete the group's rows and schedule its key for deletion within {{DISPOSE_DAYS}} days, with the shortest waiting period the key service allows, so that no copy of the group in a backup, archive or event stream can be decrypted after it",
|
|
398
|
+
"rationale": "Data whose key is destroyed cannot be read by anyone, and the method reaches copies the job cannot edit; NIST SP 800-88 Rev. 2 treats cryptographic erase as a sanitisation method. AWS KMS keeps a key 7 to 30 days after its deletion is scheduled (AWS KMS ScheduleKeyDeletion).",
|
|
399
|
+
"hubWhen": {
|
|
400
|
+
"SCHEDULE": [
|
|
401
|
+
"file",
|
|
402
|
+
"tool"
|
|
403
|
+
],
|
|
404
|
+
"DELETE": [
|
|
405
|
+
"crypto"
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"id": "req-aggregate",
|
|
411
|
+
"type": "requirement",
|
|
412
|
+
"label": "History kept as safe totals",
|
|
413
|
+
"x": 260,
|
|
414
|
+
"y": 1690,
|
|
415
|
+
"ears_type": "event-driven",
|
|
416
|
+
"trigger": "records reach the end of their period",
|
|
417
|
+
"action": "roll them up into totals per month and category that carry no identifier of a person, customer or record, merge groups of fewer than 5 records into the month's \"other\" row and leave out an \"other\" row still below 5, then delete the records",
|
|
418
|
+
"rationale": "Totals that cannot be linked to a person are anonymous and outside data protection law (GDPR Recital 26), and keep the history finance needs; a group of a handful of records can single out one customer.",
|
|
419
|
+
"hubWhen": {
|
|
420
|
+
"SCHEDULE": [
|
|
421
|
+
"file",
|
|
422
|
+
"tool"
|
|
423
|
+
],
|
|
424
|
+
"DELETE": [
|
|
425
|
+
"aggregate"
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"id": "sc-schedule",
|
|
431
|
+
"type": "scenario",
|
|
432
|
+
"label": "New table needs a row",
|
|
433
|
+
"x": 520,
|
|
434
|
+
"y": 0,
|
|
435
|
+
"given": "a migration that adds a table",
|
|
436
|
+
"when": "the change is built",
|
|
437
|
+
"then": "the build fails until retention/schedule.json has a complete row for the table, reviewed within {{REVIEW_MONTHS}} months",
|
|
438
|
+
"hubWhen": {
|
|
439
|
+
"SCHEDULE": [
|
|
440
|
+
"file"
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"id": "sc-tool-mapping",
|
|
446
|
+
"type": "scenario",
|
|
447
|
+
"label": "Unmapped table refused",
|
|
448
|
+
"x": 520,
|
|
449
|
+
"y": 130,
|
|
450
|
+
"given": "a migration that adds a table, and a row whose label is no longer in the export",
|
|
451
|
+
"when": "the change is built",
|
|
452
|
+
"then": "the build fails naming both tables",
|
|
453
|
+
"hubWhen": {
|
|
454
|
+
"SCHEDULE": [
|
|
455
|
+
"tool"
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"id": "sc-store-config",
|
|
461
|
+
"type": "scenario",
|
|
462
|
+
"label": "Table without a period refused",
|
|
463
|
+
"x": 520,
|
|
464
|
+
"y": 260,
|
|
465
|
+
"given": "a migration that adds a records table without pg_partman retention",
|
|
466
|
+
"when": "the configuration check runs",
|
|
467
|
+
"then": "it fails until the table has a retention, drops expired partitions and holds no row past its period plus one partition and {{DISPOSE_DAYS}} days",
|
|
468
|
+
"hubWhen": {
|
|
469
|
+
"SCHEDULE": [
|
|
470
|
+
"store"
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"id": "sc-dispose",
|
|
476
|
+
"type": "scenario",
|
|
477
|
+
"label": "Expired invoice disposed of",
|
|
478
|
+
"x": 520,
|
|
479
|
+
"y": 390,
|
|
480
|
+
"given": "an invoice whose period ended and one whose period has not",
|
|
481
|
+
"when": "disposal runs",
|
|
482
|
+
"then": "within {{DISPOSE_DAYS}} days the first is gone from the store, its replicas, caches and search index, and the second is untouched"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"id": "sc-not-early",
|
|
486
|
+
"type": "scenario",
|
|
487
|
+
"label": "Early delete refused",
|
|
488
|
+
"x": 520,
|
|
489
|
+
"y": 520,
|
|
490
|
+
"given": "the application's database role",
|
|
491
|
+
"when": "it deletes a row from the invoices table",
|
|
492
|
+
"then": "the database refuses it with a permission error"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"id": "sc-fail-closed",
|
|
496
|
+
"type": "scenario",
|
|
497
|
+
"label": "Unknown table left alone",
|
|
498
|
+
"x": 520,
|
|
499
|
+
"y": 650,
|
|
500
|
+
"given": "a table without a schedule row holding 50-year-old rows, and an expired invoice",
|
|
501
|
+
"when": "disposal runs, and runs again with the schedule missing",
|
|
502
|
+
"then": "no row of the unknown table is deleted, the second run deletes nothing at all, and the records owner is alerted",
|
|
503
|
+
"hubWhen": {
|
|
504
|
+
"SCHEDULE": [
|
|
505
|
+
"file",
|
|
506
|
+
"tool"
|
|
507
|
+
]
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"id": "sc-overdue",
|
|
512
|
+
"type": "scenario",
|
|
513
|
+
"label": "Stalled disposal noticed",
|
|
514
|
+
"x": 520,
|
|
515
|
+
"y": 780,
|
|
516
|
+
"given": "a deletion job that has failed for two weeks",
|
|
517
|
+
"when": "the weekly report runs",
|
|
518
|
+
"then": "it lists the tables with overdue records and opens a ticket for the records owner",
|
|
519
|
+
"hubWhen": {
|
|
520
|
+
"SCHEDULE": [
|
|
521
|
+
"file",
|
|
522
|
+
"tool"
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"id": "sc-hold",
|
|
528
|
+
"type": "scenario",
|
|
529
|
+
"label": "Held invoice survives",
|
|
530
|
+
"x": 520,
|
|
531
|
+
"y": 910,
|
|
532
|
+
"given": "two expired invoices, one under a legal hold",
|
|
533
|
+
"when": "disposal runs, the hold is lifted, and disposal runs again",
|
|
534
|
+
"then": "the first run disposes only of the invoice without a hold; the second disposes of the other",
|
|
535
|
+
"hubWhen": {
|
|
536
|
+
"HOLD": [
|
|
537
|
+
"flag"
|
|
538
|
+
],
|
|
539
|
+
"SCHEDULE": [
|
|
540
|
+
"file",
|
|
541
|
+
"tool"
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"id": "sc-hold-roles",
|
|
547
|
+
"type": "scenario",
|
|
548
|
+
"label": "Hold by the right people",
|
|
549
|
+
"x": 520,
|
|
550
|
+
"y": 1040,
|
|
551
|
+
"given": "a support engineer and someone in one of: {{HOLD_ROLES}}",
|
|
552
|
+
"when": "each tries to set a hold and then to lift it",
|
|
553
|
+
"then": "only the second succeeds, and the audit trail holds the matter, the scope, who and when",
|
|
554
|
+
"hubWhen": {
|
|
555
|
+
"HOLD": [
|
|
556
|
+
"flag"
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"id": "sc-hold-store",
|
|
562
|
+
"type": "scenario",
|
|
563
|
+
"label": "Held object survives",
|
|
564
|
+
"x": 520,
|
|
565
|
+
"y": 1170,
|
|
566
|
+
"given": "an object version under a legal hold in a bucket with an expiration rule",
|
|
567
|
+
"when": "someone deletes that version by its version id",
|
|
568
|
+
"then": "the delete is refused with 403 Access Denied and the version remains",
|
|
569
|
+
"hubWhen": {
|
|
570
|
+
"HOLD": [
|
|
571
|
+
"flag"
|
|
572
|
+
],
|
|
573
|
+
"SCHEDULE": [
|
|
574
|
+
"store"
|
|
575
|
+
]
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
"id": "sc-conflict-restrict",
|
|
580
|
+
"type": "scenario",
|
|
581
|
+
"label": "Invoice kept, but locked away",
|
|
582
|
+
"x": 520,
|
|
583
|
+
"y": 1300,
|
|
584
|
+
"given": "a customer with an invoice still in its period, orders and a support ticket",
|
|
585
|
+
"when": "their erasure request is accepted",
|
|
586
|
+
"then": "support and reporting no longer reach the invoice, the compliance role still can, and the answer to the person names invoices, their legal basis and the date they go",
|
|
587
|
+
"hubWhen": {
|
|
588
|
+
"CONFLICT": [
|
|
589
|
+
"restrict"
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"id": "sc-conflict-pseudo",
|
|
595
|
+
"type": "scenario",
|
|
596
|
+
"label": "Kept invoice names nobody",
|
|
597
|
+
"x": 520,
|
|
598
|
+
"y": 1430,
|
|
599
|
+
"given": "a customer with an invoice still in its period, orders and a support ticket",
|
|
600
|
+
"when": "their erasure request is accepted",
|
|
601
|
+
"then": "the kept invoice rows carry a pseudonym instead of name, address and contact details, only the compliance role can resolve it, and the answer to the person names invoices, their legal basis and the date they go",
|
|
602
|
+
"hubWhen": {
|
|
603
|
+
"CONFLICT": [
|
|
604
|
+
"pseudonymise"
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
"id": "sc-shred",
|
|
610
|
+
"type": "scenario",
|
|
611
|
+
"label": "Group key destroyed",
|
|
612
|
+
"x": 520,
|
|
613
|
+
"y": 1560,
|
|
614
|
+
"given": "the invoices of a fiscal year whose period ended, in the store and in last month's backup",
|
|
615
|
+
"when": "disposal runs",
|
|
616
|
+
"then": "the rows are gone, the group's key is pending deletion, and once it is deleted the backup copy cannot be decrypted",
|
|
617
|
+
"hubWhen": {
|
|
618
|
+
"SCHEDULE": [
|
|
619
|
+
"file",
|
|
620
|
+
"tool"
|
|
621
|
+
],
|
|
622
|
+
"DELETE": [
|
|
623
|
+
"crypto"
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"id": "sc-aggregate",
|
|
629
|
+
"type": "scenario",
|
|
630
|
+
"label": "History kept, records gone",
|
|
631
|
+
"x": 520,
|
|
632
|
+
"y": 1690,
|
|
633
|
+
"given": "a month of expired invoices in which one customer has the only 2 invoices of a category",
|
|
634
|
+
"when": "disposal runs",
|
|
635
|
+
"then": "the month's totals exist with no group below 5, those 2 invoices are counted in \"other\" or left out, and no invoice row of that month remains",
|
|
636
|
+
"hubWhen": {
|
|
637
|
+
"SCHEDULE": [
|
|
638
|
+
"file",
|
|
639
|
+
"tool"
|
|
640
|
+
],
|
|
641
|
+
"DELETE": [
|
|
642
|
+
"aggregate"
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
"id": "adr-file",
|
|
648
|
+
"type": "adr",
|
|
649
|
+
"label": "A retention schedule file in the repository",
|
|
650
|
+
"x": 780,
|
|
651
|
+
"y": 0,
|
|
652
|
+
"concern": "retention",
|
|
653
|
+
"status": "accepted",
|
|
654
|
+
"date": "",
|
|
655
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
656
|
+
"decision": "The retention schedule is a file in the repository, retention/schedule.json: one row per table with the record category, the legal basis, the period in years, the event it counts from (the end of the fiscal year of a date column, or the date itself), the owner and the date of the last legal review; tables that hold no records (sessions, carts, outboxes) have a row with category \"none\" and the reason. The compliance officer reviews every row at least every {{REVIEW_MONTHS}} months, and CODEOWNERS makes the records owner approve every change. The first rows are examples the compliance officer confirms or changes: invoices and accounting records {{ACCOUNTING_YEARS}} years after the end of the fiscal year they belong to, contracts {{CONTRACT_YEARS}} years after the contract ends, payment transactions {{TRANSACTION_YEARS}} years after the transaction date. A daily job in src/retention, running as the retention_job role, the only login role besides the schema owner that may delete from record tables, reads the file, disposes of expired records within {{DISPOSE_DAYS}} days by {{DELETE}}, deletes nothing from a table without a row, and writes the schedule it applied to the retention_schedule table for the weekly report. Buckets that hold records get S3 lifecycle rules derived from the same rows. Legal hold: {{HOLD}}. An erasure request that meets a duty to keep: {{CONFLICT}}.",
|
|
657
|
+
"consequences": "• The schedule is reviewed like code: every change has an author, an approver and a date, which is what an auditor asks for.\n• The periods are the organisation's legal reading written down; when the law changes someone has to change the file, and the review date shows when that last happened.\n• Only this system's records are covered; an organisation with many systems ends up with one schedule per repository unless a records manager consolidates them.\n• Backups hold expired records until they age out as the Backup and recovery pack keeps them, and a restore brings them back until the next run; the restore runbook runs the job before the store serves.\n• S3 lifecycle rules count days from an object's creation, so a period from the end of the fiscal year is either a dated rule per year prefix (invoices/2026/) or the period plus one year.",
|
|
658
|
+
"alternatives": "1. A records-management tool: one schedule for the whole organisation, owned by a records manager, but one more system to keep in step.\n2. Periods only in each store's lifecycle configuration: nothing to run, but no legal basis or trigger beside the period and no per-record holds.\n3. A constant per table in the code: no review trail, and invisible to the compliance officer.",
|
|
659
|
+
"hubWhen": {
|
|
660
|
+
"SCHEDULE": [
|
|
661
|
+
"file"
|
|
662
|
+
]
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
"id": "adr-tool",
|
|
667
|
+
"type": "adr",
|
|
668
|
+
"label": "The retention schedule in a records-management tool",
|
|
669
|
+
"x": 780,
|
|
670
|
+
"y": 130,
|
|
671
|
+
"concern": "retention",
|
|
672
|
+
"status": "accepted",
|
|
673
|
+
"date": "",
|
|
674
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
675
|
+
"decision": "The retention schedule lives in the organisation's records-management tool: Microsoft Purview Records Management, where each category is a retention label in the file plan with its period and its trigger (date created or an event), or OpenText Information Archive where records are archived out of the application. The repository holds only the mapping, retention/schedule.json: one row per table with the tool's label and the date column the period counts from, or category \"none\" with the reason. Purview's Graph API for retention labels (GET /security/labels/retentionLabels) accepts delegated permissions only, so the records manager exports the labels to retention/labels.json after every change and at least every {{REVIEW_MONTHS}} months, in a pull request the build checks against the mapping; the job never calls the tool at run time. The first labels are examples the compliance officer confirms or changes: invoices and accounting records {{ACCOUNTING_YEARS}} years after the end of the fiscal year, contracts {{CONTRACT_YEARS}} years after the contract ends, payment transactions {{TRANSACTION_YEARS}} years after the transaction date. A daily job in src/retention, running as the retention_job role, applies each label's period, disposes of expired records within {{DISPOSE_DAYS}} days by {{DELETE}}, deletes nothing from a table without a label, and writes the schedule it applied to the retention_schedule table for the weekly report. Legal hold: {{HOLD}}. An erasure request that meets a duty to keep: {{CONFLICT}}.",
|
|
676
|
+
"consequences": "• One schedule for the whole organisation, owned by the records manager, with the tool's own review and disposition records.\n• Purview governs documents and mail in Microsoft 365; it does not reach this system's database, so the job still disposes and the tool only supplies the periods.\n• The export is a manual step: a label changed in the tool takes effect here only when the export is committed, and the build fails when it is older than {{REVIEW_MONTHS}} months.\n• Backups hold expired records until they age out as the Backup and recovery pack keeps them; the restore runbook runs the job before the store serves.\n• A licence for the tool and a records manager who owns it.",
|
|
677
|
+
"alternatives": "1. A schedule file in the repository: simple and reviewed like code, but one per system and no records manager in the loop.\n2. Calling the tool from the job at run time: always current, but Purview's label API grants no application permission, and disposal would stop when the tool is down.\n3. Periods only in each store's lifecycle configuration: nothing to integrate, but no basis or trigger recorded.",
|
|
678
|
+
"hubWhen": {
|
|
679
|
+
"SCHEDULE": [
|
|
680
|
+
"tool"
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"id": "adr-store",
|
|
686
|
+
"type": "adr",
|
|
687
|
+
"label": "Periods in each store's lifecycle configuration",
|
|
688
|
+
"x": 780,
|
|
689
|
+
"y": 260,
|
|
690
|
+
"concern": "retention",
|
|
691
|
+
"status": "accepted",
|
|
692
|
+
"date": "",
|
|
693
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
694
|
+
"decision": "Periods are set where the data lives and nowhere else. PostgreSQL tables that hold records are partitioned by the date their period counts from with pg_partman, each with retention set to its period and retention_keep_table false, so that expired partitions are dropped, not detached; pg_partman's maintenance (run_maintenance_proc) runs hourly from its background worker or pg_cron as the schema owner, the only login role that may drop them, and no application role may delete from or truncate a records table. Buckets get S3 lifecycle rules (Expiration, and NoncurrentVersionExpiration where versioning is on); DynamoDB tables a TTL attribute; MongoDB collections a TTL index. The first periods are examples the compliance officer confirms or changes: invoices and accounting records {{ACCOUNTING_YEARS}} years after the end of the fiscal year, contracts {{CONTRACT_YEARS}} years after the contract ends, payment transactions {{TRANSACTION_YEARS}} years after the transaction date; the fiscal-year and contract triggers become a date column holding the end of the fiscal year or of the contract, which the partitions follow. The legal basis of each period is written beside it in the migration and the infrastructure code. Legal hold: {{HOLD}}. An erasure request that meets a duty to keep: {{CONFLICT}}.",
|
|
695
|
+
"consequences": "• Nothing to run and watch besides the stores themselves.\n• Disposal is coarse: a partition goes only when all of its rows have expired, so records stay up to one partition interval past their period, and S3 removes expired objects asynchronously.\n• There is no single place an auditor can read the schedule; the periods are spread over migrations and infrastructure code.\n• A hold covers an object version or a whole table, never one row; a held table keeps every partition.\n• Backups hold expired records until they age out as the Backup and recovery pack keeps them.",
|
|
696
|
+
"alternatives": "1. A schedule file read by a deletion job: per-record holds, basis and trigger recorded, at the cost of a job to run and watch.\n2. A records-management tool: one schedule for the organisation, owned by a records manager.\n3. Deleting by hand once a year: forgotten in the first busy year.",
|
|
697
|
+
"hubWhen": {
|
|
698
|
+
"SCHEDULE": [
|
|
699
|
+
"store"
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
"id": "adr-hard",
|
|
705
|
+
"type": "adr",
|
|
706
|
+
"label": "Expired records deleted by a scheduled job",
|
|
707
|
+
"x": 780,
|
|
708
|
+
"y": 390,
|
|
709
|
+
"concern": "retention",
|
|
710
|
+
"status": "accepted",
|
|
711
|
+
"date": "",
|
|
712
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
713
|
+
"decision": "Expired records are deleted by the daily job in batches of at most 10,000 rows per transaction, children before parents (ON DELETE CASCADE where the schema allows), with their search-index entries and cache keys removed in the same run; the job logs the count per table and category, never the content. Exports the system keeps (reports, files for partners) follow the schedule of their source. Backups are not edited: they age out as the Backup and recovery pack keeps them.",
|
|
714
|
+
"consequences": "• Simple, and complete in the primary store, its replicas and the search index.\n• Expired records live on in backups until they age out, and in any copy the job does not know about.\n• Large deletes cause table bloat and replication lag; batches and an off-peak window limit them.",
|
|
715
|
+
"alternatives": "1. Crypto-shredding: reaches backups within days, at the cost of a key per group and a key service.\n2. Soft delete (a deleted_at flag): nothing is disposed of; it fails the period.",
|
|
716
|
+
"hubWhen": {
|
|
717
|
+
"SCHEDULE": [
|
|
718
|
+
"file",
|
|
719
|
+
"tool"
|
|
720
|
+
],
|
|
721
|
+
"DELETE": [
|
|
722
|
+
"hard"
|
|
723
|
+
]
|
|
724
|
+
}
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
"id": "adr-shred",
|
|
728
|
+
"type": "adr",
|
|
729
|
+
"label": "Expired records crypto-shredded",
|
|
730
|
+
"x": 780,
|
|
731
|
+
"y": 520,
|
|
732
|
+
"concern": "retention",
|
|
733
|
+
"status": "accepted",
|
|
734
|
+
"date": "",
|
|
735
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
736
|
+
"decision": "Each record group, one category and fiscal year, is encrypted in the application with data keys generated under a key of its own in the key service (AWS KMS, Google Cloud KMS or Azure Key Vault on that cloud, HashiCorp Vault Transit elsewhere), through an envelope library (AWS Encryption SDK, Google Tink); in AWS KMS the key is named alias/records/<category>/<fiscal year>. At the end of a group's period, if no legal hold covers any of its records, the job deletes the rows, schedules the key for deletion with the shortest waiting period the service allows (7 days in AWS KMS), and logs the group with the key's id in disposal_log; from then on every copy of the group (backups, replicas, archives, event streams) is unreadable. Only the job's role may schedule key deletion; the key policy denies it to everyone else. Search indexes hold no encrypted field in clear.",
|
|
737
|
+
"consequences": "• Disposal reaches copies the job cannot edit, locked backups included, within days of the period's end.\n• A key lost early loses a whole year of a category; the key policy is what prevents it.\n• One hold on one record keeps its whole group's key.\n• Every read decrypts: some latency, and the key service is on the read path.\n• Encrypted fields cannot be searched or sorted in the database; keyed hashes (HMAC) carry what must be looked up.",
|
|
738
|
+
"alternatives": "1. Deletion by a scheduled job: simpler; backups keep the records until they age out.\n2. A key per record: the finest erasure, but one key per row costs more in a key service than the data is worth.",
|
|
739
|
+
"hubWhen": {
|
|
740
|
+
"SCHEDULE": [
|
|
741
|
+
"file",
|
|
742
|
+
"tool"
|
|
743
|
+
],
|
|
744
|
+
"DELETE": [
|
|
745
|
+
"crypto"
|
|
746
|
+
]
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
"id": "adr-aggregate",
|
|
751
|
+
"type": "adr",
|
|
752
|
+
"label": "Expired records rolled up, then deleted",
|
|
753
|
+
"x": 780,
|
|
754
|
+
"y": 650,
|
|
755
|
+
"concern": "retention",
|
|
756
|
+
"status": "accepted",
|
|
757
|
+
"date": "",
|
|
758
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
759
|
+
"decision": "Before expired records are deleted, the job rolls them up into tables named <source>_totals (record count and amounts per month, category, region and currency) with no identifier of a person, customer or record; groups of fewer than 5 records are merged into the month's \"other\" row, and an \"other\" row still below 5 is left out. The records are deleted in the same transaction, with their search entries and cache keys. Periods past the retention are analysed only from the totals.",
|
|
760
|
+
"consequences": "• Finance and analytics keep the history (revenue per month, volumes) after the records go.\n• The totals are fixed at disposal: a question nobody thought of then cannot be answered later.\n• Small groups are blurred into \"other\" or lost.\n• Expired records live on in backups until they age out.",
|
|
761
|
+
"alternatives": "1. Deletion by a scheduled job without totals: simpler, and the history goes with the records.\n2. Anonymising rows in place: keeps detail, but the rows of rare customers can still single them out.",
|
|
762
|
+
"hubWhen": {
|
|
763
|
+
"SCHEDULE": [
|
|
764
|
+
"file",
|
|
765
|
+
"tool"
|
|
766
|
+
],
|
|
767
|
+
"DELETE": [
|
|
768
|
+
"aggregate"
|
|
769
|
+
]
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
"id": "adr-hold",
|
|
774
|
+
"type": "adr",
|
|
775
|
+
"label": "Legal holds set by named roles",
|
|
776
|
+
"x": 780,
|
|
777
|
+
"y": 780,
|
|
778
|
+
"concern": "retention",
|
|
779
|
+
"status": "accepted",
|
|
780
|
+
"date": "",
|
|
781
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
782
|
+
"decision": "A legal hold is a row in the legal_hold table: the matter reference, its scope (a record, a record group or a category), who set it and when, who lifted it and when. The deletion job skips everything an open hold covers and disposes of it in the first run after the last hold on it is lifted, if its period has ended. Only {{HOLD_ROLES}} may set or lift a hold: the hold API checks the role, no other role may write to legal_hold, and every change goes to the audit trail. In buckets with Object Lock, a held object version also gets an S3 Object Lock legal hold, which neither a lifecycle rule nor a permanent delete can remove. With each store's own lifecycle configuration there is no job to skip anything: an object version is held by Object Lock alone, and a table by setting its pg_partman retention to none and listing it with its matter in retention/holds.json; only {{HOLD_ROLES}} hold s3:PutObjectLegalHold.",
|
|
783
|
+
"consequences": "• Disposal and preservation are one mechanism, so the job cannot forget a hold.\n• Holds outlive their reason unless someone lifts them; the legal team reviews open holds with each matter's status.\n• With crypto-shredding a hold on one record keeps its whole group's key, so a hold names records unless the matter needs more.\n• A table held in pg_partman keeps every partition, expired or not, until the hold is lifted.",
|
|
784
|
+
"alternatives": "1. No legal hold: simpler, and the first lawsuit stops disposal of whole categories by hand.\n2. Copying held records to a separate preservation store: disposal stays simple, but the copies drift from the originals and are one more store of personal data.",
|
|
785
|
+
"hubWhen": {
|
|
786
|
+
"HOLD": [
|
|
787
|
+
"flag"
|
|
788
|
+
]
|
|
789
|
+
}
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
"id": "adr-no-hold",
|
|
793
|
+
"type": "adr",
|
|
794
|
+
"label": "No legal hold",
|
|
795
|
+
"x": 780,
|
|
796
|
+
"y": 910,
|
|
797
|
+
"concern": "retention",
|
|
798
|
+
"status": "accepted",
|
|
799
|
+
"date": "",
|
|
800
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
801
|
+
"decision": "There is no legal hold: disposal is never suspended for a single matter. A preservation request is answered by stopping disposal of the categories concerned (their schedule rows or the stores' lifecycle rules) by a change the compliance officer approves, until the matter is closed. This holds while the records have no evidential value beyond what is exported to an eDiscovery tool; the first matter that needs records preserved in place supersedes this decision.",
|
|
802
|
+
"consequences": "• Nothing to build, and nothing that can keep a record by mistake.\n• A preservation request stops disposal of whole categories, keeping everything in them past its period until the matter is closed.\n• Stopping by hand is slow and easy to forget to undo; while a stop lasts the weekly overdue report and the bucket lifecycle check fail, which is the reminder, and the records owner notes the matter on the ticket.",
|
|
803
|
+
"alternatives": "1. A legal hold set by named roles: precise, at the cost of a table, an API and a check in the job.\n2. An export to an eDiscovery tool at the start of each matter: preservation outside the system, but the export must be complete, and the originals still go on schedule.",
|
|
804
|
+
"hubWhen": {
|
|
805
|
+
"HOLD": [
|
|
806
|
+
"none"
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
"id": "adr-restrict",
|
|
812
|
+
"type": "adr",
|
|
813
|
+
"label": "Records kept for an obligation are restricted",
|
|
814
|
+
"x": 780,
|
|
815
|
+
"y": 1040,
|
|
816
|
+
"concern": "retention",
|
|
817
|
+
"status": "accepted",
|
|
818
|
+
"date": "",
|
|
819
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
820
|
+
"decision": "When an accepted erasure request covers records the schedule still requires, those records stay unchanged and are marked restricted (restricted_until, the end of their period, and the request's id). PostgreSQL row-level security hides restricted rows from every role but compliance, and the compliance role reads them only for a named obligation (a tax audit, a court order), each read written to the audit trail. The answer to the person, sent by the Personal data pack's erasure process, lists each kept category, its legal basis and the date it goes. At the end of their period the records go with the rest.",
|
|
821
|
+
"consequences": "• The record stays exactly as issued, which is what tax and commercial rules usually ask of an invoice.\n• Every reader of these tables runs under row-level security; anything that bypasses it (a superuser, a replica or export without the policies) breaks the restriction.\n• The person's name stays in the store for years, visible to the compliance role.",
|
|
822
|
+
"alternatives": "1. Pseudonymisation of the kept records: daily work keeps using them, but the record no longer stands as issued.\n2. Moving the kept records to an archive store: cleanly out of reach, at the cost of one more store to secure and dispose of.",
|
|
823
|
+
"hubWhen": {
|
|
824
|
+
"CONFLICT": [
|
|
825
|
+
"restrict"
|
|
826
|
+
]
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"id": "adr-pseudonymise",
|
|
831
|
+
"type": "adr",
|
|
832
|
+
"label": "Records kept for an obligation are pseudonymised",
|
|
833
|
+
"x": 780,
|
|
834
|
+
"y": 1170,
|
|
835
|
+
"concern": "retention",
|
|
836
|
+
"status": "accepted",
|
|
837
|
+
"date": "",
|
|
838
|
+
"context": "This store keeps business records: invoices, contracts, payments, accounting entries. The forces: tax, commercial and sector law and contracts require some of them to be kept for years, counted from an event (the end of the fiscal year, the end of a contract), and a record deleted early cannot be produced for a tax audit or a court; data protection law requires data about people to go once it is no longer needed (GDPR Art. 5(1)(e)), so keeping everything forever is not safe either; a lawsuit, an investigation or an audit can require records to be preserved past their period, and a job that deletes on schedule knows nothing of it unless it is told; a person may ask to be erased while the law still requires their invoices; and records spread into replicas, caches, search indexes, exports and backups that a delete in the primary store does not reach. Personal data that is not a business record, and erasure on request, are decided in the Personal data pack; how long backups are kept, in the Backup and recovery pack; how long audit records are kept, in the Audit trail pack.",
|
|
839
|
+
"decision": "When an accepted erasure request covers records the schedule still requires, the person's name, address, e-mail and phone in those records are replaced with a random pseudonym when the rest of their data is erased. The link from pseudonym to the original values is kept in a separate table that only the compliance role can read, used only to produce a record for a named obligation, each use written to the audit trail. A document the law requires kept as issued (the invoice PDF) stays in storage only the compliance role can read. The answer to the person lists each kept category, its legal basis and the date it goes; at the end of the period the link and the records go together.",
|
|
840
|
+
"consequences": "• Daily work (reports, reconciliation) keeps using the kept records without seeing whose they are.\n• Pseudonymised data is still personal data while the link exists: the link table needs the protection of the original.\n• Two things to dispose of at the period's end, the records and the link.\n• Whether a pseudonymised working copy meets the obligation is a legal reading; the compliance officer confirms it per category.",
|
|
841
|
+
"alternatives": "1. Restriction until the period ends: the record stays as issued, and daily work loses it.\n2. Erasing despite the obligation: breaks the obligation; not an option.",
|
|
842
|
+
"hubWhen": {
|
|
843
|
+
"CONFLICT": [
|
|
844
|
+
"pseudonymise"
|
|
845
|
+
]
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
"id": "ff-coverage",
|
|
850
|
+
"type": "fitness-fn",
|
|
851
|
+
"label": "Every table in the schedule",
|
|
852
|
+
"x": 1040,
|
|
853
|
+
"y": 0,
|
|
854
|
+
"characteristic": "security",
|
|
855
|
+
"scope": "atomic",
|
|
856
|
+
"cadence": "triggered",
|
|
857
|
+
"trigger": "pull-request",
|
|
858
|
+
"invocation": "automated",
|
|
859
|
+
"description": "In CI, after the migrations run against an empty database, a script lists the tables and looks each up in retention/schedule.json; a new table fails the build until it has a complete row, and a row whose last legal review is older than {{REVIEW_MONTHS}} months fails it too, which makes the review a date in the file rather than a promise.\n\nThreshold: Every table in the migrated schema has exactly 1 row in retention/schedule.json with category, basis, period, trigger, date column and owner, reviewed within {{REVIEW_MONTHS}} months, or category \"none\" with a reason\n\nTool: psql and jq in the CI pipeline (GNU date), against the migrated schema\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nsince=$(date -u -d '-{{REVIEW_MONTHS}} months' +%F)\nfail=0\nfor table in $(psql \"$DATABASE_URL\" -Atc \"select tablename from pg_tables where schemaname = 'public'\"); do\n jq -e --arg t \"$table\" --arg since \"$since\" '\n [.[] | select(.table == $t)] | length == 1 and (.[0] |\n (.category == \"none\" and (.reason | length > 0)) or\n (.category and .basis and .years > 0 and (.from == \"fiscal-year-end\" or .from == \"date\")\n and .column and .owner and .reviewed >= $since))' \\\n retention/schedule.json > /dev/null || { echo \"$table: no complete schedule row reviewed since $since\"; fail=1; }\ndone\nexit $fail\n```",
|
|
860
|
+
"hubWhen": {
|
|
861
|
+
"SCHEDULE": [
|
|
862
|
+
"file"
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
"id": "ff-tool-mapping",
|
|
868
|
+
"type": "fitness-fn",
|
|
869
|
+
"label": "Every table mapped to an exported label",
|
|
870
|
+
"x": 1040,
|
|
871
|
+
"y": 130,
|
|
872
|
+
"characteristic": "security",
|
|
873
|
+
"scope": "atomic",
|
|
874
|
+
"cadence": "triggered",
|
|
875
|
+
"trigger": "pull-request",
|
|
876
|
+
"invocation": "automated",
|
|
877
|
+
"description": "The records manager exports the labels with Microsoft Graph PowerShell (signed in with the delegated permission RecordsManagement.Read.All, the only kind the API accepts) and commits the file; CI checks its age from git history (checkout with fetch-depth 0) and every table against the mapping. A label kept forever (retentionDurationForever, no days) fails, as does a table mapped to a label the export no longer has. With more labels than one page, follow @odata.nextLink when exporting.\n\nThreshold: retention/labels.json committed within {{REVIEW_MONTHS}} months; every table in the migrated schema has exactly 1 row mapping it to a date column and a label in that export with a retention period in days, or category \"none\" with a reason\n\nTool: Microsoft Graph PowerShell (Invoke-MgGraphRequest) for the export; psql, jq and git in the CI pipeline\n\n```bash\n#!/usr/bin/env bash\n# export, by the records manager:\n# Connect-MgGraph -Scopes RecordsManagement.Read.All\n# Invoke-MgGraphRequest -Method GET -Uri '/v1.0/security/labels/retentionLabels' -OutputFilePath retention/labels.json\nset -euo pipefail\nexported=$(git log -1 --format=%cs -- retention/labels.json)\n[[ \"$exported\" > \"$(date -u -d '-{{REVIEW_MONTHS}} months' +%F)\" ]] || { echo \"labels last exported on '$exported'\"; exit 1; }\nfail=0\nfor table in $(psql \"$DATABASE_URL\" -Atc \"select tablename from pg_tables where schemaname = 'public'\"); do\n jq -e --arg t \"$table\" --slurpfile labels retention/labels.json '\n [.[] | select(.table == $t)] | length == 1 and (.[0] as $row |\n ($row.category == \"none\" and ($row.reason | length > 0)) or\n ($row.column and ($labels[0].value | any(.displayName == $row.label and .retentionDuration.days != null))))' \\\n retention/schedule.json > /dev/null || { echo \"$table: not mapped to a date column and an exported label\"; fail=1; }\ndone\nexit $fail\n```",
|
|
878
|
+
"hubWhen": {
|
|
879
|
+
"SCHEDULE": [
|
|
880
|
+
"tool"
|
|
881
|
+
]
|
|
882
|
+
}
|
|
883
|
+
},
|
|
884
|
+
{
|
|
885
|
+
"id": "ff-store-config",
|
|
886
|
+
"type": "fitness-fn",
|
|
887
|
+
"label": "Every table partitioned with a retention",
|
|
888
|
+
"x": 1040,
|
|
889
|
+
"y": 260,
|
|
890
|
+
"characteristic": "security",
|
|
891
|
+
"scope": "atomic",
|
|
892
|
+
"cadence": "triggered",
|
|
893
|
+
"trigger": "pull-request",
|
|
894
|
+
"invocation": "automated",
|
|
895
|
+
"description": "A script run in CI against the migrated schema, and daily against production with a read-only role, joins every table (partitions left out, transient tables skipped) to partman.part_config; a table without retention fails unless it is held, a table that only detaches expired partitions fails, and any row older than its period plus one partition and {{DISPOSE_DAYS}} days means maintenance has stopped.\n\nThreshold: Every records table in the schema has pg_partman retention with retention_keep_table false, or is listed with a matter in retention/holds.json; 0 rows older than retention plus one partition interval plus {{DISPOSE_DAYS}} days\n\nTool: psql and jq, against PostgreSQL with pg_partman 5\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nheld() { jq -e --arg t \"$1\" 'any(.[]; .table == $t and (.matter | length > 0))' retention/holds.json > /dev/null; }\nfail=0\nwhile IFS='|' read -r table control interval retention keep; do\n grep -qxF \"${table#public.}\" retention/transient-tables.txt && continue\n if [ -z \"$retention\" ]; then held \"$table\" || { echo \"$table: no pg_partman retention\"; fail=1; }; continue; fi\n [ \"$keep\" = false ] || { echo \"$table: expired partitions are kept, not dropped\"; fail=1; }\n late=$(psql \"$DATABASE_URL\" -Atc \"select count(*) from $table where $control < now() - interval '$retention' - interval '$interval' - interval '{{DISPOSE_DAYS}} days'\")\n [ \"$late\" = 0 ] || { echo \"$table: $late rows past their period\"; fail=1; }\ndone < <(psql \"$DATABASE_URL\" -At -c \"\n select t.schemaname || '.' || t.tablename, coalesce(c.control, ''), coalesce(c.partition_interval, ''),\n coalesce(c.retention, ''), coalesce(c.retention_keep_table::text, '')\n from pg_tables t\n left join partman.part_config c on c.parent_table = t.schemaname || '.' || t.tablename\n where t.schemaname = 'public'\n and not exists (select 1 from pg_inherits i where i.inhrelid = (quote_ident(t.schemaname) || '.' || quote_ident(t.tablename))::regclass)\")\nexit $fail\n```",
|
|
896
|
+
"hubWhen": {
|
|
897
|
+
"SCHEDULE": [
|
|
898
|
+
"store"
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
"id": "ff-bucket-lifecycle",
|
|
904
|
+
"type": "fitness-fn",
|
|
905
|
+
"label": "Every records bucket expires its objects",
|
|
906
|
+
"x": 1040,
|
|
907
|
+
"y": 390,
|
|
908
|
+
"characteristic": "security",
|
|
909
|
+
"scope": "atomic",
|
|
910
|
+
"cadence": "triggered",
|
|
911
|
+
"trigger": "pull-request",
|
|
912
|
+
"invocation": "automated",
|
|
913
|
+
"description": "A scheduled job and the infrastructure pipeline read each records bucket's lifecycle configuration. In a versioned bucket an Expiration action only adds a delete marker, so without NoncurrentVersionExpiration the record stays as a noncurrent version for ever; versions under Object Lock are left alone by lifecycle, which is how held objects survive. A bucket with no configuration at all answers NoSuchLifecycleConfiguration and fails. Without legal holds, a rule disabled to preserve records for a matter fails this check for as long as it is off.\n\nThreshold: Every bucket in RECORD_BUCKETS has an enabled lifecycle rule that expires objects (Days or Date), and, when versioning is on, one that removes noncurrent versions within {{DISPOSE_DAYS}} days\n\nTool: AWS CLI v2 (s3api get-bucket-lifecycle-configuration, get-bucket-versioning) and jq\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nfail=0\nfor bucket in $RECORD_BUCKETS; do\n rules=$(aws s3api get-bucket-lifecycle-configuration --bucket \"$bucket\" --output json 2>/dev/null) || { echo \"$bucket: no lifecycle configuration\"; fail=1; continue; }\n echo \"$rules\" | jq -e 'any(.Rules[]; .Status == \"Enabled\" and ((.Expiration.Days // 0) > 0 or .Expiration.Date != null))' > /dev/null \\\n || { echo \"$bucket: no enabled rule expires objects\"; fail=1; }\n if [ \"$(aws s3api get-bucket-versioning --bucket \"$bucket\" --query Status --output text)\" = Enabled ]; then\n echo \"$rules\" | jq -e --argjson d {{DISPOSE_DAYS}} 'any(.Rules[]; .Status == \"Enabled\" and (.NoncurrentVersionExpiration.NoncurrentDays // 100000) <= $d)' > /dev/null \\\n || { echo \"$bucket: noncurrent versions are not removed within {{DISPOSE_DAYS}} days\"; fail=1; }\n fi\ndone\nexit $fail\n```"
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
"id": "ff-disposal-job",
|
|
917
|
+
"type": "fitness-fn",
|
|
918
|
+
"label": "Disposal removes the expired and nothing else",
|
|
919
|
+
"x": 1040,
|
|
920
|
+
"y": 520,
|
|
921
|
+
"characteristic": "security",
|
|
922
|
+
"scope": "atomic",
|
|
923
|
+
"cadence": "triggered",
|
|
924
|
+
"trigger": "pull-request",
|
|
925
|
+
"invocation": "automated",
|
|
926
|
+
"description": "An integration test runs the real job against PostgreSQL in a container with the repository's schedule. expectDisposed checks what the disposal decision promises: the row and its search entry gone, and with crypto-shredding the group's key pending deletion, or with totals the row folded into them. The fiscal years are computed from today, so the test keeps working as years pass.\n\nThreshold: An invoice past its period plus {{DISPOSE_DAYS}} days is disposed of in 1 run; an invoice in its period, every row of a table without a schedule row, and every row when the schedule is missing remain; 1 alert for the unknown table\n\nTool: Vitest with Testcontainers (@testcontainers/postgresql); for the JVM: JUnit 5 with Testcontainers\n\n```ts\nimport { beforeEach, expect, it } from 'vitest'\nimport { runDisposal } from '../../src/retention/job'\nimport { alerts, db, expectDisposed, resetDb } from './fixtures'\nconst inYear = (yearsAgo: number) => new Date(Date.UTC(new Date().getUTCFullYear() - yearsAgo, 0, 15))\nbeforeEach(resetDb)\n\nit('disposes of an expired invoice and keeps one in its period', async () => {\n const expired = await db.invoices.insert({ issuedAt: inYear({{ACCOUNTING_YEARS}} + 2) })\n const current = await db.invoices.insert({ issuedAt: inYear({{ACCOUNTING_YEARS}} - 1) })\n await runDisposal({ now: new Date() })\n await expectDisposed('invoices', expired.id)\n expect(await db.invoices.find(current.id)).toBeDefined()\n})\nit('deletes nothing from a table without a schedule row, and says so', async () => {\n await db.query('create table unscheduled_notes (id serial primary key, created_at timestamptz)')\n await db.query(\"insert into unscheduled_notes (created_at) values (now() - interval '50 years')\")\n await runDisposal({ now: new Date() })\n expect((await db.query('select count(*)::int as n from unscheduled_notes')).rows[0].n).toBe(1)\n expect(alerts()).toContainEqual(expect.objectContaining({ table: 'unscheduled_notes' }))\n})\nit('deletes nothing at all when the schedule cannot be read', async () => {\n const expired = await db.invoices.insert({ issuedAt: inYear({{ACCOUNTING_YEARS}} + 2) })\n await expect(runDisposal({ now: new Date(), schedulePath: 'retention/missing.json' })).rejects.toThrow()\n expect(await db.invoices.find(expired.id)).toBeDefined()\n})\n```",
|
|
927
|
+
"hubWhen": {
|
|
928
|
+
"SCHEDULE": [
|
|
929
|
+
"file",
|
|
930
|
+
"tool"
|
|
931
|
+
]
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"id": "ff-overdue",
|
|
936
|
+
"type": "fitness-fn",
|
|
937
|
+
"label": "Weekly report of overdue records",
|
|
938
|
+
"x": 1040,
|
|
939
|
+
"y": 650,
|
|
940
|
+
"characteristic": "security",
|
|
941
|
+
"scope": "atomic",
|
|
942
|
+
"cadence": "triggered",
|
|
943
|
+
"trigger": "weekly",
|
|
944
|
+
"invocation": "automated",
|
|
945
|
+
"description": "A weekly job, independent of the deletion job's code, reads the schedule the job last applied (the retention_schedule table: table, period, the event it counts from, date column) and counts the overdue rows of each table with a read-only role; where the legal_hold table exists, rows under an open hold are left out. It assumes a calendar fiscal year; shift the date_trunc for another. The scheduler turns a failed run into a ticket.\n\nThreshold: 0 records, per table in retention_schedule, whose period ended more than {{DISPOSE_DAYS}} days ago and that no open legal hold covers; above 0 the job fails and opens a ticket for the records owner\n\nTool: psql in a scheduled job (Kubernetes CronJob, GitHub Actions schedule)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nhold=\"\"\n[ \"$(psql \"$DATABASE_URL\" -Atc \"select to_regclass('public.legal_hold') is not null\")\" = t ] &&\n hold=\"and not exists (select 1 from legal_hold h where h.table_name = '%s' and (h.record_id is null or h.record_id = r.id::text) and h.lifted_at is null)\"\ntotal=0\nwhile IFS='|' read -r table period start_from column; do\n start=$column\n [ \"$start_from\" = fiscal-year-end ] && start=\"date_trunc('year', $column) + interval '1 year'\"\n n=$(psql \"$DATABASE_URL\" -Atc \"select count(*) from $table r where $start + interval '$period' + interval '{{DISPOSE_DAYS}} days' < now() $(printf \"$hold\" \"$table\")\")\n echo \"$table: $n records overdue\"\n total=$((total + n))\ndone < <(psql \"$DATABASE_URL\" -At -c \"select table_name, period, start_from, date_column from retention_schedule where category <> 'none'\")\n[ \"$total\" -eq 0 ]\n```",
|
|
946
|
+
"hubWhen": {
|
|
947
|
+
"SCHEDULE": [
|
|
948
|
+
"file",
|
|
949
|
+
"tool"
|
|
950
|
+
]
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
{
|
|
954
|
+
"id": "ff-no-early-delete",
|
|
955
|
+
"type": "fitness-fn",
|
|
956
|
+
"label": "Only disposal can delete records",
|
|
957
|
+
"x": 1040,
|
|
958
|
+
"y": 780,
|
|
959
|
+
"characteristic": "security",
|
|
960
|
+
"scope": "atomic",
|
|
961
|
+
"cadence": "triggered",
|
|
962
|
+
"trigger": "pull-request",
|
|
963
|
+
"invocation": "automated",
|
|
964
|
+
"description": "In CI against the migrated schema with the production roles created, and weekly against production, a query asks PostgreSQL itself whether each login role can delete from or truncate each table, ownership and inherited grants included; a grant added for convenience fails the build. Superusers can always delete and are kept to the platform team. With each store's own lifecycle configuration there is no retention_job role and the schema owner runs pg_partman's maintenance.\n\nThreshold: 0 login roles other than migrator and retention_job (superusers aside) with DELETE or TRUNCATE on any table or partition not listed in retention/transient-tables.txt\n\nTool: psql and awk in the CI pipeline\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nfound=$(psql \"$DATABASE_URL\" -AtF ' ' -c \"\n select c.relname, r.rolname, p.privilege\n from pg_class c\n join pg_namespace n on n.oid = c.relnamespace and n.nspname = 'public'\n cross join pg_roles r\n cross join (values ('DELETE'), ('TRUNCATE')) as p(privilege)\n where c.relkind in ('r', 'p') and r.rolcanlogin and not r.rolsuper\n and r.rolname not in ('migrator', 'retention_job')\n and has_table_privilege(r.oid, c.oid, p.privilege)\" |\n awk 'NR == FNR { transient[$1]; next } !($1 in transient)' retention/transient-tables.txt -)\n[ -z \"$found\" ] || { printf 'roles that can remove records before their period ends:\\n%s\\n' \"$found\"; exit 1; }\n```"
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
"id": "ff-hold",
|
|
968
|
+
"type": "fitness-fn",
|
|
969
|
+
"label": "Holds keep records and only named roles set them",
|
|
970
|
+
"x": 1040,
|
|
971
|
+
"y": 910,
|
|
972
|
+
"characteristic": "security",
|
|
973
|
+
"scope": "atomic",
|
|
974
|
+
"cadence": "triggered",
|
|
975
|
+
"trigger": "pull-request",
|
|
976
|
+
"invocation": "automated",
|
|
977
|
+
"description": "An integration test against PostgreSQL in a container sets a hold as one of the named roles, runs disposal, lifts the hold, runs it again, and tries both as a support engineer; the audit trail is read back for the matter and the actor.\n\nThreshold: An expired invoice under an open hold survives a disposal run and is disposed of in the first run after the lift; holds set or lifted by a role outside {{HOLD_ROLES}} are refused (0 accepted); 1 audit record per accepted change\n\nTool: Vitest with Testcontainers (@testcontainers/postgresql); for the JVM: JUnit 5 with Testcontainers\n\n```ts\nimport { beforeEach, expect, it } from 'vitest'\nimport { runDisposal } from '../../src/retention/job'\nimport { holds } from '../../src/retention/holds'\nimport { actor, auditTrail, db, expectDisposed, resetDb } from './fixtures'\nconst ALLOWED = '{{HOLD_ROLES}}'.split(/,\\s*/)\nconst expiredAt = () => new Date(Date.UTC(new Date().getUTCFullYear() - ({{ACCOUNTING_YEARS}} + 2), 0, 15))\nbeforeEach(resetDb)\n\nit('keeps held records past their period and disposes of them after the lift', async () => {\n const held = await db.invoices.insert({ issuedAt: expiredAt() })\n const hold = await holds.set(actor(ALLOWED[0]), { matter: 'LIT-2026-014', records: [{ table: 'invoices', id: held.id }] })\n await runDisposal({ now: new Date() })\n expect(await db.invoices.find(held.id)).toBeDefined()\n await holds.lift(actor(ALLOWED[0]), hold.id)\n await runDisposal({ now: new Date() })\n await expectDisposed('invoices', held.id)\n})\nit('lets only the named roles set and lift a hold, and audits it', async () => {\n const scope = { matter: 'LIT-2026-015', category: 'contracts' }\n await expect(holds.set(actor('support engineer'), scope)).rejects.toThrow(/forbidden/i)\n const hold = await holds.set(actor(ALLOWED[0]), scope)\n await expect(holds.lift(actor('support engineer'), hold.id)).rejects.toThrow(/forbidden/i)\n expect(await auditTrail.find({ subject: hold.id })).toContainEqual(expect.objectContaining({ action: 'legal-hold.set', matter: 'LIT-2026-015', actor: ALLOWED[0] }))\n})\n```",
|
|
978
|
+
"hubWhen": {
|
|
979
|
+
"HOLD": [
|
|
980
|
+
"flag"
|
|
981
|
+
],
|
|
982
|
+
"SCHEDULE": [
|
|
983
|
+
"file",
|
|
984
|
+
"tool"
|
|
985
|
+
]
|
|
986
|
+
}
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
"id": "ff-hold-store",
|
|
990
|
+
"type": "fitness-fn",
|
|
991
|
+
"label": "Held objects cannot be deleted",
|
|
992
|
+
"x": 1040,
|
|
993
|
+
"y": 1040,
|
|
994
|
+
"characteristic": "security",
|
|
995
|
+
"scope": "atomic",
|
|
996
|
+
"cadence": "temporal",
|
|
997
|
+
"every": "30d",
|
|
998
|
+
"invocation": "automated",
|
|
999
|
+
"description": "A monthly drill, and a run after every IAM change, against a records bucket of the staging account (Object Lock on): it holds a test object, tries to delete the version, lifts the hold and deletes it, then asks the IAM policy simulator which roles may place or lift legal holds. retention/hold-roles.txt lists the ARNs of the roles that {{HOLD_ROLES}} assume. Held tables are checked by the configuration check through retention/holds.json.\n\nThreshold: A permanent delete of a held object version is refused; after the lift it succeeds; 0 IAM roles outside retention/hold-roles.txt are allowed s3:PutObjectLegalHold on the records buckets\n\nTool: AWS CLI v2 (s3api put-object-legal-hold, delete-object; iam simulate-principal-policy)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nbucket=$HOLD_DRILL_BUCKET\necho drill > held.txt\nversion=$(aws s3api put-object --bucket \"$bucket\" --key drill/held.txt --body held.txt --query VersionId --output text)\naws s3api put-object-legal-hold --bucket \"$bucket\" --key drill/held.txt --version-id \"$version\" --legal-hold Status=ON\nif aws s3api delete-object --bucket \"$bucket\" --key drill/held.txt --version-id \"$version\" 2>/dev/null; then\n echo \"a held version was deleted\"; exit 1\nfi\naws s3api put-object-legal-hold --bucket \"$bucket\" --key drill/held.txt --version-id \"$version\" --legal-hold Status=OFF\naws s3api delete-object --bucket \"$bucket\" --key drill/held.txt --version-id \"$version\" > /dev/null\nfor role in $(aws iam list-roles --query 'Roles[].Arn' --output text); do\n decision=$(aws iam simulate-principal-policy --policy-source-arn \"$role\" --action-names s3:PutObjectLegalHold \\\n --resource-arns \"arn:aws:s3:::$bucket/drill/held.txt\" --query 'EvaluationResults[0].EvalDecision' --output text)\n [ \"$decision\" != allowed ] || grep -qxF \"$role\" retention/hold-roles.txt || { echo \"$role may set or lift legal holds\"; exit 1; }\ndone\n```",
|
|
1000
|
+
"hubWhen": {
|
|
1001
|
+
"HOLD": [
|
|
1002
|
+
"flag"
|
|
1003
|
+
],
|
|
1004
|
+
"SCHEDULE": [
|
|
1005
|
+
"store"
|
|
1006
|
+
]
|
|
1007
|
+
}
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
"id": "ff-conflict",
|
|
1011
|
+
"type": "fitness-fn",
|
|
1012
|
+
"label": "Erased person, kept records out of reach",
|
|
1013
|
+
"x": 1040,
|
|
1014
|
+
"y": 1170,
|
|
1015
|
+
"characteristic": "security",
|
|
1016
|
+
"scope": "atomic",
|
|
1017
|
+
"cadence": "triggered",
|
|
1018
|
+
"trigger": "pull-request",
|
|
1019
|
+
"invocation": "automated",
|
|
1020
|
+
"description": "An integration test creates a customer with an invoice in its period, orders and a ticket, accepts their erasure through the Personal data pack's erasure process, and checks what each role can still find: whether the invoice is restricted or pseudonymised, support and reporting cannot tie it to the person and the compliance role can still produce it.\n\nThreshold: After an accepted erasure, 0 kept records reachable by the person through the support and reporting roles; 1 kept invoice readable by the compliance role for an obligation; the answer to the person lists the kept category with its basis and date\n\nTool: Vitest with Testcontainers (@testcontainers/postgresql); for the JVM: JUnit 5 with Testcontainers\n\n```ts\nimport { expect, it } from 'vitest'\nimport { acceptErasure } from '../../src/privacy/erasure'\nimport { asRole, customerWith } from './fixtures'\n\nit('keeps what the law requires, for that obligation only', async () => {\n const person = await customerWith({ invoices: 1, orders: 2, tickets: 1 })\n const answer = await acceptErasure(person.id)\n expect(await asRole('support').search(person.email)).toEqual([])\n expect(await asRole('reporting').invoicesOf(person.id)).toEqual([])\n const kept = await asRole('compliance').invoicesOf(person.id, { obligation: 'tax-audit' })\n expect(kept).toHaveLength(1)\n expect(answer.kept).toEqual([{ category: 'invoices', basis: expect.any(String), until: kept[0].retainUntil }])\n})\n```"
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"id": "ff-shred-keys",
|
|
1024
|
+
"type": "fitness-fn",
|
|
1025
|
+
"label": "Keys of disposed groups destroyed",
|
|
1026
|
+
"x": 1040,
|
|
1027
|
+
"y": 1300,
|
|
1028
|
+
"characteristic": "security",
|
|
1029
|
+
"scope": "atomic",
|
|
1030
|
+
"cadence": "triggered",
|
|
1031
|
+
"trigger": "nightly",
|
|
1032
|
+
"invocation": "automated",
|
|
1033
|
+
"description": "A daily job reads the groups the deletion job logged in disposal_log (group, key id, time) and asks AWS KMS for each key's state; a key still enabled means the group's copies in backups and archives are still readable. A deleted key answers NotFoundException, which counts as done.\n\nThreshold: 0 record groups disposed of more than 1 day ago whose KMS key is in any state but PendingDeletion or deleted; every pending deletion date within 30 days of the disposal\n\nTool: AWS CLI v2 (kms describe-key) and psql in a scheduled job\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nfail=0\nwhile IFS='|' read -r group key disposed; do\n meta=$(aws kms describe-key --key-id \"$key\" --output json 2> err.txt) || {\n grep -q NotFoundException err.txt && continue\n echo \"$group: $(cat err.txt)\"; fail=1; continue\n }\n state=$(echo \"$meta\" | jq -r .KeyMetadata.KeyState)\n [ \"$state\" = PendingDeletion ] || { echo \"$group: key $key is $state\"; fail=1; continue; }\n deletion=$(date -u -d \"$(echo \"$meta\" | jq -r .KeyMetadata.DeletionDate)\" +%s) # AWS CLI v2 prints ISO 8601\n [ \"$deletion\" -le $((disposed + 30 * 86400)) ] || { echo \"$group: key deleted only at $deletion\"; fail=1; }\ndone < <(psql \"$DATABASE_URL\" -At -c \"select group_key, key_id, extract(epoch from disposed_at)::bigint from disposal_log where disposed_at < now() - interval '1 day'\")\nexit $fail\n```",
|
|
1034
|
+
"hubWhen": {
|
|
1035
|
+
"SCHEDULE": [
|
|
1036
|
+
"file",
|
|
1037
|
+
"tool"
|
|
1038
|
+
],
|
|
1039
|
+
"DELETE": [
|
|
1040
|
+
"crypto"
|
|
1041
|
+
]
|
|
1042
|
+
}
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
"id": "ff-aggregates",
|
|
1046
|
+
"type": "fitness-fn",
|
|
1047
|
+
"label": "Totals identify no one",
|
|
1048
|
+
"x": 1040,
|
|
1049
|
+
"y": 1430,
|
|
1050
|
+
"characteristic": "security",
|
|
1051
|
+
"scope": "atomic",
|
|
1052
|
+
"cadence": "triggered",
|
|
1053
|
+
"trigger": "pull-request",
|
|
1054
|
+
"invocation": "automated",
|
|
1055
|
+
"description": "A query run in CI against the migrated schema and daily after disposal returns every small group and every column that could carry an identifier; a new column in a totals table fails until it is added to the list on purpose. That expired rows are actually gone is the weekly report's job.\n\nThreshold: 0 rows in any *_totals table with a record count below 5; 0 columns in them outside month, category, region, currency, record_count, net_amount, tax_amount\n\nTool: psql (a SQL check that fails on any row; or the same query as a dbt singular test)\n\n```sql\n-- every row returned is a failure\nselect 'group of fewer than 5 records' as problem, category || ' ' || month::text as detail\nfrom invoice_totals\nwhere record_count < 5\nunion all\nselect 'column that may identify someone', table_name || '.' || column_name\nfrom information_schema.columns\nwhere table_schema = 'public' and table_name like '%\\_totals'\n and column_name not in ('month', 'category', 'region', 'currency', 'record_count', 'net_amount', 'tax_amount');\n```",
|
|
1056
|
+
"hubWhen": {
|
|
1057
|
+
"SCHEDULE": [
|
|
1058
|
+
"file",
|
|
1059
|
+
"tool"
|
|
1060
|
+
],
|
|
1061
|
+
"DELETE": [
|
|
1062
|
+
"aggregate"
|
|
1063
|
+
]
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
],
|
|
1067
|
+
"relations": [
|
|
1068
|
+
{
|
|
1069
|
+
"id": "req-schedule--derives--need",
|
|
1070
|
+
"sourceId": "req-schedule",
|
|
1071
|
+
"targetId": "need",
|
|
1072
|
+
"relationType": "derives"
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
"id": "req-tool-mapping--derives--need",
|
|
1076
|
+
"sourceId": "req-tool-mapping",
|
|
1077
|
+
"targetId": "need",
|
|
1078
|
+
"relationType": "derives"
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
"id": "req-store-config--derives--need",
|
|
1082
|
+
"sourceId": "req-store-config",
|
|
1083
|
+
"targetId": "need",
|
|
1084
|
+
"relationType": "derives"
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
"id": "req-dispose--derives--need",
|
|
1088
|
+
"sourceId": "req-dispose",
|
|
1089
|
+
"targetId": "need",
|
|
1090
|
+
"relationType": "derives"
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
"id": "req-not-early--derives--need",
|
|
1094
|
+
"sourceId": "req-not-early",
|
|
1095
|
+
"targetId": "need",
|
|
1096
|
+
"relationType": "derives"
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
"id": "req-fail-closed--derives--need",
|
|
1100
|
+
"sourceId": "req-fail-closed",
|
|
1101
|
+
"targetId": "need",
|
|
1102
|
+
"relationType": "derives"
|
|
1103
|
+
},
|
|
1104
|
+
{
|
|
1105
|
+
"id": "req-overdue--derives--need",
|
|
1106
|
+
"sourceId": "req-overdue",
|
|
1107
|
+
"targetId": "need",
|
|
1108
|
+
"relationType": "derives"
|
|
1109
|
+
},
|
|
1110
|
+
{
|
|
1111
|
+
"id": "req-hold--derives--need",
|
|
1112
|
+
"sourceId": "req-hold",
|
|
1113
|
+
"targetId": "need",
|
|
1114
|
+
"relationType": "derives"
|
|
1115
|
+
},
|
|
1116
|
+
{
|
|
1117
|
+
"id": "req-hold-roles--derives--need",
|
|
1118
|
+
"sourceId": "req-hold-roles",
|
|
1119
|
+
"targetId": "need",
|
|
1120
|
+
"relationType": "derives"
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"id": "req-hold-store--derives--need",
|
|
1124
|
+
"sourceId": "req-hold-store",
|
|
1125
|
+
"targetId": "need",
|
|
1126
|
+
"relationType": "derives"
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
"id": "req-conflict-restrict--derives--need",
|
|
1130
|
+
"sourceId": "req-conflict-restrict",
|
|
1131
|
+
"targetId": "need",
|
|
1132
|
+
"relationType": "derives"
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
"id": "req-conflict-pseudo--derives--need",
|
|
1136
|
+
"sourceId": "req-conflict-pseudo",
|
|
1137
|
+
"targetId": "need",
|
|
1138
|
+
"relationType": "derives"
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
"id": "req-shred--derives--need",
|
|
1142
|
+
"sourceId": "req-shred",
|
|
1143
|
+
"targetId": "need",
|
|
1144
|
+
"relationType": "derives"
|
|
1145
|
+
},
|
|
1146
|
+
{
|
|
1147
|
+
"id": "req-aggregate--derives--need",
|
|
1148
|
+
"sourceId": "req-aggregate",
|
|
1149
|
+
"targetId": "need",
|
|
1150
|
+
"relationType": "derives"
|
|
1151
|
+
},
|
|
1152
|
+
{
|
|
1153
|
+
"id": "sc-schedule--verifies--req-schedule",
|
|
1154
|
+
"sourceId": "sc-schedule",
|
|
1155
|
+
"targetId": "req-schedule",
|
|
1156
|
+
"relationType": "verifies"
|
|
1157
|
+
},
|
|
1158
|
+
{
|
|
1159
|
+
"id": "sc-tool-mapping--verifies--req-tool-mapping",
|
|
1160
|
+
"sourceId": "sc-tool-mapping",
|
|
1161
|
+
"targetId": "req-tool-mapping",
|
|
1162
|
+
"relationType": "verifies"
|
|
1163
|
+
},
|
|
1164
|
+
{
|
|
1165
|
+
"id": "sc-store-config--verifies--req-store-config",
|
|
1166
|
+
"sourceId": "sc-store-config",
|
|
1167
|
+
"targetId": "req-store-config",
|
|
1168
|
+
"relationType": "verifies"
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
"id": "sc-dispose--verifies--req-dispose",
|
|
1172
|
+
"sourceId": "sc-dispose",
|
|
1173
|
+
"targetId": "req-dispose",
|
|
1174
|
+
"relationType": "verifies"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
"id": "sc-not-early--verifies--req-not-early",
|
|
1178
|
+
"sourceId": "sc-not-early",
|
|
1179
|
+
"targetId": "req-not-early",
|
|
1180
|
+
"relationType": "verifies"
|
|
1181
|
+
},
|
|
1182
|
+
{
|
|
1183
|
+
"id": "sc-fail-closed--verifies--req-fail-closed",
|
|
1184
|
+
"sourceId": "sc-fail-closed",
|
|
1185
|
+
"targetId": "req-fail-closed",
|
|
1186
|
+
"relationType": "verifies"
|
|
1187
|
+
},
|
|
1188
|
+
{
|
|
1189
|
+
"id": "sc-overdue--verifies--req-overdue",
|
|
1190
|
+
"sourceId": "sc-overdue",
|
|
1191
|
+
"targetId": "req-overdue",
|
|
1192
|
+
"relationType": "verifies"
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
"id": "sc-hold--verifies--req-hold",
|
|
1196
|
+
"sourceId": "sc-hold",
|
|
1197
|
+
"targetId": "req-hold",
|
|
1198
|
+
"relationType": "verifies"
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
"id": "sc-hold-roles--verifies--req-hold-roles",
|
|
1202
|
+
"sourceId": "sc-hold-roles",
|
|
1203
|
+
"targetId": "req-hold-roles",
|
|
1204
|
+
"relationType": "verifies"
|
|
1205
|
+
},
|
|
1206
|
+
{
|
|
1207
|
+
"id": "sc-hold-store--verifies--req-hold-store",
|
|
1208
|
+
"sourceId": "sc-hold-store",
|
|
1209
|
+
"targetId": "req-hold-store",
|
|
1210
|
+
"relationType": "verifies"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"id": "sc-conflict-restrict--verifies--req-conflict-restrict",
|
|
1214
|
+
"sourceId": "sc-conflict-restrict",
|
|
1215
|
+
"targetId": "req-conflict-restrict",
|
|
1216
|
+
"relationType": "verifies"
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
"id": "sc-conflict-pseudo--verifies--req-conflict-pseudo",
|
|
1220
|
+
"sourceId": "sc-conflict-pseudo",
|
|
1221
|
+
"targetId": "req-conflict-pseudo",
|
|
1222
|
+
"relationType": "verifies"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
"id": "sc-shred--verifies--req-shred",
|
|
1226
|
+
"sourceId": "sc-shred",
|
|
1227
|
+
"targetId": "req-shred",
|
|
1228
|
+
"relationType": "verifies"
|
|
1229
|
+
},
|
|
1230
|
+
{
|
|
1231
|
+
"id": "sc-aggregate--verifies--req-aggregate",
|
|
1232
|
+
"sourceId": "sc-aggregate",
|
|
1233
|
+
"targetId": "req-aggregate",
|
|
1234
|
+
"relationType": "verifies"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"id": "ff-coverage--implements--adr-file",
|
|
1238
|
+
"sourceId": "ff-coverage",
|
|
1239
|
+
"targetId": "adr-file",
|
|
1240
|
+
"relationType": "implements"
|
|
1241
|
+
},
|
|
1242
|
+
{
|
|
1243
|
+
"id": "ff-tool-mapping--implements--adr-tool",
|
|
1244
|
+
"sourceId": "ff-tool-mapping",
|
|
1245
|
+
"targetId": "adr-tool",
|
|
1246
|
+
"relationType": "implements"
|
|
1247
|
+
},
|
|
1248
|
+
{
|
|
1249
|
+
"id": "ff-store-config--implements--adr-store",
|
|
1250
|
+
"sourceId": "ff-store-config",
|
|
1251
|
+
"targetId": "adr-store",
|
|
1252
|
+
"relationType": "implements"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
"id": "ff-bucket-lifecycle--implements--adr-file",
|
|
1256
|
+
"sourceId": "ff-bucket-lifecycle",
|
|
1257
|
+
"targetId": "adr-file",
|
|
1258
|
+
"relationType": "implements"
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
"id": "ff-bucket-lifecycle--implements--adr-tool",
|
|
1262
|
+
"sourceId": "ff-bucket-lifecycle",
|
|
1263
|
+
"targetId": "adr-tool",
|
|
1264
|
+
"relationType": "implements"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
"id": "ff-bucket-lifecycle--implements--adr-store",
|
|
1268
|
+
"sourceId": "ff-bucket-lifecycle",
|
|
1269
|
+
"targetId": "adr-store",
|
|
1270
|
+
"relationType": "implements"
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
"id": "ff-bucket-lifecycle--implements--adr-no-hold",
|
|
1274
|
+
"sourceId": "ff-bucket-lifecycle",
|
|
1275
|
+
"targetId": "adr-no-hold",
|
|
1276
|
+
"relationType": "implements"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"id": "ff-disposal-job--implements--adr-file",
|
|
1280
|
+
"sourceId": "ff-disposal-job",
|
|
1281
|
+
"targetId": "adr-file",
|
|
1282
|
+
"relationType": "implements"
|
|
1283
|
+
},
|
|
1284
|
+
{
|
|
1285
|
+
"id": "ff-disposal-job--implements--adr-tool",
|
|
1286
|
+
"sourceId": "ff-disposal-job",
|
|
1287
|
+
"targetId": "adr-tool",
|
|
1288
|
+
"relationType": "implements"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
"id": "ff-disposal-job--implements--adr-hard",
|
|
1292
|
+
"sourceId": "ff-disposal-job",
|
|
1293
|
+
"targetId": "adr-hard",
|
|
1294
|
+
"relationType": "implements"
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
"id": "ff-disposal-job--implements--adr-shred",
|
|
1298
|
+
"sourceId": "ff-disposal-job",
|
|
1299
|
+
"targetId": "adr-shred",
|
|
1300
|
+
"relationType": "implements"
|
|
1301
|
+
},
|
|
1302
|
+
{
|
|
1303
|
+
"id": "ff-disposal-job--implements--adr-aggregate",
|
|
1304
|
+
"sourceId": "ff-disposal-job",
|
|
1305
|
+
"targetId": "adr-aggregate",
|
|
1306
|
+
"relationType": "implements"
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
"id": "ff-overdue--implements--adr-file",
|
|
1310
|
+
"sourceId": "ff-overdue",
|
|
1311
|
+
"targetId": "adr-file",
|
|
1312
|
+
"relationType": "implements"
|
|
1313
|
+
},
|
|
1314
|
+
{
|
|
1315
|
+
"id": "ff-overdue--implements--adr-tool",
|
|
1316
|
+
"sourceId": "ff-overdue",
|
|
1317
|
+
"targetId": "adr-tool",
|
|
1318
|
+
"relationType": "implements"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
"id": "ff-overdue--implements--adr-no-hold",
|
|
1322
|
+
"sourceId": "ff-overdue",
|
|
1323
|
+
"targetId": "adr-no-hold",
|
|
1324
|
+
"relationType": "implements"
|
|
1325
|
+
},
|
|
1326
|
+
{
|
|
1327
|
+
"id": "ff-no-early-delete--implements--adr-file",
|
|
1328
|
+
"sourceId": "ff-no-early-delete",
|
|
1329
|
+
"targetId": "adr-file",
|
|
1330
|
+
"relationType": "implements"
|
|
1331
|
+
},
|
|
1332
|
+
{
|
|
1333
|
+
"id": "ff-no-early-delete--implements--adr-tool",
|
|
1334
|
+
"sourceId": "ff-no-early-delete",
|
|
1335
|
+
"targetId": "adr-tool",
|
|
1336
|
+
"relationType": "implements"
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
"id": "ff-no-early-delete--implements--adr-store",
|
|
1340
|
+
"sourceId": "ff-no-early-delete",
|
|
1341
|
+
"targetId": "adr-store",
|
|
1342
|
+
"relationType": "implements"
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
"id": "ff-hold--implements--adr-hold",
|
|
1346
|
+
"sourceId": "ff-hold",
|
|
1347
|
+
"targetId": "adr-hold",
|
|
1348
|
+
"relationType": "implements"
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
"id": "ff-hold-store--implements--adr-hold",
|
|
1352
|
+
"sourceId": "ff-hold-store",
|
|
1353
|
+
"targetId": "adr-hold",
|
|
1354
|
+
"relationType": "implements"
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
"id": "ff-conflict--implements--adr-file",
|
|
1358
|
+
"sourceId": "ff-conflict",
|
|
1359
|
+
"targetId": "adr-file",
|
|
1360
|
+
"relationType": "implements"
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
"id": "ff-conflict--implements--adr-tool",
|
|
1364
|
+
"sourceId": "ff-conflict",
|
|
1365
|
+
"targetId": "adr-tool",
|
|
1366
|
+
"relationType": "implements"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
"id": "ff-conflict--implements--adr-store",
|
|
1370
|
+
"sourceId": "ff-conflict",
|
|
1371
|
+
"targetId": "adr-store",
|
|
1372
|
+
"relationType": "implements"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
"id": "ff-conflict--implements--adr-restrict",
|
|
1376
|
+
"sourceId": "ff-conflict",
|
|
1377
|
+
"targetId": "adr-restrict",
|
|
1378
|
+
"relationType": "implements"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
"id": "ff-conflict--implements--adr-pseudonymise",
|
|
1382
|
+
"sourceId": "ff-conflict",
|
|
1383
|
+
"targetId": "adr-pseudonymise",
|
|
1384
|
+
"relationType": "implements"
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
"id": "ff-shred-keys--implements--adr-shred",
|
|
1388
|
+
"sourceId": "ff-shred-keys",
|
|
1389
|
+
"targetId": "adr-shred",
|
|
1390
|
+
"relationType": "implements"
|
|
1391
|
+
},
|
|
1392
|
+
{
|
|
1393
|
+
"id": "ff-aggregates--implements--adr-aggregate",
|
|
1394
|
+
"sourceId": "ff-aggregates",
|
|
1395
|
+
"targetId": "adr-aggregate",
|
|
1396
|
+
"relationType": "implements"
|
|
1397
|
+
}
|
|
1398
|
+
]
|
|
1399
|
+
}
|