@radicaltools/cli 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/{chunk-SBQRTX3Y.js → chunk-5EK2V6G3.js} +1 -1
  2. package/dist/{dist-LSHMW73I.js → dist-BJQ35APN.js} +2 -2
  3. package/dist/hub-catalogue/concern/concern-accessibility.radical +85 -1
  4. package/dist/hub-catalogue/concern/concern-api-collections.radical +78 -1
  5. package/dist/hub-catalogue/concern/concern-api-errors.radical +78 -1
  6. package/dist/hub-catalogue/concern/concern-api-evolution.radical +78 -1
  7. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +121 -3
  8. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +78 -1
  9. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +78 -1
  10. package/dist/hub-catalogue/concern/concern-architecture-style.radical +83 -7
  11. package/dist/hub-catalogue/concern/concern-audit-trail.radical +77 -1
  12. package/dist/hub-catalogue/concern/concern-authentication.radical +178 -8
  13. package/dist/hub-catalogue/concern/concern-authorization.radical +133 -7
  14. package/dist/hub-catalogue/concern/concern-availability.radical +156 -6
  15. package/dist/hub-catalogue/concern/concern-backend-stack.radical +71 -8
  16. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +136 -6
  17. package/dist/hub-catalogue/concern/concern-caching.radical +73 -1
  18. package/dist/hub-catalogue/concern/concern-capacity.radical +124 -5
  19. package/dist/hub-catalogue/concern/concern-ci-cd-pipeline.radical +154 -15
  20. package/dist/hub-catalogue/concern/concern-code-documentation.radical +131 -13
  21. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +116 -7
  22. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +174 -13
  23. package/dist/hub-catalogue/concern/concern-code-style.radical +148 -16
  24. package/dist/hub-catalogue/concern/concern-communication-style.radical +94 -7
  25. package/dist/hub-catalogue/concern/concern-data-classification.radical +77 -1
  26. package/dist/hub-catalogue/concern/concern-data-consistency.radical +87 -5
  27. package/dist/hub-catalogue/concern/concern-data-store.radical +87 -5
  28. package/dist/hub-catalogue/concern/concern-decomposition.radical +78 -1
  29. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +150 -11
  30. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +130 -5
  31. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +127 -10
  32. package/dist/hub-catalogue/concern/concern-deployment.radical +113 -9
  33. package/dist/hub-catalogue/concern/concern-encryption.radical +146 -5
  34. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +118 -12
  35. package/dist/hub-catalogue/concern/concern-eu-dora.radical +69 -1
  36. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +148 -9
  37. package/dist/hub-catalogue/concern/concern-incident-management.radical +122 -1
  38. package/dist/hub-catalogue/concern/concern-infrastructure.radical +54 -1
  39. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +110 -5
  40. package/dist/hub-catalogue/concern/concern-messaging.radical +89 -2
  41. package/dist/hub-catalogue/concern/concern-mobile-performance.radical +67 -1
  42. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +92 -5
  43. package/dist/hub-catalogue/concern/concern-observability.radical +105 -1
  44. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +140 -5
  45. package/dist/hub-catalogue/concern/concern-personal-data.radical +206 -7
  46. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +104 -12
  47. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +110 -1
  48. package/dist/hub-catalogue/concern/concern-release-versioning.radical +99 -7
  49. package/dist/hub-catalogue/concern/concern-retention.radical +130 -9
  50. package/dist/hub-catalogue/concern/concern-secrets.radical +196 -12
  51. package/dist/hub-catalogue/concern/concern-secure-coding.radical +122 -1
  52. package/dist/hub-catalogue/concern/concern-secure-development.radical +118 -1
  53. package/dist/hub-catalogue/concern/concern-security-detection.radical +124 -1
  54. package/dist/hub-catalogue/concern/concern-supply-chain.radical +116 -1
  55. package/dist/hub-catalogue/concern/concern-technical-debt.radical +162 -19
  56. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +152 -18
  57. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +111 -1
  58. package/dist/hub-catalogue/concern/concern-test-strategy.radical +83 -7
  59. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +120 -1
  60. package/dist/hub-catalogue/concern/concern-usability.radical +84 -5
  61. package/dist/index.js +68 -18
  62. package/dist/{pdfjs-WWNLOMK2.js → pdfjs-4U3YUAVN.js} +1 -1
  63. package/dist/{undici-53QU2XSN.js → undici-7IHHEPSO.js} +1 -1
  64. package/package.json +1 -1
@@ -17,7 +17,102 @@
17
17
  "id": "retention",
18
18
  "trigger": "LIST NODES WHERE type = \"database\" AND external != true",
19
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"
20
+ "group": "compliance",
21
+ "scope": {
22
+ "group": "compliance",
23
+ "questions": [
24
+ {
25
+ "key": "PERSONAL",
26
+ "label": "What does it keep about people?",
27
+ "default": "ordinary",
28
+ "hint": "Any personal data brings the GDPR's duties; special categories or children bring more (Art. 9, WP248).",
29
+ "options": [
30
+ {
31
+ "value": "none",
32
+ "label": "nothing about people",
33
+ "description": "No personal data beyond staff sign-in."
34
+ },
35
+ {
36
+ "value": "ordinary",
37
+ "label": "ordinary personal data",
38
+ "description": "Names, e-mail addresses, phone numbers, orders, accounts."
39
+ },
40
+ {
41
+ "value": "special",
42
+ "label": "special categories or children",
43
+ "description": "Health, biometrics, genetic data, religion, politics, sexual orientation, union membership, criminal records, or data about children (GDPR Art. 9 and 10)."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "key": "REGULATION",
49
+ "label": "Which law or standard binds it most?",
50
+ "default": "none",
51
+ "hint": "Pick the most binding one; a lawyer settles the exceptions. This only says which packs to consider.",
52
+ "options": [
53
+ {
54
+ "value": "none",
55
+ "label": "none beyond the GDPR",
56
+ "description": "No sector law or payment standard applies."
57
+ },
58
+ {
59
+ "value": "cards",
60
+ "label": "card numbers on our own pages",
61
+ "description": "Card numbers are typed into pages we serve (PCI DSS beyond SAQ A); with a payment provider's hosted page or iframe, pick none."
62
+ },
63
+ {
64
+ "value": "finance",
65
+ "label": "EU financial services",
66
+ "description": "A bank, payment or e-money institution, investment firm, crypto-asset provider, insurer or pension fund in the EU, or an ICT supplier to one (DORA)."
67
+ },
68
+ {
69
+ "value": "health",
70
+ "label": "health records",
71
+ "description": "Patient or health records, or a supplier to a health provider or plan (HIPAA in the US)."
72
+ },
73
+ {
74
+ "value": "essential",
75
+ "label": "an essential sector",
76
+ "description": "Energy, transport, water, health, digital infrastructure, managed IT or security services, public administration, manufacturing, food and the like, with 50+ staff or €10M+ turnover (NIS2)."
77
+ }
78
+ ]
79
+ }
80
+ ],
81
+ "when": [
82
+ {
83
+ "PERSONAL": [
84
+ "ordinary",
85
+ "special"
86
+ ]
87
+ }
88
+ ]
89
+ },
90
+ "scopeAnswers": [
91
+ {
92
+ "when": {
93
+ "PERSONAL": [
94
+ "none",
95
+ "ordinary"
96
+ ],
97
+ "REGULATION": [
98
+ "none"
99
+ ]
100
+ },
101
+ "answers": {
102
+ "SCHEDULE": "store"
103
+ }
104
+ },
105
+ {
106
+ "when": {
107
+ "REGULATION": [
108
+ "none"
109
+ ]
110
+ },
111
+ "answers": {
112
+ "HOLD": "none"
113
+ }
114
+ }
115
+ ]
21
116
  },
22
117
  "sources": [
23
118
  {
@@ -150,7 +245,12 @@
150
245
  "label": "pseudonymisation of the kept records",
151
246
  "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
247
  }
153
- ]
248
+ ],
249
+ "scopeWhen": {
250
+ "PERSONAL": [
251
+ "special"
252
+ ]
253
+ }
154
254
  },
155
255
  {
156
256
  "key": "DISPOSE_DAYS",
@@ -265,7 +365,12 @@
265
365
  "ears_type": "unwanted-behaviour",
266
366
  "unwanted_condition": "an application, script or person other than disposal tries to delete or truncate records before their period ends",
267
367
  "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."
368
+ "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.",
369
+ "hubWhen": {
370
+ "HOLD": [
371
+ "flag"
372
+ ]
373
+ }
269
374
  },
270
375
  {
271
376
  "id": "req-fail-closed",
@@ -489,7 +594,12 @@
489
594
  "y": 520,
490
595
  "given": "the application's database role",
491
596
  "when": "it deletes a row from the invoices table",
492
- "then": "the database refuses it with a permission error"
597
+ "then": "the database refuses it with a permission error",
598
+ "hubWhen": {
599
+ "HOLD": [
600
+ "flag"
601
+ ]
602
+ }
493
603
  },
494
604
  {
495
605
  "id": "sc-fail-closed",
@@ -653,7 +763,7 @@
653
763
  "status": "accepted",
654
764
  "date": "",
655
765
  "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}}.",
766
+ "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}}.",
657
767
  "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
768
  "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
769
  "hubWhen": {
@@ -672,7 +782,7 @@
672
782
  "status": "accepted",
673
783
  "date": "",
674
784
  "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}}.",
785
+ "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}}.",
676
786
  "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
787
  "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
788
  "hubWhen": {
@@ -691,7 +801,7 @@
691
801
  "status": "accepted",
692
802
  "date": "",
693
803
  "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}}.",
804
+ "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}}.",
695
805
  "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
806
  "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
807
  "hubWhen": {
@@ -961,7 +1071,12 @@
961
1071
  "cadence": "triggered",
962
1072
  "trigger": "pull-request",
963
1073
  "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```"
1074
+ "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```",
1075
+ "hubWhen": {
1076
+ "HOLD": [
1077
+ "flag"
1078
+ ]
1079
+ }
965
1080
  },
966
1081
  {
967
1082
  "id": "ff-hold",
@@ -1017,7 +1132,13 @@
1017
1132
  "cadence": "triggered",
1018
1133
  "trigger": "pull-request",
1019
1134
  "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```"
1135
+ "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```",
1136
+ "hubWhen": {
1137
+ "CONFLICT": [
1138
+ "restrict",
1139
+ "pseudonymise"
1140
+ ]
1141
+ }
1021
1142
  },
1022
1143
  {
1023
1144
  "id": "ff-shred-keys",
@@ -17,7 +17,121 @@
17
17
  "trigger": "LIST RELATIONS WHERE source.external != true AND (target.type = \"database\" OR target.type = \"queue\" OR target.external = true) AND (source.type = \"system\" OR source.type = \"container\" OR source.type = \"webapp\" OR source.type = \"component\")",
18
18
  "applyTo": "source",
19
19
  "why": "these elements use credentials for databases, queues or outside systems, so where those are kept, who sees them and how they change has to be decided.",
20
- "group": "security"
20
+ "group": "security",
21
+ "scope": {
22
+ "group": "security",
23
+ "questions": [
24
+ {
25
+ "key": "EXPOSURE",
26
+ "label": "Who can reach it?",
27
+ "default": "customers",
28
+ "hint": "The more strangers can reach it, the more attacks it meets that need no inside knowledge (Microsoft SDL asks this first).",
29
+ "options": [
30
+ {
31
+ "value": "staff",
32
+ "label": "only our own staff",
33
+ "description": "An internal system: everyone who reaches it works for the organisation that runs it, from its network or with its accounts."
34
+ },
35
+ {
36
+ "value": "customers",
37
+ "label": "our customers and staff",
38
+ "description": "People who come to us for a service (to book, order, pay, look something up) and our staff; there is no open sign-up, community or API for strangers."
39
+ },
40
+ {
41
+ "value": "public",
42
+ "label": "anyone, at scale",
43
+ "description": "Open sign-up, a public API, content anyone can post, or so many users that bots and automated abuse come with them."
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "key": "DATA",
49
+ "label": "What would a leak of its data harm?",
50
+ "default": "ordinary",
51
+ "hint": "The most sensitive data it keeps decides (FIPS 199 confidentiality; GDPR Art. 9 for special categories).",
52
+ "options": [
53
+ {
54
+ "value": "none",
55
+ "label": "nothing: nothing private",
56
+ "description": "Public information only, and staff sign-in."
57
+ },
58
+ {
59
+ "value": "ordinary",
60
+ "label": "little: ordinary personal or business data",
61
+ "description": "Names, e-mail addresses, orders, ordinary business documents: a leak is unpleasant, not ruinous."
62
+ },
63
+ {
64
+ "value": "confidential",
65
+ "label": "a lot: confidential data",
66
+ "description": "Financial or account data, identity numbers, location, private messages, trade secrets or customer lists: a leak seriously harms people or the business."
67
+ },
68
+ {
69
+ "value": "special",
70
+ "label": "people deeply: special categories",
71
+ "description": "Health, biometrics, genetic data, religion, politics, sexual orientation, union membership, criminal records, or children's data (GDPR Art. 9 and 10)."
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "key": "TENANCY",
77
+ "label": "How many customer organisations does one running copy serve?",
78
+ "default": "one",
79
+ "hint": "Several organisations in one deployment means one missed filter shows one customer another's data (AWS SaaS Lens).",
80
+ "options": [
81
+ {
82
+ "value": "one",
83
+ "label": "one organisation",
84
+ "description": "It serves one organisation (a shop, a company, a public body), however many people use it."
85
+ },
86
+ {
87
+ "value": "shared",
88
+ "label": "several, sharing",
89
+ "description": "Several customer organisations (tenants) share the same deployment and data stores, kept apart by the software."
90
+ },
91
+ {
92
+ "value": "separate",
93
+ "label": "several, each its own",
94
+ "description": "Several customer organisations, each with its own database or its own copy of the system."
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "key": "CAPACITY",
100
+ "label": "Who looks after its IT and security?",
101
+ "default": "ig1",
102
+ "hint": "What an organisation can run decides how much security practice it can keep up (CIS Controls Implementation Groups 1 to 3).",
103
+ "options": [
104
+ {
105
+ "value": "ig1",
106
+ "label": "the people who build it",
107
+ "description": "A few people who build it; nobody works on IT or security full time (CIS IG1)."
108
+ },
109
+ {
110
+ "value": "ig2",
111
+ "label": "people who run IT",
112
+ "description": "There are people whose job includes running and protecting the infrastructure; several departments rely on it (CIS IG2)."
113
+ },
114
+ {
115
+ "value": "ig3",
116
+ "label": "security specialists",
117
+ "description": "A security team or specialists of their own (security operations, penetration testers), under regulators' eyes (CIS IG3)."
118
+ }
119
+ ]
120
+ }
121
+ ]
122
+ },
123
+ "scopeAnswers": [
124
+ {
125
+ "when": {
126
+ "CAPACITY": [
127
+ "ig1"
128
+ ]
129
+ },
130
+ "answers": {
131
+ "SCANNING": "ci"
132
+ }
133
+ }
134
+ ]
21
135
  },
22
136
  "sources": [
23
137
  {
@@ -83,7 +197,13 @@
83
197
  "label": "by a person following a runbook",
84
198
  "description": "An owner rotates on a schedule, reminded by an alert, following written steps. Pick it for keys an outside system issues by hand (a partner portal, a payment provider), for credentials set by the deployment, or when the store cannot rotate them."
85
199
  }
86
- ]
200
+ ],
201
+ "scopeWhen": {
202
+ "CAPACITY": [
203
+ "ig2",
204
+ "ig3"
205
+ ]
206
+ }
87
207
  },
88
208
  {
89
209
  "key": "ACCESS",
@@ -107,7 +227,13 @@
107
227
  "label": "the owning team",
108
228
  "description": "Members of the team that owns the element can read its secrets, every read logged. Pick it for a small team without a second approver at hand, and accept rotating on every departure."
109
229
  }
110
- ]
230
+ ],
231
+ "scopeWhen": {
232
+ "CAPACITY": [
233
+ "ig2",
234
+ "ig3"
235
+ ]
236
+ }
111
237
  },
112
238
  {
113
239
  "key": "SCANNING",
@@ -176,7 +302,14 @@
176
302
  "y": 130,
177
303
  "ears_type": "ubiquitous",
178
304
  "action": "use credentials of its own in each environment, with only the rights it needs, shared with no other element and no person",
179
- "rationale": "A leak then reaches one element in one environment, with only what it may do; a shared credential cannot be revoked without stopping everyone who uses it (ASVS 1.2.1, 2.10.1; OWASP Secrets Management Cheat Sheet: Access Control)."
305
+ "rationale": "A leak then reaches one element in one environment, with only what it may do; a shared credential cannot be revoked without stopping everyone who uses it (ASVS 1.2.1, 2.10.1; OWASP Secrets Management Cheat Sheet: Access Control).",
306
+ "hubWhen": {
307
+ "ACCESS": [
308
+ "breakglass",
309
+ "jit",
310
+ "team"
311
+ ]
312
+ }
180
313
  },
181
314
  {
182
315
  "id": "req-leak",
@@ -188,7 +321,13 @@
188
321
  "trigger": "a credential is found exposed (a scanner finding, a provider's leak notice, a report or a lost device)",
189
322
  "action": "revoke it within {{REVOKE_MINUTES}} minutes, put a new one in place without downtime, rotate the credentials kept beside it, and review every use of it since the exposure in the store's and the target's logs",
190
323
  "rationale": "Exposed credentials are found and used by automated scanners soon after they appear; a practised revocation is the only bound on the damage (OWASP Secrets Management Cheat Sheet: Incident Response, Revocation).",
191
- "unchecked": "a leak drill the element's owner runs once a quarter on a staging credential, timed against {{REVOKE_MINUTES}} minutes and recorded; no tool can run it."
324
+ "unchecked": "a leak drill the element's owner runs once a quarter on a staging credential, timed against {{REVOKE_MINUTES}} minutes and recorded; no tool can run it.",
325
+ "hubWhen": {
326
+ "ROTATION": [
327
+ "automatic",
328
+ "runbook"
329
+ ]
330
+ }
192
331
  },
193
332
  {
194
333
  "id": "req-audit",
@@ -198,7 +337,14 @@
198
337
  "y": 390,
199
338
  "ears_type": "ubiquitous",
200
339
  "action": "record every read and change of a production secret by a person, with who, when, which secret and the approval, keep the records for at least 12 months, and never record the secret's value",
201
- "rationale": "After a leak, the record of who could and did read the secret decides what has to be rotated and who has to be asked (ASVS 6.4.1, 7.1.1)."
340
+ "rationale": "After a leak, the record of who could and did read the secret decides what has to be rotated and who has to be asked (ASVS 6.4.1, 7.1.1).",
341
+ "hubWhen": {
342
+ "ACCESS": [
343
+ "breakglass",
344
+ "jit",
345
+ "team"
346
+ ]
347
+ }
202
348
  },
203
349
  {
204
350
  "id": "req-manager",
@@ -409,7 +555,14 @@
409
555
  "y": 130,
410
556
  "given": "the secrets every workload of the system may read",
411
557
  "when": "they are listed per workload",
412
- "then": "no secret is readable by two workloads, and none by a wildcard"
558
+ "then": "no secret is readable by two workloads, and none by a wildcard",
559
+ "hubWhen": {
560
+ "ACCESS": [
561
+ "breakglass",
562
+ "jit",
563
+ "team"
564
+ ]
565
+ }
413
566
  },
414
567
  {
415
568
  "id": "sc-leak",
@@ -419,7 +572,13 @@
419
572
  "y": 260,
420
573
  "given": "a production credential reported as pasted in a public place",
421
574
  "when": "the leak runbook is followed",
422
- "then": "within {{REVOKE_MINUTES}} minutes the credential no longer works, the element runs on its replacement with no failed requests, and its uses since the exposure are listed"
575
+ "then": "within {{REVOKE_MINUTES}} minutes the credential no longer works, the element runs on its replacement with no failed requests, and its uses since the exposure are listed",
576
+ "hubWhen": {
577
+ "ROTATION": [
578
+ "automatic",
579
+ "runbook"
580
+ ]
581
+ }
423
582
  },
424
583
  {
425
584
  "id": "sc-audit",
@@ -429,7 +588,14 @@
429
588
  "y": 390,
430
589
  "given": "a production secret",
431
590
  "when": "a person reads it and changes it",
432
- "then": "the audit log holds both events with person, time, secret name and approval, and not the value"
591
+ "then": "the audit log holds both events with person, time, secret name and approval, and not the value",
592
+ "hubWhen": {
593
+ "ACCESS": [
594
+ "breakglass",
595
+ "jit",
596
+ "team"
597
+ ]
598
+ }
433
599
  },
434
600
  {
435
601
  "id": "sc-manager",
@@ -621,7 +787,7 @@
621
787
  "status": "accepted",
622
788
  "date": "",
623
789
  "context": "This element uses credentials (passwords, API keys, tokens, certificates) to reach databases and outside systems. The forces: credentials put in code, images, build logs or tickets are copied far more widely than anyone tracks, and git history keeps them after they are deleted; a credential shared between elements widens every leak; one that is never changed stays valid after the people who saw it have left; a person who can read every production secret is a target in their own right; and when one leaks it has to be revoked in minutes, without stopping the system and without guessing where else it was used. Snippets assume Kubernetes manifests rendered under manifests/ (workloads labelled app.kubernetes.io/part-of=shop in the production namespace), Terraform under infra/ read with terraform show -json, AWS as the platform where one is named, and GitHub as the code host.",
624
- "decision": "Credentials are kept in a secrets manager and read at run time with the element's own platform identity; each element has its own in each environment, with only the rights it needs. Rotation: {{ROTATION}}, at least every {{ROTATE_DAYS}} days; an exposed credential stops working within {{REVOKE_MINUTES}} minutes. Production secrets may be read by {{ACCESS}}. Leaked credentials are caught {{SCANNING}}. Choosing the manager: the one the platform offers (AWS Secrets Manager, Azure Key Vault, Google Secret Manager) when the system runs on one cloud; HashiCorp Vault or OpenBao when it spans clouds or on-premises, or needs dynamic database credentials; judge by rotation support for the databases used, audit log export and cost per secret and per call.",
790
+ "decision": "Credentials are kept in a secrets manager and read at run time with the element's own platform identity; each element has its own in each environment, with only the rights it needs. Stored credentials are rotated at least every {{ROTATE_DAYS}} days; an exposed credential stops working within {{REVOKE_MINUTES}} minutes. Leaked credentials are caught {{SCANNING}}. Choosing the manager: the one the platform offers (AWS Secrets Manager, Azure Key Vault, Google Secret Manager) when the system runs on one cloud; HashiCorp Vault or OpenBao when it spans clouds or on-premises, or needs dynamic database credentials; judge by rotation support for the databases used, audit log export and cost per secret and per call.",
625
791
  "consequences": "• One place to audit reads, rotate and revoke.\n• The secrets manager is on the start path: elements cache credentials in memory and survive its short outages.\n• Rotation needs elements that pick up a new credential without restarting, or rolling restarts.\n• Local development needs its own secrets, never copies of production ones.",
626
792
  "alternatives": "1. Workload identity: nothing stored at all, but every database and service used must accept it.\n2. Environment variables from the deployment: no extra service, but values leak into dumps and change only with a redeploy.\n3. Encrypted files in the repository (SOPS, git-crypt): versioned with the code, but every reader of the key reads every secret and history keeps old values.",
627
793
  "hubWhen": {
@@ -640,7 +806,7 @@
640
806
  "status": "accepted",
641
807
  "date": "",
642
808
  "context": "This element uses credentials (passwords, API keys, tokens, certificates) to reach databases and outside systems. The forces: credentials put in code, images, build logs or tickets are copied far more widely than anyone tracks, and git history keeps them after they are deleted; a credential shared between elements widens every leak; one that is never changed stays valid after the people who saw it have left; a person who can read every production secret is a target in their own right; and when one leaks it has to be revoked in minutes, without stopping the system and without guessing where else it was used. Snippets assume Kubernetes manifests rendered under manifests/ (workloads labelled app.kubernetes.io/part-of=shop in the production namespace), Terraform under infra/ read with terraform show -json, AWS as the platform where one is named, and GitHub as the code host.",
643
- "decision": "Elements authenticate with the platform's workload identity (IAM roles for service accounts, Azure managed identities, GCP workload identity federation, or SPIFFE/SPIRE across platforms) and get tokens that expire within an hour; no password or key is stored for databases and cloud services. Each identity has only the rights its element needs. Outside systems that need a static key are the exception: those keys live in the platform's secrets manager, on an allow-list, rotated at least every {{ROTATE_DAYS}} days ({{ROTATION}}, where the issuer allows it; a key a partner issues by hand follows its runbook). Exposed keys stop working within {{REVOKE_MINUTES}} minutes. Production secrets may be read by {{ACCESS}}. Leaked credentials are caught {{SCANNING}}.",
809
+ "decision": "Elements authenticate with the platform's workload identity (IAM roles for service accounts, Azure managed identities, GCP workload identity federation, or SPIFFE/SPIRE across platforms) and get tokens that expire within an hour; no password or key is stored for databases and cloud services. Each identity has only the rights its element needs. Outside systems that need a static key are the exception: those keys live in the platform's secrets manager, on an allow-list, rotated at least every {{ROTATE_DAYS}} days (automatically where the issuer allows it; a key a partner issues by hand follows its runbook). Exposed keys stop working within {{REVOKE_MINUTES}} minutes. Leaked credentials are caught {{SCANNING}}.",
644
810
  "consequences": "• Nothing long-lived to leak or rotate for databases and cloud services.\n• Needs support in the platform and in every database and service used; some (older drivers, third-party SaaS) do not have it.\n• Local development needs identities of its own, for example per developer through the cloud CLI.\n• Rights are reviewed in the platform's policies, which become as important as the code.",
645
811
  "alternatives": "1. A secrets manager for every credential: works with anything, but every credential is a stored secret to rotate.\n2. Environment variables from the deployment: simplest, and the weakest.",
646
812
  "hubWhen": {
@@ -659,7 +825,7 @@
659
825
  "status": "accepted",
660
826
  "date": "",
661
827
  "context": "This element uses credentials (passwords, API keys, tokens, certificates) to reach databases and outside systems. The forces: credentials put in code, images, build logs or tickets are copied far more widely than anyone tracks, and git history keeps them after they are deleted; a credential shared between elements widens every leak; one that is never changed stays valid after the people who saw it have left; a person who can read every production secret is a target in their own right; and when one leaks it has to be revoked in minutes, without stopping the system and without guessing where else it was used. Snippets assume Kubernetes manifests rendered under manifests/ (workloads labelled app.kubernetes.io/part-of=shop in the production namespace), Terraform under infra/ read with terraform show -json, AWS as the platform where one is named, and GitHub as the code host.",
662
- "decision": "Credentials are kept encrypted in the deployment's store (Kubernetes Secrets with encryption at rest, Sealed Secrets or SOPS-encrypted manifests, or the CI system's encrypted variables) and set as environment variables at start; each element has its own, with only the rights it needs, and masks them in logs, crash reports and diagnostics. Rotation: {{ROTATION}}, at least every {{ROTATE_DAYS}} days, with a rolling redeploy that records the rotation on the Secret; an exposed credential stops working within {{REVOKE_MINUTES}} minutes. Production secrets may be read by {{ACCESS}}. Leaked credentials are caught {{SCANNING}}. Move to a secrets manager when there are more than a handful of credentials or rotation by redeploy becomes a burden.",
828
+ "decision": "Credentials are kept encrypted in the deployment's store (Kubernetes Secrets with encryption at rest, Sealed Secrets or SOPS-encrypted manifests, or the CI system's encrypted variables) and set as environment variables at start; each element has its own, with only the rights it needs, and masks them in logs, crash reports and diagnostics. Stored credentials are rotated at least every {{ROTATE_DAYS}} days, with a rolling redeploy that records the rotation on the Secret; an exposed credential stops working within {{REVOKE_MINUTES}} minutes. Leaked credentials are caught {{SCANNING}}. Move to a secrets manager when there are more than a handful of credentials or rotation by redeploy becomes a burden.",
663
829
  "consequences": "• No extra service to run or pay for.\n• Values show in process listings, crash dumps and to anyone who can describe the deployment.\n• Rotation means a redeploy, and there is no central log of who read what beyond the platform's audit log.",
664
830
  "alternatives": "1. A secrets manager: central audit and rotation, one more service on the start path.\n2. Workload identity: nothing stored, needs platform and database support.",
665
831
  "hubWhen": {
@@ -738,6 +904,10 @@
738
904
  "STORE": [
739
905
  "manager",
740
906
  "identity"
907
+ ],
908
+ "ROTATION": [
909
+ "automatic",
910
+ "runbook"
741
911
  ]
742
912
  }
743
913
  },
@@ -813,6 +983,10 @@
813
983
  "hubWhen": {
814
984
  "STORE": [
815
985
  "env"
986
+ ],
987
+ "ROTATION": [
988
+ "automatic",
989
+ "runbook"
816
990
  ]
817
991
  }
818
992
  },
@@ -867,6 +1041,11 @@
867
1041
  "STORE": [
868
1042
  "manager",
869
1043
  "identity"
1044
+ ],
1045
+ "ACCESS": [
1046
+ "breakglass",
1047
+ "jit",
1048
+ "team"
870
1049
  ]
871
1050
  }
872
1051
  },
@@ -885,6 +1064,11 @@
885
1064
  "hubWhen": {
886
1065
  "STORE": [
887
1066
  "env"
1067
+ ],
1068
+ "ACCESS": [
1069
+ "breakglass",
1070
+ "jit",
1071
+ "team"
888
1072
  ]
889
1073
  }
890
1074
  },