@radicaltools/mcp 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/dist/{chunk-Z7THA3L5.js → chunk-2SZDTOYJ.js} +65 -33
- package/dist/{elkLayout-TAUBPPVN.js → elkLayout-VYJDCCIT.js} +1 -1
- 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 +1001 -230
- package/package.json +1 -1
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
{
|
|
63
63
|
"value": "env",
|
|
64
64
|
"label": "environment variables set by the deployment",
|
|
65
|
-
"description": "Values kept encrypted in the deployment's own store (Kubernetes Secrets with encryption at rest, Sealed Secrets, SOPS, the CI system's encrypted variables) and set at start. Pick it for a small system on a platform without a secrets manager; values show in process listings and crash dumps and
|
|
65
|
+
"description": "Values kept encrypted in the deployment's own store (Kubernetes Secrets with encryption at rest, Sealed Secrets, SOPS, the CI system's encrypted variables) and set at start. Pick it for a small system on a platform without a secrets manager; values show in process listings and crash dumps, and rotation is a redeploy by a person following a runbook, not by the store."
|
|
66
66
|
}
|
|
67
67
|
]
|
|
68
68
|
},
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
{
|
|
77
77
|
"value": "automatic",
|
|
78
78
|
"label": "automatically, by the store, with two valid versions during the switch",
|
|
79
|
-
"description": "The store creates the new credential, the element picks it up, and the old one is revoked only when nothing uses it (AWS Secrets Manager rotation, Vault database secrets engine, Key Vault rotation policies). Pick it when the store and the target (database, cloud API) support it, which most do."
|
|
79
|
+
"description": "The store creates the new credential, the element picks it up, and the old one is revoked only when nothing uses it (AWS Secrets Manager rotation, Vault database secrets engine, Key Vault rotation policies). Pick it when the store and the target (database, cloud API) support it, which most do. Not with environment variables set by the deployment: that store rotates nothing."
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
"value": "runbook",
|
|
83
83
|
"label": "by a person following a runbook",
|
|
84
|
-
"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) or when the store cannot rotate them."
|
|
84
|
+
"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
85
|
}
|
|
86
86
|
]
|
|
87
87
|
},
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
"x": 260,
|
|
166
166
|
"y": 0,
|
|
167
167
|
"ears_type": "ubiquitous",
|
|
168
|
-
"action": "keep no credential in source code, its git history, container images, infrastructure state, CI output or application logs, and
|
|
168
|
+
"action": "keep no credential in source code, its git history, container images, infrastructure state, CI output or application logs, and obtain each one at run time through {{STORE}}",
|
|
169
169
|
"rationale": "Repositories, images and logs are copied far more widely than anyone tracks, and history keeps a secret after it is deleted (ASVS 2.10.4, 7.1.1; OWASP Secrets Management Cheat Sheet: Centralize and Standardize, CI/CD)."
|
|
170
170
|
},
|
|
171
171
|
{
|
|
@@ -187,7 +187,8 @@
|
|
|
187
187
|
"ears_type": "event-driven",
|
|
188
188
|
"trigger": "a credential is found exposed (a scanner finding, a provider's leak notice, a report or a lost device)",
|
|
189
189
|
"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
|
-
"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)."
|
|
190
|
+
"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."
|
|
191
192
|
},
|
|
192
193
|
{
|
|
193
194
|
"id": "req-audit",
|
|
@@ -238,7 +239,7 @@
|
|
|
238
239
|
"y": 780,
|
|
239
240
|
"ears_type": "unwanted-behaviour",
|
|
240
241
|
"unwanted_condition": "the element logs its configuration, fails with a crash report or serves a diagnostic endpoint",
|
|
241
|
-
"action": "leave out or mask every variable that holds a credential
|
|
242
|
+
"action": "leave out or mask every variable that holds a credential",
|
|
242
243
|
"rationale": "Environment variables travel into crash dumps, debug pages and support bundles; masking is what keeps them from being logged (ASVS 7.1.1, 14.3.2; OWASP Secrets Management Cheat Sheet: Environment Variables).",
|
|
243
244
|
"hubWhen": {
|
|
244
245
|
"STORE": [
|
|
@@ -246,12 +247,27 @@
|
|
|
246
247
|
]
|
|
247
248
|
}
|
|
248
249
|
},
|
|
250
|
+
{
|
|
251
|
+
"id": "req-env-store",
|
|
252
|
+
"type": "requirement",
|
|
253
|
+
"label": "Deployment store encrypted",
|
|
254
|
+
"x": 260,
|
|
255
|
+
"y": 910,
|
|
256
|
+
"ears_type": "ubiquitous",
|
|
257
|
+
"action": "keep the values encrypted at rest in the deployment's store, so that the cluster's or the CI system's backing store never holds them in clear",
|
|
258
|
+
"rationale": "A Kubernetes Secret is base64, not encryption; without envelope encryption anyone with the etcd backup has every credential (OWASP Secrets Management Cheat Sheet: Kubernetes).",
|
|
259
|
+
"hubWhen": {
|
|
260
|
+
"STORE": [
|
|
261
|
+
"env"
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
},
|
|
249
265
|
{
|
|
250
266
|
"id": "req-rotate-auto",
|
|
251
267
|
"type": "requirement",
|
|
252
268
|
"label": "Rotation is automatic",
|
|
253
269
|
"x": 260,
|
|
254
|
-
"y":
|
|
270
|
+
"y": 1040,
|
|
255
271
|
"ears_type": "event-driven",
|
|
256
272
|
"trigger": "a stored credential is {{ROTATE_DAYS}} days old",
|
|
257
273
|
"action": "create its successor, switch every instance to it, and revoke the old one only when nothing uses it, with 0 failed requests",
|
|
@@ -267,7 +283,7 @@
|
|
|
267
283
|
"type": "requirement",
|
|
268
284
|
"label": "Overdue rotation alerted",
|
|
269
285
|
"x": 260,
|
|
270
|
-
"y":
|
|
286
|
+
"y": 1170,
|
|
271
287
|
"ears_type": "state-driven",
|
|
272
288
|
"precondition": "a stored credential is older than {{ROTATE_DAYS}} days",
|
|
273
289
|
"action": "alert its named owner every working day until it is rotated by the runbook, which states the steps, the order and how to roll back",
|
|
@@ -283,10 +299,10 @@
|
|
|
283
299
|
"type": "requirement",
|
|
284
300
|
"label": "People read via break-glass",
|
|
285
301
|
"x": 260,
|
|
286
|
-
"y":
|
|
287
|
-
"ears_type": "
|
|
288
|
-
"
|
|
289
|
-
"action": "allow it only through the break-glass procedure, after a second person approves, alert the security channel within 5 minutes, and rotate the secret within 24 hours",
|
|
302
|
+
"y": 1300,
|
|
303
|
+
"ears_type": "event-driven",
|
|
304
|
+
"trigger": "a person requests to read a production secret",
|
|
305
|
+
"action": "allow it only through the break-glass procedure, after a second person approves, alert the security channel within 5 minutes of the read, and rotate the secret within 24 hours",
|
|
290
306
|
"rationale": "With no standing human readers, a stolen laptop or a departure exposes nothing; the rotation afterwards makes the emergency read harmless (OWASP Secrets Management Cheat Sheet: Access Control).",
|
|
291
307
|
"hubWhen": {
|
|
292
308
|
"ACCESS": [
|
|
@@ -299,10 +315,10 @@
|
|
|
299
315
|
"type": "requirement",
|
|
300
316
|
"label": "Access granted just in time",
|
|
301
317
|
"x": 260,
|
|
302
|
-
"y":
|
|
318
|
+
"y": 1430,
|
|
303
319
|
"ears_type": "event-driven",
|
|
304
320
|
"trigger": "an on-call engineer requests read access to a production secret",
|
|
305
|
-
"action": "grant access to that one secret for at most 4 hours after a second person approves,
|
|
321
|
+
"action": "grant access to that one secret for at most 4 hours after a second person approves, withdraw it automatically when the time is up, and alert the security channel within 5 minutes of each read",
|
|
306
322
|
"rationale": "Access that ends by itself does not pile up; the approval puts a second pair of eyes on every read (OWASP Secrets Management Cheat Sheet: Access Control).",
|
|
307
323
|
"hubWhen": {
|
|
308
324
|
"ACCESS": [
|
|
@@ -315,11 +331,12 @@
|
|
|
315
331
|
"type": "requirement",
|
|
316
332
|
"label": "Rotated when people leave",
|
|
317
333
|
"x": 260,
|
|
318
|
-
"y":
|
|
334
|
+
"y": 1560,
|
|
319
335
|
"ears_type": "event-driven",
|
|
320
336
|
"trigger": "a person who could read the element's production secrets leaves the team",
|
|
321
337
|
"action": "withdraw their access the same day and rotate every secret they could read within 7 days",
|
|
322
338
|
"rationale": "Standing access means every former member still knows the secrets; rotating on departure is the price of that access (OWASP Secrets Management Cheat Sheet: Rotation, Access Control).",
|
|
339
|
+
"unchecked": "the leaver checklist the team lead runs on the day of each departure (access withdrawn, secrets rotated within 7 days), confirmed by the quarterly access review; departures are known to people, not to a tool.",
|
|
323
340
|
"hubWhen": {
|
|
324
341
|
"ACCESS": [
|
|
325
342
|
"team"
|
|
@@ -331,10 +348,10 @@
|
|
|
331
348
|
"type": "requirement",
|
|
332
349
|
"label": "Secrets refused at push",
|
|
333
350
|
"x": 260,
|
|
334
|
-
"y":
|
|
351
|
+
"y": 1690,
|
|
335
352
|
"ears_type": "unwanted-behaviour",
|
|
336
353
|
"unwanted_condition": "a push to the code host contains a credential",
|
|
337
|
-
"action": "refuse the push and name the file and line, and record any bypass with its reason for review within 1
|
|
354
|
+
"action": "refuse the push and name the file and line, and record any bypass with its reason for review within 1 day",
|
|
338
355
|
"rationale": "A secret refused before the push never reaches a shared copy and needs no rotation (GitHub Docs, push protection; OWASP Secrets Management Cheat Sheet: Detection).",
|
|
339
356
|
"hubWhen": {
|
|
340
357
|
"SCANNING": [
|
|
@@ -347,7 +364,7 @@
|
|
|
347
364
|
"type": "requirement",
|
|
348
365
|
"label": "Secrets block the merge",
|
|
349
366
|
"x": 260,
|
|
350
|
-
"y":
|
|
367
|
+
"y": 1820,
|
|
351
368
|
"ears_type": "unwanted-behaviour",
|
|
352
369
|
"unwanted_condition": "a pull request adds a credential in any of its commits",
|
|
353
370
|
"action": "fail its required check so that it cannot merge, and treat the credential as exposed",
|
|
@@ -363,10 +380,10 @@
|
|
|
363
380
|
"type": "requirement",
|
|
364
381
|
"label": "Leaks found within a day",
|
|
365
382
|
"x": 260,
|
|
366
|
-
"y":
|
|
383
|
+
"y": 1950,
|
|
367
384
|
"ears_type": "event-driven",
|
|
368
385
|
"trigger": "a credential is committed, built into an image or written to a CI log",
|
|
369
|
-
"action": "report it to the element's owner
|
|
386
|
+
"action": "report it to the element's owner by the next nightly scan, and have it revoked or recorded as a false positive before the scan after that",
|
|
370
387
|
"rationale": "A scheduled scan over the whole history finds what was there before scanning began; the deadline turns findings into revocations (OWASP Secrets Management Cheat Sheet: Detection).",
|
|
371
388
|
"hubWhen": {
|
|
372
389
|
"SCANNING": [
|
|
@@ -380,19 +397,19 @@
|
|
|
380
397
|
"label": "Repository clean",
|
|
381
398
|
"x": 520,
|
|
382
399
|
"y": 0,
|
|
383
|
-
"given": "the repository with its full history, the built images and the last
|
|
400
|
+
"given": "the repository with its full history, the built images and the last day of CI logs",
|
|
384
401
|
"when": "they are scanned with the secret scanner",
|
|
385
402
|
"then": "0 secrets are found outside the scanner's allow-list of test fixtures"
|
|
386
403
|
},
|
|
387
404
|
{
|
|
388
405
|
"id": "sc-own",
|
|
389
406
|
"type": "scenario",
|
|
390
|
-
"label": "
|
|
407
|
+
"label": "Nothing shared",
|
|
391
408
|
"x": 520,
|
|
392
409
|
"y": 130,
|
|
393
|
-
"given": "the
|
|
394
|
-
"when": "
|
|
395
|
-
"then": "
|
|
410
|
+
"given": "the secrets every workload of the system may read",
|
|
411
|
+
"when": "they are listed per workload",
|
|
412
|
+
"then": "no secret is readable by two workloads, and none by a wildcard"
|
|
396
413
|
},
|
|
397
414
|
{
|
|
398
415
|
"id": "sc-leak",
|
|
@@ -435,9 +452,9 @@
|
|
|
435
452
|
"label": "No stored secret",
|
|
436
453
|
"x": 520,
|
|
437
454
|
"y": 650,
|
|
438
|
-
"given": "the element's deployment manifests
|
|
439
|
-
"when": "
|
|
440
|
-
"then": "
|
|
455
|
+
"given": "the element's deployment manifests",
|
|
456
|
+
"when": "every reference to a Secret is listed",
|
|
457
|
+
"then": "only the allow-listed keys of outside systems appear; databases and cloud services are reached by the identity alone",
|
|
441
458
|
"hubWhen": {
|
|
442
459
|
"STORE": [
|
|
443
460
|
"identity"
|
|
@@ -459,12 +476,27 @@
|
|
|
459
476
|
]
|
|
460
477
|
}
|
|
461
478
|
},
|
|
479
|
+
{
|
|
480
|
+
"id": "sc-env-store",
|
|
481
|
+
"type": "scenario",
|
|
482
|
+
"label": "Store encrypted",
|
|
483
|
+
"x": 520,
|
|
484
|
+
"y": 910,
|
|
485
|
+
"given": "the production cluster",
|
|
486
|
+
"when": "its encryption configuration is read",
|
|
487
|
+
"then": "Secrets are listed among the resources encrypted with a KMS key",
|
|
488
|
+
"hubWhen": {
|
|
489
|
+
"STORE": [
|
|
490
|
+
"env"
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
},
|
|
462
494
|
{
|
|
463
495
|
"id": "sc-rotate-auto",
|
|
464
496
|
"type": "scenario",
|
|
465
497
|
"label": "Rotation without downtime",
|
|
466
498
|
"x": 520,
|
|
467
|
-
"y":
|
|
499
|
+
"y": 1040,
|
|
468
500
|
"given": "a credential {{ROTATE_DAYS}} days old and traffic flowing",
|
|
469
501
|
"when": "the store rotates it",
|
|
470
502
|
"then": "no request fails and the old credential is refused afterwards",
|
|
@@ -479,7 +511,7 @@
|
|
|
479
511
|
"type": "scenario",
|
|
480
512
|
"label": "Overdue key alerted",
|
|
481
513
|
"x": 520,
|
|
482
|
-
"y":
|
|
514
|
+
"y": 1170,
|
|
483
515
|
"given": "a partner API key created {{ROTATE_DAYS}} days ago",
|
|
484
516
|
"when": "the daily check runs",
|
|
485
517
|
"then": "the owner is alerted, and the alert stops once the key is replaced by following the runbook",
|
|
@@ -494,7 +526,7 @@
|
|
|
494
526
|
"type": "scenario",
|
|
495
527
|
"label": "Emergency read",
|
|
496
528
|
"x": 520,
|
|
497
|
-
"y":
|
|
529
|
+
"y": 1300,
|
|
498
530
|
"given": "an engineer without access to production secrets",
|
|
499
531
|
"when": "they read one through break-glass with a second person's approval",
|
|
500
532
|
"then": "the security channel is alerted within 5 minutes and the secret is rotated within 24 hours",
|
|
@@ -509,10 +541,10 @@
|
|
|
509
541
|
"type": "scenario",
|
|
510
542
|
"label": "Access expires",
|
|
511
543
|
"x": 520,
|
|
512
|
-
"y":
|
|
544
|
+
"y": 1430,
|
|
513
545
|
"given": "an on-call engineer granted read access to one secret",
|
|
514
|
-
"when": "4 hours
|
|
515
|
-
"then": "the engineer can no longer read it, and could never read any other secret",
|
|
546
|
+
"when": "they read it, and 4 hours pass",
|
|
547
|
+
"then": "the read is alerted within 5 minutes, and afterwards the engineer can no longer read it, and could never read any other secret",
|
|
516
548
|
"hubWhen": {
|
|
517
549
|
"ACCESS": [
|
|
518
550
|
"jit"
|
|
@@ -524,7 +556,7 @@
|
|
|
524
556
|
"type": "scenario",
|
|
525
557
|
"label": "Departure rotates",
|
|
526
558
|
"x": 520,
|
|
527
|
-
"y":
|
|
559
|
+
"y": 1560,
|
|
528
560
|
"given": "a team member who could read three production secrets",
|
|
529
561
|
"when": "they leave the team",
|
|
530
562
|
"then": "their access is gone that day and all three secrets are replaced within 7 days",
|
|
@@ -539,10 +571,10 @@
|
|
|
539
571
|
"type": "scenario",
|
|
540
572
|
"label": "Push refused",
|
|
541
573
|
"x": 520,
|
|
542
|
-
"y":
|
|
574
|
+
"y": 1690,
|
|
543
575
|
"given": "a commit that adds a cloud access key to a configuration file",
|
|
544
|
-
"when": "it is pushed",
|
|
545
|
-
"then": "the code host refuses it and names the file and line",
|
|
576
|
+
"when": "it is pushed, and once pushed with a bypass",
|
|
577
|
+
"then": "the code host refuses it and names the file and line; the bypass is an alert that is reviewed within 1 day",
|
|
546
578
|
"hubWhen": {
|
|
547
579
|
"SCANNING": [
|
|
548
580
|
"push"
|
|
@@ -554,7 +586,7 @@
|
|
|
554
586
|
"type": "scenario",
|
|
555
587
|
"label": "Merge blocked",
|
|
556
588
|
"x": 520,
|
|
557
|
-
"y":
|
|
589
|
+
"y": 1820,
|
|
558
590
|
"given": "a pull request whose second commit adds a database password and whose third removes it",
|
|
559
591
|
"when": "its checks run",
|
|
560
592
|
"then": "the secret check fails and the pull request cannot merge",
|
|
@@ -569,10 +601,10 @@
|
|
|
569
601
|
"type": "scenario",
|
|
570
602
|
"label": "Nightly scan reports",
|
|
571
603
|
"x": 520,
|
|
572
|
-
"y":
|
|
604
|
+
"y": 1950,
|
|
573
605
|
"given": "a credential committed to a branch during the day",
|
|
574
|
-
"when": "the nightly scan runs",
|
|
575
|
-
"then": "the owner has a finding by the
|
|
606
|
+
"when": "the nightly scan runs, and the next one",
|
|
607
|
+
"then": "the owner has a finding by the morning naming the commit and file, and the second scan fails while it is not revoked or recorded",
|
|
576
608
|
"hubWhen": {
|
|
577
609
|
"SCANNING": [
|
|
578
610
|
"scheduled"
|
|
@@ -588,7 +620,7 @@
|
|
|
588
620
|
"concern": "secrets",
|
|
589
621
|
"status": "accepted",
|
|
590
622
|
"date": "",
|
|
591
|
-
"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.",
|
|
623
|
+
"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.",
|
|
592
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.",
|
|
593
625
|
"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.",
|
|
594
626
|
"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.",
|
|
@@ -607,8 +639,8 @@
|
|
|
607
639
|
"concern": "secrets",
|
|
608
640
|
"status": "accepted",
|
|
609
641
|
"date": "",
|
|
610
|
-
"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.",
|
|
611
|
-
"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,
|
|
642
|
+
"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}}.",
|
|
612
644
|
"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.",
|
|
613
645
|
"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.",
|
|
614
646
|
"hubWhen": {
|
|
@@ -626,8 +658,8 @@
|
|
|
626
658
|
"concern": "secrets",
|
|
627
659
|
"status": "accepted",
|
|
628
660
|
"date": "",
|
|
629
|
-
"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.",
|
|
630
|
-
"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; 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.",
|
|
661
|
+
"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.",
|
|
631
663
|
"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.",
|
|
632
664
|
"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.",
|
|
633
665
|
"hubWhen": {
|
|
@@ -642,9 +674,12 @@
|
|
|
642
674
|
"label": "Push protection on",
|
|
643
675
|
"x": 1040,
|
|
644
676
|
"y": 0,
|
|
645
|
-
"
|
|
646
|
-
"
|
|
647
|
-
"
|
|
677
|
+
"characteristic": "security",
|
|
678
|
+
"scope": "atomic",
|
|
679
|
+
"cadence": "triggered",
|
|
680
|
+
"trigger": "nightly",
|
|
681
|
+
"invocation": "automated",
|
|
682
|
+
"description": "A scheduled job lists the organisation's repositories through the GitHub API and fails when one has secret scanning or push protection turned off; it then lists the open secret scanning alerts that came from a bypass and fails on one older than a day, which is a bypass nobody has reviewed and resolved.\n\nThreshold: 100 % of the organisation's repositories have secret scanning and push protection enabled; 0 open alerts created by a bypass more than 1 day ago\n\nTool: GitHub CLI against the GitHub REST API (for GitLab: the secret push protection setting and its audit events, read from its API the same way)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\ngh api --paginate \"/orgs/$ORG/repos?per_page=100\" \\\n --jq '.[] | select(.archived | not)\n | select(.security_and_analysis.secret_scanning.status != \"enabled\"\n or .security_and_analysis.secret_scanning_push_protection.status != \"enabled\")\n | .full_name' > unprotected.txt\ntest ! -s unprotected.txt || { echo \"repositories without secret scanning or push protection:\"; cat unprotected.txt; exit 1; }\n\ngh api --paginate \"/orgs/$ORG/secret-scanning/alerts?state=open&is_bypassed=true&per_page=100\" \\\n --jq '.[] | select((.push_protection_bypassed_at | fromdateiso8601) < (now - 86400))\n | \"\\(.repository.full_name) #\\(.number) bypassed by \\(.push_protection_bypassed_by.login) at \\(.push_protection_bypassed_at)\"' > unreviewed.txt\ntest ! -s unreviewed.txt || { echo \"bypasses older than a day, not reviewed:\"; cat unreviewed.txt; exit 1; }\n```",
|
|
648
683
|
"hubWhen": {
|
|
649
684
|
"SCANNING": [
|
|
650
685
|
"push"
|
|
@@ -657,9 +692,12 @@
|
|
|
657
692
|
"label": "Secret scan in CI",
|
|
658
693
|
"x": 1040,
|
|
659
694
|
"y": 130,
|
|
660
|
-
"
|
|
661
|
-
"
|
|
662
|
-
"
|
|
695
|
+
"characteristic": "security",
|
|
696
|
+
"scope": "atomic",
|
|
697
|
+
"cadence": "triggered",
|
|
698
|
+
"trigger": "pull-request",
|
|
699
|
+
"invocation": "automated",
|
|
700
|
+
"description": "Gitleaks scans every commit of each pull request and is a required status check, so a pull request that adds a secret, even one removed in a later commit, cannot merge.\n\nThreshold: 0 secrets found in the commits of a pull request; the check is required for merging\n\nTool: Gitleaks\n\n```yaml\n# .github/workflows/secrets.yml\nname: secrets\non: [pull_request]\njobs:\n gitleaks:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n with: { fetch-depth: 0 }\n - name: Scan the pull request's commits\n run: |\n docker run --rm -v \"$PWD:/repo\" zricethezav/gitleaks:v8.27.2 \\\n git /repo --log-opts=\"origin/${{ github.base_ref }}..HEAD\" --redact --exit-code 1\n```",
|
|
663
701
|
"hubWhen": {
|
|
664
702
|
"SCANNING": [
|
|
665
703
|
"push",
|
|
@@ -670,12 +708,15 @@
|
|
|
670
708
|
{
|
|
671
709
|
"id": "ff-scan-history",
|
|
672
710
|
"type": "fitness-fn",
|
|
673
|
-
"label": "Nightly history
|
|
711
|
+
"label": "Nightly history, logs and images",
|
|
674
712
|
"x": 1040,
|
|
675
713
|
"y": 260,
|
|
676
|
-
"
|
|
677
|
-
"
|
|
678
|
-
"
|
|
714
|
+
"characteristic": "security",
|
|
715
|
+
"scope": "atomic",
|
|
716
|
+
"cadence": "triggered",
|
|
717
|
+
"trigger": "nightly",
|
|
718
|
+
"invocation": "automated",
|
|
719
|
+
"description": "A nightly job scans the full git history and the previous day's CI logs with Gitleaks and the latest built images with TruffleHog; a finding is closed by revoking the credential and adding its fingerprint to .gitleaksignore (a false positive, likewise), so the job keeps failing, and the owner keeps being told, until that happens.\n\nThreshold: The nightly job fails on every finding in the git history, the previous day's CI logs or the built images that is not yet closed; a finding is closed by revoking the secret and recording its fingerprint with the review, so none stays open past the next run\n\nTool: Gitleaks and TruffleHog with the GitHub CLI\n\n```yaml\n# .github/workflows/secrets-nightly.yml\nname: secrets-nightly\non:\n schedule: [{ cron: '0 2 * * *' }]\njobs:\n scan:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n with: { fetch-depth: 0 }\n - name: Git history (closed findings are in .gitleaksignore with their review)\n run: docker run --rm -v \"$PWD:/repo\" zricethezav/gitleaks:v8.27.2 git /repo --redact --exit-code 1\n - name: Yesterday's CI logs\n env: { GH_TOKEN: \"${{ github.token }}\" }\n run: |\n mkdir -p ci-logs\n for id in $(gh run list --created \"$(date -u -d yesterday +%F)\" --limit 200 --json databaseId --jq '.[].databaseId'); do\n gh run view \"$id\" --log > \"ci-logs/$id.txt\" || true\n done\n docker run --rm -v \"$PWD/ci-logs:/logs\" zricethezav/gitleaks:v8.27.2 dir /logs --redact --exit-code 1\n - name: Built images\n run: docker run --rm trufflesecurity/trufflehog:3.99.7 docker --image \"$IMAGE\" --only-verified --fail\n```",
|
|
679
720
|
"hubWhen": {
|
|
680
721
|
"SCANNING": [
|
|
681
722
|
"scheduled"
|
|
@@ -685,12 +726,14 @@
|
|
|
685
726
|
{
|
|
686
727
|
"id": "ff-age-manager",
|
|
687
728
|
"type": "fitness-fn",
|
|
688
|
-
"label": "
|
|
729
|
+
"label": "No secret past its rotation period",
|
|
689
730
|
"x": 1040,
|
|
690
731
|
"y": 390,
|
|
691
|
-
"
|
|
692
|
-
"
|
|
693
|
-
"
|
|
732
|
+
"characteristic": "security",
|
|
733
|
+
"scope": "atomic",
|
|
734
|
+
"cadence": "continual",
|
|
735
|
+
"invocation": "automated",
|
|
736
|
+
"description": "AWS Config evaluates every secret in AWS Secrets Manager and reports one not rotated within {{ROTATE_DAYS}} days, whether the store or a person rotates it; the non-compliant list is the daily alert to the owners.\n\nThreshold: 0 secrets in the secrets manager last rotated more than {{ROTATE_DAYS}} days ago\n\nTool: AWS Config managed rule SECRETSMANAGER_SECRET_PERIODIC_ROTATION (for Vault: a scheduled job over the secrets' metadata updated_time; for Key Vault: the secrets' attributes.updated)\n\n```hcl\nresource \"aws_config_config_rule\" \"secret_rotated\" {\n name = \"secret-rotated-within-{{ROTATE_DAYS}}-days\"\n source {\n owner = \"AWS\"\n source_identifier = \"SECRETSMANAGER_SECRET_PERIODIC_ROTATION\"\n }\n input_parameters = jsonencode({ maxDaysSinceRotation = \"{{ROTATE_DAYS}}\" })\n}\n```",
|
|
694
737
|
"hubWhen": {
|
|
695
738
|
"STORE": [
|
|
696
739
|
"manager",
|
|
@@ -698,15 +741,57 @@
|
|
|
698
741
|
]
|
|
699
742
|
}
|
|
700
743
|
},
|
|
744
|
+
{
|
|
745
|
+
"id": "ff-rotation-enabled",
|
|
746
|
+
"type": "fitness-fn",
|
|
747
|
+
"label": "Rotation is on",
|
|
748
|
+
"x": 1040,
|
|
749
|
+
"y": 520,
|
|
750
|
+
"characteristic": "security",
|
|
751
|
+
"scope": "atomic",
|
|
752
|
+
"cadence": "continual",
|
|
753
|
+
"invocation": "automated",
|
|
754
|
+
"description": "AWS Config reports every secret in AWS Secrets Manager that has no rotation configured, which with automatic rotation decided means a secret that will never be rotated.\n\nThreshold: 0 secrets in the secrets manager without automatic rotation configured\n\nTool: AWS Config managed rule SECRETSMANAGER_ROTATION_ENABLED_CHECK (for Vault: a scheduled job over the database secrets engine roles; for Key Vault: az keyvault secret show, the rotation policy)\n\n```hcl\nresource \"aws_config_config_rule\" \"secret_rotation_enabled\" {\n name = \"secret-rotation-enabled\"\n source {\n owner = \"AWS\"\n source_identifier = \"SECRETSMANAGER_ROTATION_ENABLED_CHECK\"\n }\n}\n```",
|
|
755
|
+
"hubWhen": {
|
|
756
|
+
"STORE": [
|
|
757
|
+
"manager",
|
|
758
|
+
"identity"
|
|
759
|
+
],
|
|
760
|
+
"ROTATION": [
|
|
761
|
+
"automatic"
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"id": "ff-refresh",
|
|
767
|
+
"type": "fitness-fn",
|
|
768
|
+
"label": "Rotation without a restart",
|
|
769
|
+
"x": 1040,
|
|
770
|
+
"y": 650,
|
|
771
|
+
"characteristic": "security",
|
|
772
|
+
"scope": "atomic",
|
|
773
|
+
"cadence": "triggered",
|
|
774
|
+
"trigger": "pull-request",
|
|
775
|
+
"invocation": "automated",
|
|
776
|
+
"description": "An integration test runs the element against a database and a secrets manager in containers, keeps requests flowing, puts a new credential version (the alternate database user, as a rotation does), waits one lease, revokes the old credential and counts failures; it then searches the container's file system for both values.\n\nThreshold: With traffic flowing, a new secret version put in the manager is in use before the old credential is revoked; 0 failed requests and 0 restarts; nothing on the element's disk holds either value\n\nTool: Vitest with Testcontainers (PostgreSQL, LocalStack Secrets Manager) (or the test runner of your stack)\n\n```ts\nimport { SecretsManagerClient, PutSecretValueCommand } from '@aws-sdk/client-secrets-manager'\n\nit('picks up a rotated credential without a restart or a failed request', async () => {\n const sm = new SecretsManagerClient({ endpoint: localstack.getConnectionUri() }) // the element reads shop/db from here\n const traffic = keepCalling(element, '/orders', { seconds: 3 * LEASE_SECONDS }) // continuous requests, counts failures\n await sm.send(new PutSecretValueCommand({ SecretId: 'shop/db', SecretString: JSON.stringify({ user: 'shop_b', password: 'rotated' }) }))\n await sleep((LEASE_SECONDS + 1) * 1000)\n await db.query(\"alter user shop_a with password 'revoked'\") // the old credential stops working\n const { failed, restarts } = await traffic\n expect(failed).toBe(0)\n expect(restarts).toBe(0)\n const disk = await element.exec(['grep', '-rl', '-e', 'rotated', '-e', 'revoked', '/'])\n expect(disk.output.trim()).toBe('')\n})\n```",
|
|
777
|
+
"hubWhen": {
|
|
778
|
+
"STORE": [
|
|
779
|
+
"manager"
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
},
|
|
701
783
|
{
|
|
702
784
|
"id": "ff-no-static",
|
|
703
785
|
"type": "fitness-fn",
|
|
704
786
|
"label": "No stored database secrets",
|
|
705
787
|
"x": 1040,
|
|
706
|
-
"y":
|
|
707
|
-
"
|
|
708
|
-
"
|
|
709
|
-
"
|
|
788
|
+
"y": 780,
|
|
789
|
+
"characteristic": "security",
|
|
790
|
+
"scope": "atomic",
|
|
791
|
+
"cadence": "triggered",
|
|
792
|
+
"trigger": "pull-request",
|
|
793
|
+
"invocation": "automated",
|
|
794
|
+
"description": "A Conftest policy over the rendered manifests fails when a workload reads an environment variable, an environment block or a volume from a Secret that is not on the allow-list, which would mean a stored credential came back.\n\nThreshold: 0 workloads (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs) that take a credential from a Kubernetes Secret through env, envFrom or a volume, outside the allow-list of outside-system keys\n\nTool: Conftest (Open Policy Agent)\n\n```rego\n# conftest test --combine manifests/\npackage main\n\nimport rego.v1\n\nallowed := {\"partner-api-key\"} # keys of outside systems that accept nothing else\n\ndocs contains d if { some f in input; is_array(f.contents); some d in f.contents }\ndocs contains d if { some f in input; not is_array(f.contents); d := f.contents }\n\npodspec(d) := d.spec.template.spec if d.kind in {\"Deployment\", \"StatefulSet\", \"DaemonSet\", \"Job\"}\npodspec(d) := d.spec.jobTemplate.spec.template.spec if d.kind == \"CronJob\"\n\nsecrets_of(d) := union({\n {s | some c in podspec(d).containers; some e in c.env; s := e.valueFrom.secretKeyRef.name},\n {s | some c in podspec(d).containers; some e in c.envFrom; s := e.secretRef.name},\n {s | some v in podspec(d).volumes; s := v.secret.secretName},\n})\n\ndeny contains msg if {\n some d in docs\n some s in secrets_of(d)\n not allowed[s]\n msg := sprintf(\"%s %s reads secret %s: use the workload identity\", [d.kind, d.metadata.name, s])\n}\n```",
|
|
710
795
|
"hubWhen": {
|
|
711
796
|
"STORE": [
|
|
712
797
|
"identity"
|
|
@@ -716,12 +801,15 @@
|
|
|
716
801
|
{
|
|
717
802
|
"id": "ff-age-env",
|
|
718
803
|
"type": "fitness-fn",
|
|
719
|
-
"label": "Deployment secrets
|
|
804
|
+
"label": "Deployment secrets rotated",
|
|
720
805
|
"x": 1040,
|
|
721
|
-
"y":
|
|
722
|
-
"
|
|
723
|
-
"
|
|
724
|
-
"
|
|
806
|
+
"y": 910,
|
|
807
|
+
"characteristic": "security",
|
|
808
|
+
"scope": "atomic",
|
|
809
|
+
"cadence": "triggered",
|
|
810
|
+
"trigger": "nightly",
|
|
811
|
+
"invocation": "automated",
|
|
812
|
+
"description": "A scheduled job lists the Kubernetes Secrets the elements read and fails on any whose rotation annotation (written by the rotation runbook or pipeline on every rotation; the creation time counts when there is none) is older than {{ROTATE_DAYS}} days; the list is the daily alert to the owners.\n\nThreshold: 0 Secrets in the production namespace rotated (or, never rotated, created) more than {{ROTATE_DAYS}} days ago\n\nTool: kubectl and jq\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nmax_age=$(( {{ROTATE_DAYS}} * 86400 ))\n# the rotation writes the annotation secrets.acme.io/rotated-at (RFC 3339) on the Secret it replaces in place\nkubectl get secrets -n production -l app.kubernetes.io/part-of=shop -o json \\\n | jq -r --argjson max \"$max_age\" '.items[]\n | ((.metadata.annotations[\"secrets.acme.io/rotated-at\"] // .metadata.creationTimestamp) | fromdateiso8601) as $rotated\n | select((now - $rotated) > $max)\n | .metadata.name' > stale.txt\ntest ! -s stale.txt || { echo \"Secrets past rotation:\"; cat stale.txt; exit 1; }\n```",
|
|
725
813
|
"hubWhen": {
|
|
726
814
|
"STORE": [
|
|
727
815
|
"env"
|
|
@@ -733,16 +821,108 @@
|
|
|
733
821
|
"type": "fitness-fn",
|
|
734
822
|
"label": "Human reads alerted",
|
|
735
823
|
"x": 1040,
|
|
736
|
-
"y":
|
|
737
|
-
"
|
|
738
|
-
"
|
|
739
|
-
"
|
|
824
|
+
"y": 1040,
|
|
825
|
+
"characteristic": "security",
|
|
826
|
+
"scope": "atomic",
|
|
827
|
+
"cadence": "continual",
|
|
828
|
+
"invocation": "automated",
|
|
829
|
+
"description": "A CloudWatch Logs metric filter on the CloudTrail log group counts GetSecretValue calls by anything but the workloads' roles (an IAM user, or an assumed role not named workload-*; read-only events never reach EventBridge, so the log group is the source) and an alarm with a one-minute period pages the security channel; the log group keeps 400 days. On Vault, the audit device feeds the same alert.\n\nThreshold: 100 % of reads of a production secret by a person raise an alert within 5 minutes to the security channel, where each is matched with its approval; the trail that records them is kept for 400 days\n\nTool: AWS CloudTrail delivered to CloudWatch Logs, a metric filter and an alarm (Terraform); for Vault: the audit device and the same alert in your log system\n\n```hcl\nresource \"aws_cloudwatch_log_group\" \"cloudtrail\" {\n name = \"cloudtrail\"\n retention_in_days = 400\n}\n\nresource \"aws_cloudwatch_log_metric_filter\" \"human_secret_reads\" {\n name = \"human-secret-reads\"\n log_group_name = aws_cloudwatch_log_group.cloudtrail.name # the trail delivers management events here\n pattern = \"{ ($.eventSource = \\\"secretsmanager.amazonaws.com\\\") && ($.eventName = \\\"GetSecretValue\\\") && (($.userIdentity.type = \\\"IAMUser\\\") || (($.userIdentity.type = \\\"AssumedRole\\\") && ($.userIdentity.sessionContext.sessionIssuer.userName != \\\"workload-*\\\"))) }\"\n metric_transformation {\n name = \"HumanSecretReads\"\n namespace = \"Secrets\"\n value = \"1\"\n }\n}\n\nresource \"aws_cloudwatch_metric_alarm\" \"human_secret_read\" {\n alarm_name = \"human-secret-read\"\n namespace = \"Secrets\"\n metric_name = \"HumanSecretReads\"\n statistic = \"Sum\"\n period = 60\n evaluation_periods = 1\n threshold = 0\n comparison_operator = \"GreaterThanThreshold\"\n treat_missing_data = \"notBreaching\"\n alarm_actions = [aws_sns_topic.security_channel.arn] # each alert is matched with its approval\n}\n```",
|
|
740
830
|
"hubWhen": {
|
|
741
831
|
"ACCESS": [
|
|
742
832
|
"breakglass",
|
|
743
833
|
"jit"
|
|
744
834
|
]
|
|
745
835
|
}
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"id": "ff-read-log",
|
|
839
|
+
"type": "fitness-fn",
|
|
840
|
+
"label": "Team reads logged and reported",
|
|
841
|
+
"x": 1040,
|
|
842
|
+
"y": 1170,
|
|
843
|
+
"characteristic": "security",
|
|
844
|
+
"scope": "atomic",
|
|
845
|
+
"cadence": "continual",
|
|
846
|
+
"invocation": "automated",
|
|
847
|
+
"description": "A CloudWatch Logs metric filter on the CloudTrail log group counts GetSecretValue calls by people (an IAM user, or an assumed role not named workload-*), a daily alarm reports them to the team's channel, and the log group keeps 400 days. On Vault, the audit device feeds the same report.\n\nThreshold: Every read of a production secret by a person is in the trail with who, when and which secret; the trail is kept for 400 days; the owning team gets the day's reads every morning\n\nTool: AWS CloudTrail delivered to CloudWatch Logs, a metric filter and a daily alarm (Terraform); for Vault: the audit device and a daily query in your log system\n\n```hcl\nresource \"aws_cloudwatch_log_group\" \"cloudtrail\" {\n name = \"cloudtrail\"\n retention_in_days = 400\n}\n\nresource \"aws_cloudwatch_log_metric_filter\" \"human_secret_reads\" {\n name = \"human-secret-reads\"\n log_group_name = aws_cloudwatch_log_group.cloudtrail.name\n pattern = \"{ ($.eventSource = \\\"secretsmanager.amazonaws.com\\\") && ($.eventName = \\\"GetSecretValue\\\") && (($.userIdentity.type = \\\"IAMUser\\\") || (($.userIdentity.type = \\\"AssumedRole\\\") && ($.userIdentity.sessionContext.sessionIssuer.userName != \\\"workload-*\\\"))) }\"\n metric_transformation {\n name = \"HumanSecretReads\"\n namespace = \"Secrets\"\n value = \"1\"\n }\n}\n\nresource \"aws_cloudwatch_metric_alarm\" \"daily_secret_reads\" {\n alarm_name = \"secret-reads-yesterday\"\n namespace = \"Secrets\"\n metric_name = \"HumanSecretReads\"\n statistic = \"Sum\"\n period = 86400\n evaluation_periods = 1\n threshold = 0\n comparison_operator = \"GreaterThanThreshold\"\n treat_missing_data = \"notBreaching\"\n alarm_actions = [aws_sns_topic.team_channel.arn] # the team reads the list each morning\n}\n```",
|
|
848
|
+
"hubWhen": {
|
|
849
|
+
"ACCESS": [
|
|
850
|
+
"team"
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"id": "ff-own-manager",
|
|
856
|
+
"type": "fitness-fn",
|
|
857
|
+
"label": "No secret shared between workloads",
|
|
858
|
+
"x": 1040,
|
|
859
|
+
"y": 1300,
|
|
860
|
+
"characteristic": "security",
|
|
861
|
+
"scope": "atomic",
|
|
862
|
+
"cadence": "triggered",
|
|
863
|
+
"trigger": "pull-request",
|
|
864
|
+
"invocation": "automated",
|
|
865
|
+
"description": "A Conftest policy over the Terraform plan parses every IAM policy document, collects the secret ARNs each may GetSecretValue on, and fails when one ARN appears in two policies (two workloads sharing a credential) or when a policy reads by wildcard.\n\nThreshold: 0 secrets readable by two IAM policies in the plan; 0 policies that may read secrets by wildcard\n\nTool: Conftest (Open Policy Agent) over terraform show -json (AWS; for Vault: the policies' path grants, for Key Vault: RBAC assignments, checked the same way)\n\n```rego\npackage main\n\nimport rego.v1\n\nas_set(x) := {x} if is_string(x)\nas_set(x) := {v | some v in x} if is_array(x)\n\npolicies contains rc if {\n some rc in input.resource_changes\n rc.type in {\"aws_iam_role_policy\", \"aws_iam_policy\"}\n is_string(rc.change.after.policy)\n}\n\nreads(rc) := {r |\n some s in json.unmarshal(rc.change.after.policy).Statement\n s.Effect == \"Allow\"\n some a in as_set(s.Action)\n a in {\"secretsmanager:GetSecretValue\", \"secretsmanager:*\"}\n some r in as_set(s.Resource)\n}\n\ndeny contains msg if {\n some rc in policies\n some r in reads(rc)\n contains(r, \"*\")\n msg := sprintf(\"%s may read secrets by wildcard %s\", [rc.address, r])\n}\n\ndeny contains msg if {\n some a in policies\n some b in policies\n a.address < b.address\n some r in reads(a) & reads(b)\n msg := sprintf(\"secret %s is readable by both %s and %s\", [r, a.address, b.address])\n}\n```",
|
|
866
|
+
"hubWhen": {
|
|
867
|
+
"STORE": [
|
|
868
|
+
"manager",
|
|
869
|
+
"identity"
|
|
870
|
+
]
|
|
871
|
+
}
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
"id": "ff-own-env",
|
|
875
|
+
"type": "fitness-fn",
|
|
876
|
+
"label": "No Secret shared between workloads",
|
|
877
|
+
"x": 1040,
|
|
878
|
+
"y": 1430,
|
|
879
|
+
"characteristic": "security",
|
|
880
|
+
"scope": "atomic",
|
|
881
|
+
"cadence": "triggered",
|
|
882
|
+
"trigger": "pull-request",
|
|
883
|
+
"invocation": "automated",
|
|
884
|
+
"description": "A Conftest policy over all rendered manifests at once collects the Secrets each workload references and fails when two workloads reference the same one, which is a credential shared between elements.\n\nThreshold: 0 Kubernetes Secrets referenced (env, envFrom or volume) by two workloads in the rendered manifests\n\nTool: Conftest (Open Policy Agent)\n\n```rego\n# conftest test --combine manifests/\npackage main\n\nimport rego.v1\n\ndocs contains d if { some f in input; is_array(f.contents); some d in f.contents }\ndocs contains d if { some f in input; not is_array(f.contents); d := f.contents }\n\npodspec(d) := d.spec.template.spec if d.kind in {\"Deployment\", \"StatefulSet\", \"DaemonSet\", \"Job\"}\npodspec(d) := d.spec.jobTemplate.spec.template.spec if d.kind == \"CronJob\"\n\nsecrets_of(d) := union({\n {s | some c in podspec(d).containers; some e in c.env; s := e.valueFrom.secretKeyRef.name},\n {s | some c in podspec(d).containers; some e in c.envFrom; s := e.secretRef.name},\n {s | some v in podspec(d).volumes; s := v.secret.secretName},\n})\n\nname(d) := sprintf(\"%s/%s/%s\", [object.get(d.metadata, \"namespace\", \"default\"), d.kind, d.metadata.name])\n\ndeny contains msg if {\n some a in docs\n some b in docs\n name(a) < name(b)\n some s in secrets_of(a) & secrets_of(b)\n msg := sprintf(\"secret %s is used by both %s and %s\", [s, name(a), name(b)])\n}\n```",
|
|
885
|
+
"hubWhen": {
|
|
886
|
+
"STORE": [
|
|
887
|
+
"env"
|
|
888
|
+
]
|
|
889
|
+
}
|
|
890
|
+
},
|
|
891
|
+
{
|
|
892
|
+
"id": "ff-env-masked",
|
|
893
|
+
"type": "fitness-fn",
|
|
894
|
+
"label": "Variables masked",
|
|
895
|
+
"x": 1040,
|
|
896
|
+
"y": 1560,
|
|
897
|
+
"characteristic": "security",
|
|
898
|
+
"scope": "atomic",
|
|
899
|
+
"cadence": "triggered",
|
|
900
|
+
"trigger": "pull-request",
|
|
901
|
+
"invocation": "automated",
|
|
902
|
+
"description": "A test runs the element with a known password in its environment, reads the configuration endpoint, provokes a crash report and searches both and the captured logs for the value.\n\nThreshold: The configuration endpoint, a crash report and the captured logs contain 0 occurrences of a credential's value\n\nTool: Vitest with supertest (or the test runner and HTTP client of your stack)\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app'\n\nit('shows no credential in the configuration endpoint, crash reports or logs', async () => {\n const password = process.env.DB_PASSWORD!\n const res = await request(app).get('/internal/config').expect(200)\n expect(JSON.stringify(res.body)).not.toContain(password)\n const report = await crashReportOf(() => { throw new Error('simulated crash') }) // the element's crash report handler\n expect(report).not.toContain(password)\n expect(capturedLogs()).not.toContain(password)\n})\n```",
|
|
903
|
+
"hubWhen": {
|
|
904
|
+
"STORE": [
|
|
905
|
+
"env"
|
|
906
|
+
]
|
|
907
|
+
}
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
"id": "ff-env-encrypted",
|
|
911
|
+
"type": "fitness-fn",
|
|
912
|
+
"label": "Deployment store encrypted",
|
|
913
|
+
"x": 1040,
|
|
914
|
+
"y": 1690,
|
|
915
|
+
"characteristic": "security",
|
|
916
|
+
"scope": "atomic",
|
|
917
|
+
"cadence": "triggered",
|
|
918
|
+
"trigger": "nightly",
|
|
919
|
+
"invocation": "automated",
|
|
920
|
+
"description": "A scheduled job reads the cluster's encryption configuration and fails when Kubernetes Secrets are not envelope-encrypted with a KMS key.\n\nThreshold: The production cluster lists secrets among the resources encrypted with a KMS key; the check fails otherwise\n\nTool: AWS CLI for EKS (for GKE: gcloud container clusters describe, databaseEncryption.state must be ENCRYPTED; for AKS: az aks show, securityProfile.azureKeyVaultKms.enabled; for Sealed Secrets or SOPS: the plain Secret never exists in git, which the secret scan checks)\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\naws eks describe-cluster --name \"$CLUSTER\" --query 'cluster.encryptionConfig[].resources[]' --output text | grep -qw secrets \\\n || { echo \"cluster $CLUSTER does not encrypt Secrets at rest with a KMS key\"; exit 1; }\n```",
|
|
921
|
+
"hubWhen": {
|
|
922
|
+
"STORE": [
|
|
923
|
+
"env"
|
|
924
|
+
]
|
|
925
|
+
}
|
|
746
926
|
}
|
|
747
927
|
],
|
|
748
928
|
"relations": [
|
|
@@ -788,6 +968,12 @@
|
|
|
788
968
|
"targetId": "need",
|
|
789
969
|
"relationType": "derives"
|
|
790
970
|
},
|
|
971
|
+
{
|
|
972
|
+
"id": "req-env-store--derives--need",
|
|
973
|
+
"sourceId": "req-env-store",
|
|
974
|
+
"targetId": "need",
|
|
975
|
+
"relationType": "derives"
|
|
976
|
+
},
|
|
791
977
|
{
|
|
792
978
|
"id": "req-rotate-auto--derives--need",
|
|
793
979
|
"sourceId": "req-rotate-auto",
|
|
@@ -878,6 +1064,12 @@
|
|
|
878
1064
|
"targetId": "req-env",
|
|
879
1065
|
"relationType": "verifies"
|
|
880
1066
|
},
|
|
1067
|
+
{
|
|
1068
|
+
"id": "sc-env-store--verifies--req-env-store",
|
|
1069
|
+
"sourceId": "sc-env-store",
|
|
1070
|
+
"targetId": "req-env-store",
|
|
1071
|
+
"relationType": "verifies"
|
|
1072
|
+
},
|
|
881
1073
|
{
|
|
882
1074
|
"id": "sc-rotate-auto--verifies--req-rotate-auto",
|
|
883
1075
|
"sourceId": "sc-rotate-auto",
|
|
@@ -992,6 +1184,24 @@
|
|
|
992
1184
|
"targetId": "adr-identity",
|
|
993
1185
|
"relationType": "implements"
|
|
994
1186
|
},
|
|
1187
|
+
{
|
|
1188
|
+
"id": "ff-rotation-enabled--implements--adr-manager",
|
|
1189
|
+
"sourceId": "ff-rotation-enabled",
|
|
1190
|
+
"targetId": "adr-manager",
|
|
1191
|
+
"relationType": "implements"
|
|
1192
|
+
},
|
|
1193
|
+
{
|
|
1194
|
+
"id": "ff-rotation-enabled--implements--adr-identity",
|
|
1195
|
+
"sourceId": "ff-rotation-enabled",
|
|
1196
|
+
"targetId": "adr-identity",
|
|
1197
|
+
"relationType": "implements"
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
"id": "ff-refresh--implements--adr-manager",
|
|
1201
|
+
"sourceId": "ff-refresh",
|
|
1202
|
+
"targetId": "adr-manager",
|
|
1203
|
+
"relationType": "implements"
|
|
1204
|
+
},
|
|
995
1205
|
{
|
|
996
1206
|
"id": "ff-no-static--implements--adr-identity",
|
|
997
1207
|
"sourceId": "ff-no-static",
|
|
@@ -1021,6 +1231,54 @@
|
|
|
1021
1231
|
"sourceId": "ff-human-reads",
|
|
1022
1232
|
"targetId": "adr-env",
|
|
1023
1233
|
"relationType": "implements"
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
"id": "ff-read-log--implements--adr-manager",
|
|
1237
|
+
"sourceId": "ff-read-log",
|
|
1238
|
+
"targetId": "adr-manager",
|
|
1239
|
+
"relationType": "implements"
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
"id": "ff-read-log--implements--adr-identity",
|
|
1243
|
+
"sourceId": "ff-read-log",
|
|
1244
|
+
"targetId": "adr-identity",
|
|
1245
|
+
"relationType": "implements"
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
"id": "ff-read-log--implements--adr-env",
|
|
1249
|
+
"sourceId": "ff-read-log",
|
|
1250
|
+
"targetId": "adr-env",
|
|
1251
|
+
"relationType": "implements"
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
"id": "ff-own-manager--implements--adr-manager",
|
|
1255
|
+
"sourceId": "ff-own-manager",
|
|
1256
|
+
"targetId": "adr-manager",
|
|
1257
|
+
"relationType": "implements"
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
"id": "ff-own-manager--implements--adr-identity",
|
|
1261
|
+
"sourceId": "ff-own-manager",
|
|
1262
|
+
"targetId": "adr-identity",
|
|
1263
|
+
"relationType": "implements"
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
"id": "ff-own-env--implements--adr-env",
|
|
1267
|
+
"sourceId": "ff-own-env",
|
|
1268
|
+
"targetId": "adr-env",
|
|
1269
|
+
"relationType": "implements"
|
|
1270
|
+
},
|
|
1271
|
+
{
|
|
1272
|
+
"id": "ff-env-masked--implements--adr-env",
|
|
1273
|
+
"sourceId": "ff-env-masked",
|
|
1274
|
+
"targetId": "adr-env",
|
|
1275
|
+
"relationType": "implements"
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
"id": "ff-env-encrypted--implements--adr-env",
|
|
1279
|
+
"sourceId": "ff-env-encrypted",
|
|
1280
|
+
"targetId": "adr-env",
|
|
1281
|
+
"relationType": "implements"
|
|
1024
1282
|
}
|
|
1025
1283
|
]
|
|
1026
1284
|
}
|