@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.
Files changed (58) hide show
  1. package/dist/{chunk-Z7THA3L5.js → chunk-2SZDTOYJ.js} +65 -33
  2. package/dist/{elkLayout-TAUBPPVN.js → elkLayout-VYJDCCIT.js} +1 -1
  3. package/dist/hub-catalogue/concern/concern-api-collections.radical +1136 -0
  4. package/dist/hub-catalogue/concern/concern-api-errors.radical +1180 -0
  5. package/dist/hub-catalogue/concern/concern-api-evolution.radical +449 -210
  6. package/dist/hub-catalogue/concern/concern-api-idempotency.radical +1218 -0
  7. package/dist/hub-catalogue/concern/concern-api-resource-design.radical +1102 -0
  8. package/dist/hub-catalogue/concern/concern-api-style-guide.radical +1210 -0
  9. package/dist/hub-catalogue/concern/concern-architecture-style.radical +287 -131
  10. package/dist/hub-catalogue/concern/concern-audit-trail.radical +1096 -0
  11. package/dist/hub-catalogue/concern/concern-authentication.radical +247 -37
  12. package/dist/hub-catalogue/concern/concern-authorization.radical +311 -89
  13. package/dist/hub-catalogue/concern/concern-availability.radical +287 -63
  14. package/dist/hub-catalogue/concern/concern-backend-stack.radical +300 -381
  15. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +385 -129
  16. package/dist/hub-catalogue/concern/concern-caching.radical +1294 -0
  17. package/dist/hub-catalogue/concern/concern-capacity.radical +194 -81
  18. package/dist/hub-catalogue/concern/concern-code-documentation.radical +1397 -0
  19. package/dist/hub-catalogue/concern/concern-code-quality-gate.radical +1409 -0
  20. package/dist/hub-catalogue/concern/concern-code-review-branching.radical +1416 -0
  21. package/dist/hub-catalogue/concern/concern-code-style.radical +1058 -0
  22. package/dist/hub-catalogue/concern/concern-communication-style.radical +473 -167
  23. package/dist/hub-catalogue/concern/concern-data-classification.radical +970 -0
  24. package/dist/hub-catalogue/concern/concern-data-consistency.radical +339 -308
  25. package/dist/hub-catalogue/concern/concern-data-store.radical +480 -158
  26. package/dist/hub-catalogue/concern/concern-decomposition.radical +260 -85
  27. package/dist/hub-catalogue/concern/concern-definition-of-done.radical +1214 -0
  28. package/dist/hub-catalogue/concern/concern-delivery-metrics.radical +966 -0
  29. package/dist/hub-catalogue/concern/concern-dependency-hygiene.radical +1345 -0
  30. package/dist/hub-catalogue/concern/concern-deployment.radical +343 -92
  31. package/dist/hub-catalogue/concern/concern-encryption.radical +339 -76
  32. package/dist/hub-catalogue/concern/concern-error-handling-logging.radical +1197 -0
  33. package/dist/hub-catalogue/concern/concern-eu-dora.radical +1321 -0
  34. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +467 -160
  35. package/dist/hub-catalogue/concern/concern-incident-management.radical +1204 -0
  36. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1300 -268
  37. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +88 -51
  38. package/dist/hub-catalogue/concern/concern-messaging.radical +173 -140
  39. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +162 -159
  40. package/dist/hub-catalogue/concern/concern-observability.radical +224 -275
  41. package/dist/hub-catalogue/concern/concern-operational-readiness.radical +1249 -0
  42. package/dist/hub-catalogue/concern/concern-personal-data.radical +637 -122
  43. package/dist/hub-catalogue/concern/concern-quality-priorities.radical +1091 -0
  44. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +433 -141
  45. package/dist/hub-catalogue/concern/concern-release-versioning.radical +1358 -0
  46. package/dist/hub-catalogue/concern/concern-retention.radical +1399 -0
  47. package/dist/hub-catalogue/concern/concern-secrets.radical +332 -74
  48. package/dist/hub-catalogue/concern/concern-secure-coding.radical +1379 -0
  49. package/dist/hub-catalogue/concern/concern-secure-development.radical +1245 -0
  50. package/dist/hub-catalogue/concern/concern-security-detection.radical +1153 -0
  51. package/dist/hub-catalogue/concern/concern-supply-chain.radical +257 -183
  52. package/dist/hub-catalogue/concern/concern-technical-debt.radical +1450 -0
  53. package/dist/hub-catalogue/concern/concern-technology-lifecycle.radical +1145 -0
  54. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +271 -137
  55. package/dist/hub-catalogue/concern/concern-test-strategy.radical +243 -224
  56. package/dist/hub-catalogue/concern/concern-threat-modelling.radical +1143 -0
  57. package/dist/index.js +1001 -230
  58. package/package.json +1 -1
@@ -0,0 +1,1379 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-secure-coding",
4
+ "category": "concern",
5
+ "name": "Secure coding",
6
+ "description": "How the code itself is kept free of the common vulnerability classes: the standard it is held to, where input is validated and output encoded, how static and dynamic security testing runs, and what happens to a finding.",
7
+ "tags": [
8
+ "security",
9
+ "secure-coding",
10
+ "owasp",
11
+ "asvs",
12
+ "sast",
13
+ "dast",
14
+ "input-validation"
15
+ ],
16
+ "requiredMetamodel": "c4-ddd-governance-builtin",
17
+ "concern": {
18
+ "id": "secure-coding",
19
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
20
+ "why": "code is written for these elements, so the standard it is held to, where input is validated, how it is tested for vulnerabilities and what happens to a finding has to be decided.",
21
+ "group": "security"
22
+ },
23
+ "sources": [
24
+ {
25
+ "title": "OWASP Application Security Verification Standard (ASVS) 4.0.3 and 5.0",
26
+ "url": "https://owasp.org/www-project-application-security-verification-standard/"
27
+ },
28
+ {
29
+ "title": "OWASP Top 10:2021",
30
+ "url": "https://owasp.org/Top10/"
31
+ },
32
+ {
33
+ "title": "OWASP Input Validation Cheat Sheet",
34
+ "url": "https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html"
35
+ },
36
+ {
37
+ "title": "OWASP SQL Injection Prevention Cheat Sheet",
38
+ "url": "https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html"
39
+ },
40
+ {
41
+ "title": "OWASP Cross Site Scripting Prevention Cheat Sheet",
42
+ "url": "https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html"
43
+ },
44
+ {
45
+ "title": "OWASP Top 10 Proactive Controls 2024",
46
+ "url": "https://top10proactive.owasp.org/"
47
+ },
48
+ {
49
+ "title": "SEI CERT Coding Standards (C, C++, Java)",
50
+ "url": "https://wiki.sei.cmu.edu/confluence/display/seccode"
51
+ },
52
+ {
53
+ "title": "MISRA C:2023, Guidelines for the use of the C language in critical systems",
54
+ "url": "https://misra.org.uk/"
55
+ },
56
+ {
57
+ "title": "NIST SP 800-218, Secure Software Development Framework (SSDF) 1.1",
58
+ "url": "https://csrc.nist.gov/pubs/sp/800/218/final"
59
+ },
60
+ {
61
+ "title": "Semgrep documentation",
62
+ "url": "https://semgrep.dev/docs/"
63
+ },
64
+ {
65
+ "title": "GitHub CodeQL documentation",
66
+ "url": "https://codeql.github.com/docs/"
67
+ },
68
+ {
69
+ "title": "OWASP ZAP documentation",
70
+ "url": "https://www.zaproxy.org/docs/"
71
+ },
72
+ {
73
+ "title": "Threat Modeling Manifesto",
74
+ "url": "https://www.threatmodelingmanifesto.org/"
75
+ }
76
+ ],
77
+ "templateParams": [
78
+ {
79
+ "key": "STANDARD",
80
+ "title": "Standard",
81
+ "label": "Which standard is the code held to?",
82
+ "hint": "The standard decides what \"secure\" means for a change: a list of controls a tool can verify, the same plus design-level controls carried by a threat model, or a language rule set for code where a wrong index is a remote code execution.",
83
+ "defaultValue": "asvs-l1",
84
+ "options": [
85
+ {
86
+ "value": "asvs-l1",
87
+ "label": "OWASP ASVS level 1",
88
+ "description": "The ASVS Level 1 controls: the ones that can be verified automatically or with a black-box test, mapped to lint rules, tests and scanners. Pick it for most applications: anything without personal, financial or health data, as the floor every element reaches."
89
+ },
90
+ {
91
+ "value": "asvs-l2",
92
+ "label": "OWASP ASVS level 2, with a threat model as the Threat modelling pack decides",
93
+ "description": "ASVS Level 2: everything in Level 1, plus design-level controls, carried by the threat model the Threat modelling pack decides (when it is made, with which method, where it lives). Pick it for applications handling personal, financial or health data, or where a flaw in one feature's design would be a reportable incident."
94
+ },
95
+ {
96
+ "value": "cert-misra",
97
+ "label": "a language coding standard (SEI CERT or MISRA)",
98
+ "description": "SEI CERT C/C++ or Java, or MISRA C:2023, checked by a compliant analyser in CI: bounds checks, no banned functions, integer overflow handled, deviations recorded. Pick it for embedded, safety-related or systems-level code in C, C++ or Rust-with-unsafe, where memory corruption is the vulnerability class that matters."
99
+ }
100
+ ]
101
+ },
102
+ {
103
+ "key": "INPUT",
104
+ "title": "Input",
105
+ "label": "Where is input validated?",
106
+ "hint": "Validation at one boundary gives the inside typed values and one place to look; validation everywhere is what a library needs when it does not know who calls it.",
107
+ "defaultValue": "boundary-schema",
108
+ "options": [
109
+ {
110
+ "value": "boundary-schema",
111
+ "label": "once at the boundary, against a schema",
112
+ "description": "Every request, message and file is validated against a declared schema (zod or valibot, Pydantic, Bean Validation or JSON Schema) before any handler runs; the inside trusts the typed values. Pick it for services and web apps with a clear boundary (HTTP, a queue consumer, a file import)."
113
+ },
114
+ {
115
+ "value": "everywhere",
116
+ "label": "defensively, at every layer",
117
+ "description": "Every exported function and handler checks its own arguments for type, range, length and allowed values. Pick it for libraries, SDKs and code called from many places, where no single boundary exists; it costs duplicated checks and needs discipline about what each layer owns."
118
+ }
119
+ ]
120
+ },
121
+ {
122
+ "key": "SAST",
123
+ "title": "Static analysis",
124
+ "label": "How does static application security testing run?",
125
+ "hint": "A scanner on the pull request finds the flaw while the author still remembers the code; a scheduled one finds it later and hands it to a queue. The lint rules for banned constructs and string-built queries run in every case; this is about the scanner suites.",
126
+ "defaultValue": "pr-blocking",
127
+ "options": [
128
+ {
129
+ "value": "pr-blocking",
130
+ "label": "a scan of every pull request that blocks the merge on high findings",
131
+ "description": "Semgrep (p/owasp-top-ten, p/default), CodeQL security-extended and the language's scanner (Bandit, gosec, SpotBugs find-sec-bugs) run as required checks; a high or critical finding without a reviewed suppression stops the merge. Pick it for anything reached from the internet or holding personal data."
132
+ },
133
+ {
134
+ "value": "scheduled",
135
+ "label": "a nightly scan with findings triaged within a deadline",
136
+ "description": "The same scanners run on a schedule over the default branch, and every new finding gets an owner and a deadline from a triage queue. Pick it for a codebase with a large backlog of findings you are working through, or where the scanners are too slow or noisy for the pull request; move to blocking once the queue is empty."
137
+ },
138
+ {
139
+ "value": "none",
140
+ "label": "no scanner suite, code review only",
141
+ "description": "No Semgrep or CodeQL suite; the lint rules for banned constructs and string-built queries still run on the pull request, and reviewers check the rest against the standard's checklist. Pick it only for small internal tools with no outside callers and no personal data, and record it so that the first external caller supersedes this decision."
142
+ }
143
+ ]
144
+ },
145
+ {
146
+ "key": "DAST",
147
+ "title": "Dynamic testing",
148
+ "label": "How does dynamic security testing run?",
149
+ "hint": "Static analysis sees the code; a dynamic scan sees what the deployed system exposes: headers, cookies, error pages, forgotten routes.",
150
+ "defaultValue": "pipeline",
151
+ "options": [
152
+ {
153
+ "value": "pipeline",
154
+ "label": "a ZAP scan of each environment the pipeline deploys to",
155
+ "description": "An OWASP ZAP baseline scan (or API scan from the OpenAPI document) runs against every environment the pipeline deploys to, and a high alert fails the deployment's check. Pick it when the pipeline deploys to an environment it can reach, which is most pipelines."
156
+ },
157
+ {
158
+ "value": "periodic",
159
+ "label": "a scheduled ZAP full scan",
160
+ "description": "A ZAP full scan runs on a schedule against staging, and its findings enter the same deadlines; how often an external penetration test runs is decided in the Secure development process pack. Pick it when deployments are rare or the pipeline cannot reach the running system."
161
+ },
162
+ {
163
+ "value": "none",
164
+ "label": "no dynamic testing",
165
+ "description": "No dynamic testing. Pick it only for an element with no HTTP or network surface of its own (a batch job, a library), where fuzzing or unit tests cover its inputs instead."
166
+ }
167
+ ]
168
+ },
169
+ {
170
+ "key": "FINDINGS",
171
+ "title": "Findings",
172
+ "label": "What happens to a security finding?",
173
+ "hint": "A deadline by severity turns a finding into work; a signed acceptance with an expiry date is the only honest way to leave one open.",
174
+ "defaultValue": "sla",
175
+ "options": [
176
+ {
177
+ "value": "sla",
178
+ "label": "a deadline by severity",
179
+ "description": "Every finding (scanner, pentest, review, bug bounty) is fixed within its severity's deadline, and the main branch's build fails on an overdue one. Pick it when the team can fix what the scanners find; it is the simplest rule and the hardest to argue with."
180
+ },
181
+ {
182
+ "value": "risk-accepted",
183
+ "label": "a deadline by severity, or a written acceptance until a date",
184
+ "description": "The same deadlines, but a finding may be left open with a written risk acceptance in a register, signed by the owner and a second person from security, that expires. Pick it for codebases with findings nobody can fix in time (a vendor library, a legacy module slated for replacement); every acceptance comes up again when it expires."
185
+ }
186
+ ]
187
+ },
188
+ {
189
+ "key": "CRITICAL_DAYS",
190
+ "label": "Days to fix a critical finding in our code",
191
+ "defaultValue": "2",
192
+ "type": "number"
193
+ },
194
+ {
195
+ "key": "HIGH_DAYS",
196
+ "label": "Days to fix a high finding in our code",
197
+ "defaultValue": "7",
198
+ "type": "number"
199
+ },
200
+ {
201
+ "key": "MEDIUM_DAYS",
202
+ "label": "Days to fix a medium finding in our code",
203
+ "defaultValue": "30",
204
+ "type": "number"
205
+ },
206
+ {
207
+ "key": "ACCEPTANCE_DAYS",
208
+ "label": "Most days a risk acceptance stays valid. Only with written acceptances",
209
+ "defaultValue": "90",
210
+ "type": "number"
211
+ },
212
+ {
213
+ "key": "SAST_MINUTES",
214
+ "label": "Within how many minutes must the static analysis of a pull request finish? Only with a scan of every pull request",
215
+ "defaultValue": "10",
216
+ "type": "number"
217
+ },
218
+ {
219
+ "key": "DAST_DAYS",
220
+ "label": "Most days between two ZAP full scans of the production configuration. Only with a scheduled ZAP full scan",
221
+ "defaultValue": "90",
222
+ "type": "number"
223
+ }
224
+ ]
225
+ },
226
+ "nodes": [
227
+ {
228
+ "id": "need",
229
+ "type": "need",
230
+ "label": "The code has no known class of hole",
231
+ "x": 0,
232
+ "y": 0,
233
+ "kind": "brief",
234
+ "source": "Hub concern pack: Secure coding",
235
+ "description": "The element's own code must not let an attacker inject a query or a command, run their script in another user's browser, read or change data they may not, deserialise their objects or overrun a buffer. Developers must know which standard a change is held to, where input is checked and output encoded, and a tool must tell them on the pull request when they slipped, before a reviewer and long before an attacker. A finding, from a scanner, a test or a report, must be fixed by a deadline or accepted in writing by someone who may accept it, for a limited time."
236
+ },
237
+ {
238
+ "id": "req-param-queries",
239
+ "type": "requirement",
240
+ "label": "Queries are parameterised",
241
+ "x": 260,
242
+ "y": 0,
243
+ "ears_type": "ubiquitous",
244
+ "action": "pass every value that reaches a database, directory, OS command or interpreter as a bound parameter of a prepared statement or through the ORM's query builder, and build 0 queries or commands by string concatenation, interpolation or formatting",
245
+ "rationale": "Injection is OWASP Top 10 A03:2021; a parameterised query keeps data from ever being parsed as code, whatever the input holds, and is the one defence that needs no judgement per call site (OWASP SQL Injection Prevention Cheat Sheet, Option 1; ASVS 4.0.3 V5.3.4, V5.3.8)."
246
+ },
247
+ {
248
+ "id": "req-output-encoding",
249
+ "type": "requirement",
250
+ "label": "Output encoded by the template engine",
251
+ "x": 260,
252
+ "y": 130,
253
+ "ears_type": "ubiquitous",
254
+ "action": "render every value in HTML, attributes, JavaScript, CSS and URLs through the template engine's contextual auto-escaping (React, Jinja2 and Django templates with autoescape on, Thymeleaf, Razor), and write to 0 raw-HTML sinks (innerHTML, dangerouslySetInnerHTML, |safe, Html.Raw) from data that came from outside, with a sanitiser (DOMPurify) as the only exception for rich text",
255
+ "rationale": "Cross-site scripting is the oldest entry in the Top 10 and is prevented by encoding at the output, in the context the value lands in, which the template engine does on every value when nobody bypasses it (OWASP XSS Prevention Cheat Sheet; ASVS 4.0.3 V5.3.1, V5.3.3).",
256
+ "hubWhen": {
257
+ "STANDARD": [
258
+ "asvs-l1",
259
+ "asvs-l2"
260
+ ]
261
+ }
262
+ },
263
+ {
264
+ "id": "req-input-boundary",
265
+ "type": "requirement",
266
+ "label": "Input validated at the boundary",
267
+ "x": 260,
268
+ "y": 260,
269
+ "ears_type": "event-driven",
270
+ "trigger": "a request, message or file arrives at the element's boundary",
271
+ "action": "validate it against a declared schema (zod or valibot, Pydantic, Bean Validation or JSON Schema) that refuses unknown fields, before any handler runs; reject an invalid one with status 400 (or the protocol's equivalent) that names every failing field and carries no stack trace; and let code inside the boundary work with the typed, validated values only",
272
+ "rationale": "Validation in one place with a schema is validation someone can read and test; naming the field makes rejections usable for honest clients and gives attackers nothing they did not send (OWASP Input Validation Cheat Sheet: allow-list validation at the boundary; ASVS 4.0.3 V5.1.3, V5.1.4; OWASP Proactive Controls 2024, C3: Validate all Input and Handle Exceptions).",
273
+ "hubWhen": {
274
+ "INPUT": [
275
+ "boundary-schema"
276
+ ]
277
+ }
278
+ },
279
+ {
280
+ "id": "req-input-everywhere",
281
+ "type": "requirement",
282
+ "label": "Every layer checks its arguments",
283
+ "x": 260,
284
+ "y": 390,
285
+ "ears_type": "ubiquitous",
286
+ "action": "check the arguments of every exported function and every message handler for type, range, length and allowed values before using them, fail with a typed error that names the argument, and never assume a caller in the same process has validated them",
287
+ "rationale": "A library or shared module has as many boundaries as callers; a check it does not do itself depends on every caller doing it (OWASP Input Validation Cheat Sheet; SEI CERT API00-C and MET00-J: validate the arguments of exported functions and methods).",
288
+ "hubWhen": {
289
+ "INPUT": [
290
+ "everywhere"
291
+ ]
292
+ }
293
+ },
294
+ {
295
+ "id": "req-no-dynamic-code",
296
+ "type": "requirement",
297
+ "label": "Dangerous constructs banned by lint",
298
+ "x": 260,
299
+ "y": 520,
300
+ "ears_type": "unwanted-behaviour",
301
+ "unwanted_condition": "a change introduces eval or new Function, OS command execution with an interpolated string, deserialisation of untrusted data (pickle, ObjectInputStream, BinaryFormatter), a regular expression or a file path built from input, or a function the standard bans",
302
+ "action": "fail the lint of the pull request naming the file and line, unless a reviewed suppression with the reason is written beside it",
303
+ "rationale": "Code built from data is injection by another name, and deserialising untrusted objects is remote code execution in most runtimes; a ban enforced by lint costs nothing per review (OWASP Top 10 A03:2021 and A08:2021; ASVS 4.0.3 V5.2.4, V5.5.1, V5.5.3; OWASP Proactive Controls 2024, C3)."
304
+ },
305
+ {
306
+ "id": "req-framework-defaults",
307
+ "type": "requirement",
308
+ "label": "Framework defenses on by default",
309
+ "x": 260,
310
+ "y": 650,
311
+ "ears_type": "ubiquitous",
312
+ "action": "take CSRF protection, CORS, cookie flags (Secure, HttpOnly, SameSite) and the security headers from the framework's middleware configured once at start (helmet and a CSRF middleware for Express, Spring Security's defaults, Django's SecurityMiddleware and CsrfViewMiddleware, ASP.NET Core antiforgery), with the framework's strict modes on, and write 0 hand-rolled replacements; where a gateway sets the headers, set none in the code that conflict",
313
+ "rationale": "The framework's security middleware is reviewed by more people than any hand-rolled version and is wrong only where it is turned off (OWASP Proactive Controls 2024, C5: Secure by Default Configurations; OWASP Top 10 A05:2021; ASVS 4.0.3 V4.2.2, V14.4, V14.5).",
314
+ "hubWhen": {
315
+ "STANDARD": [
316
+ "asvs-l1",
317
+ "asvs-l2"
318
+ ]
319
+ }
320
+ },
321
+ {
322
+ "id": "req-sast-pr",
323
+ "type": "requirement",
324
+ "label": "Static analysis on every change",
325
+ "x": 260,
326
+ "y": 780,
327
+ "ears_type": "event-driven",
328
+ "trigger": "a pull request is opened or updated",
329
+ "action": "run static application security testing (Semgrep with p/owasp-top-ten and p/default, CodeQL security-extended, and the language's scanner: Bandit, gosec or SpotBugs find-sec-bugs) within {{SAST_MINUTES}} minutes, and block the merge on any high or critical finding not covered by a reviewed suppression",
330
+ "rationale": "A flaw found on the pull request is fixed by its author in minutes; the same flaw found later is a ticket (NIST SSDF PW.7, PW.8; GitHub CodeQL documentation: code scanning as a required check).",
331
+ "hubWhen": {
332
+ "SAST": [
333
+ "pr-blocking"
334
+ ]
335
+ }
336
+ },
337
+ {
338
+ "id": "req-sast-scheduled",
339
+ "type": "requirement",
340
+ "label": "Scheduled findings triaged",
341
+ "x": 260,
342
+ "y": 910,
343
+ "ears_type": "event-driven",
344
+ "trigger": "the scheduled static analysis reports a new high or critical finding",
345
+ "action": "give it an owner from the triage queue within 1 working day, recorded as an assigned issue that names the alert, after which the deadline of its severity runs",
346
+ "rationale": "A scheduled scan without triage produces a list nobody owns; the working-day limit on triage keeps the deadlines meaningful (NIST SSDF RV.1, RV.2).",
347
+ "hubWhen": {
348
+ "SAST": [
349
+ "scheduled"
350
+ ]
351
+ }
352
+ },
353
+ {
354
+ "id": "req-dast-pipeline",
355
+ "type": "requirement",
356
+ "label": "Deployed environments scanned",
357
+ "x": 260,
358
+ "y": 1040,
359
+ "ears_type": "event-driven",
360
+ "trigger": "a build is deployed to an environment of the pipeline (ephemeral, staging or production)",
361
+ "action": "run an OWASP ZAP baseline scan, or the API scan from the OpenAPI document, against it within 30 minutes, fail the deployment's check on an alert raised to FAIL, and keep the report with the build",
362
+ "rationale": "What the running system exposes (missing headers, verbose errors, forgotten routes, reflected input) is visible only to a scan of the running system (OWASP ZAP documentation: baseline and API scans; NIST SSDF PW.8).",
363
+ "hubWhen": {
364
+ "DAST": [
365
+ "pipeline"
366
+ ]
367
+ }
368
+ },
369
+ {
370
+ "id": "req-dast-periodic",
371
+ "type": "requirement",
372
+ "label": "Full scans stay recent",
373
+ "x": 260,
374
+ "y": 1170,
375
+ "ears_type": "state-driven",
376
+ "precondition": "the last ZAP full scan of the production configuration is more than {{DAST_DAYS}} days old",
377
+ "action": "run a new one within 14 days, and put each of its high and critical findings under the deadlines of its severity as code scanning alerts",
378
+ "rationale": "A dynamic scan ages with every release; a bound on its age is what keeps \"we scanned it\" from meaning a scan of a configuration three releases old (NIST SSDF PW.8; OWASP ZAP documentation: full scan). External penetration tests and how often they run are decided in the Secure development process pack.",
379
+ "hubWhen": {
380
+ "DAST": [
381
+ "periodic"
382
+ ]
383
+ }
384
+ },
385
+ {
386
+ "id": "req-findings-sla",
387
+ "type": "requirement",
388
+ "label": "Findings fixed by deadline",
389
+ "x": 260,
390
+ "y": 1300,
391
+ "ears_type": "state-driven",
392
+ "precondition": "an open security finding (static analysis, dynamic scan, penetration test, review or report) is older than its deadline: {{CRITICAL_DAYS}} days for critical, {{HIGH_DAYS}} for high, {{MEDIUM_DAYS}} for medium",
393
+ "action": "fail the main branch's build and the release, naming the finding, until it is fixed",
394
+ "rationale": "A deadline the build enforces is the only one that holds under delivery pressure (NIST SSDF RV.2; the same rule for vulnerable dependencies is decided in Software supply chain).",
395
+ "hubWhen": {
396
+ "FINDINGS": [
397
+ "sla"
398
+ ]
399
+ }
400
+ },
401
+ {
402
+ "id": "req-risk-accepted",
403
+ "type": "requirement",
404
+ "label": "Open findings accepted in writing",
405
+ "x": 260,
406
+ "y": 1430,
407
+ "ears_type": "state-driven",
408
+ "precondition": "a security finding cannot be fixed within its deadline ({{CRITICAL_DAYS}} days for critical, {{HIGH_DAYS}} for high, {{MEDIUM_DAYS}} for medium)",
409
+ "action": "keep it open only with a risk acceptance in the register that names the finding, the owner, a second approver from security, the reason and the compensating controls, and expires after at most {{ACCEPTANCE_DAYS}} days; fail the main branch's build on an overdue finding without a valid acceptance and on an expired acceptance",
410
+ "rationale": "A written acceptance with an expiry date keeps the decision visible and brings it back for a new one; an open finding without one is a decision nobody made (NIST SSDF RV.2.2; Threat Modeling Manifesto: a dialogue about risk, recorded).",
411
+ "hubWhen": {
412
+ "FINDINGS": [
413
+ "risk-accepted"
414
+ ]
415
+ }
416
+ },
417
+ {
418
+ "id": "req-authz-tests",
419
+ "type": "requirement",
420
+ "label": "Negative tests on sensitive paths",
421
+ "x": 260,
422
+ "y": 1560,
423
+ "ears_type": "ubiquitous",
424
+ "action": "cover every authorization-sensitive operation (reading or changing another user's or tenant's data, admin functions, object ids taken from the request) with negative tests that call it as the wrong user, the wrong tenant and anonymously and expect 403 or 404 and 401, kept in the pull-request suite and tagged with the operation they cover",
425
+ "rationale": "Broken access control is OWASP Top 10 A01:2021 and no scanner finds it, because the code is correct for the right user; only a test that is the wrong user does (ASVS 4.0.3 V4.1.1, V4.1.3; the rules themselves are decided in Authorization)."
426
+ },
427
+ {
428
+ "id": "req-memory-safety",
429
+ "type": "requirement",
430
+ "label": "Memory safety rules",
431
+ "x": 260,
432
+ "y": 1690,
433
+ "ears_type": "ubiquitous",
434
+ "action": "check every array index and buffer length before use, use only bounded string and memory functions (snprintf, strlcpy or strncpy_s, memcpy with a checked length), check integer arithmetic on sizes and indices for overflow, run the tests under AddressSanitizer and UndefinedBehaviorSanitizer, and ban gets, strcpy, strcat, sprintf, scanf without field widths, system and alloca by the analyser, with every deviation recorded",
435
+ "rationale": "In unmanaged code the vulnerability class that matters is memory corruption, and the standards name the rules that prevent it (SEI CERT ARR30-C, STR31-C, INT30-C, ENV33-C; MISRA C:2023 Rule 21.6, Rule 21.8, Directive 4.11, Directive 4.14).",
436
+ "hubWhen": {
437
+ "STANDARD": [
438
+ "cert-misra"
439
+ ]
440
+ }
441
+ },
442
+ {
443
+ "id": "sc-param-queries",
444
+ "type": "scenario",
445
+ "label": "Injection goes nowhere",
446
+ "x": 520,
447
+ "y": 0,
448
+ "given": "a request whose search field holds ' OR 1=1 --",
449
+ "when": "it is handled",
450
+ "then": "the database receives the string as a bound parameter, the query returns no extra rows, and the lint finds 0 string-built queries in the code"
451
+ },
452
+ {
453
+ "id": "sc-output-encoding",
454
+ "type": "scenario",
455
+ "label": "Script rendered as text",
456
+ "x": 520,
457
+ "y": 130,
458
+ "given": "a user whose display name is <script>alert(1)</script>",
459
+ "when": "a page that shows the name is rendered",
460
+ "then": "the response holds the name entity-encoded, no script runs, and the lint finds 0 raw-HTML sinks fed from request or database data",
461
+ "hubWhen": {
462
+ "STANDARD": [
463
+ "asvs-l1",
464
+ "asvs-l2"
465
+ ]
466
+ }
467
+ },
468
+ {
469
+ "id": "sc-input-boundary",
470
+ "type": "scenario",
471
+ "label": "Malformed request named",
472
+ "x": 520,
473
+ "y": 260,
474
+ "given": "a POST /orders with quantity \"two\" and an unknown field \"extra\"",
475
+ "when": "it arrives",
476
+ "then": "the answer is 400 and names quantity and extra, no handler ran, and the body holds no stack trace or class name",
477
+ "hubWhen": {
478
+ "INPUT": [
479
+ "boundary-schema"
480
+ ]
481
+ }
482
+ },
483
+ {
484
+ "id": "sc-input-everywhere",
485
+ "type": "scenario",
486
+ "label": "Bad argument refused",
487
+ "x": 520,
488
+ "y": 390,
489
+ "given": "an exported function that takes a length",
490
+ "when": "it is called with -1 and with 2^31",
491
+ "then": "both calls fail with a typed error naming the argument and nothing is read or written",
492
+ "hubWhen": {
493
+ "INPUT": [
494
+ "everywhere"
495
+ ]
496
+ }
497
+ },
498
+ {
499
+ "id": "sc-no-dynamic-code",
500
+ "type": "scenario",
501
+ "label": "eval refused",
502
+ "x": 520,
503
+ "y": 520,
504
+ "given": "a pull request that adds eval(req.query.expr) and a child_process.exec with a template string",
505
+ "when": "the lint runs",
506
+ "then": "it fails naming both lines and the pull request cannot merge"
507
+ },
508
+ {
509
+ "id": "sc-framework-defaults",
510
+ "type": "scenario",
511
+ "label": "Forged request refused",
512
+ "x": 520,
513
+ "y": 650,
514
+ "given": "the element started with its production configuration",
515
+ "when": "a state-changing request arrives without the CSRF token and a response is inspected",
516
+ "then": "the request is refused with 403, and the response carries the middleware's headers and cookie flags",
517
+ "hubWhen": {
518
+ "STANDARD": [
519
+ "asvs-l1",
520
+ "asvs-l2"
521
+ ]
522
+ }
523
+ },
524
+ {
525
+ "id": "sc-sast-pr",
526
+ "type": "scenario",
527
+ "label": "High finding blocks merge",
528
+ "x": 520,
529
+ "y": 780,
530
+ "given": "a pull request that adds a SQL query built from a request parameter",
531
+ "when": "its checks run",
532
+ "then": "the static analysis reports it as high within {{SAST_MINUTES}} minutes and the pull request cannot merge",
533
+ "hubWhen": {
534
+ "SAST": [
535
+ "pr-blocking"
536
+ ]
537
+ }
538
+ },
539
+ {
540
+ "id": "sc-sast-scheduled",
541
+ "type": "scenario",
542
+ "label": "Finding gets an owner",
543
+ "x": 520,
544
+ "y": 910,
545
+ "given": "a nightly scan that reports a new high finding",
546
+ "when": "1 working day has passed",
547
+ "then": "an issue naming the alert has an assignee, and the finding's due date is {{HIGH_DAYS}} days from the report",
548
+ "hubWhen": {
549
+ "SAST": [
550
+ "scheduled"
551
+ ]
552
+ }
553
+ },
554
+ {
555
+ "id": "sc-dast-pipeline",
556
+ "type": "scenario",
557
+ "label": "Missing policy caught",
558
+ "x": 520,
559
+ "y": 1040,
560
+ "given": "a build that drops the Content-Security-Policy header",
561
+ "when": "it is deployed to the ephemeral environment",
562
+ "then": "the ZAP scan reports the FAIL alert within 30 minutes and the deployment's check fails",
563
+ "hubWhen": {
564
+ "DAST": [
565
+ "pipeline"
566
+ ]
567
+ }
568
+ },
569
+ {
570
+ "id": "sc-dast-periodic",
571
+ "type": "scenario",
572
+ "label": "Stale test renewed",
573
+ "x": 520,
574
+ "y": 1170,
575
+ "given": "a production configuration whose last ZAP full scan is {{DAST_DAYS}} days old",
576
+ "when": "the age check runs",
577
+ "then": "it fails, and within 14 days a new report is on file with its findings tracked",
578
+ "hubWhen": {
579
+ "DAST": [
580
+ "periodic"
581
+ ]
582
+ }
583
+ },
584
+ {
585
+ "id": "sc-findings-sla",
586
+ "type": "scenario",
587
+ "label": "Overdue finding stops release",
588
+ "x": 520,
589
+ "y": 1300,
590
+ "given": "a high finding opened {{HIGH_DAYS}} days ago and still open",
591
+ "when": "the main branch builds",
592
+ "then": "the build fails naming the finding and no release is made",
593
+ "hubWhen": {
594
+ "FINDINGS": [
595
+ "sla"
596
+ ]
597
+ }
598
+ },
599
+ {
600
+ "id": "sc-risk-accepted",
601
+ "type": "scenario",
602
+ "label": "Acceptance expires",
603
+ "x": 520,
604
+ "y": 1430,
605
+ "given": "a high finding accepted {{ACCEPTANCE_DAYS}} days ago with a reason and two signatures",
606
+ "when": "the main branch builds the next day",
607
+ "then": "the build fails naming the finding and its expired acceptance",
608
+ "hubWhen": {
609
+ "FINDINGS": [
610
+ "risk-accepted"
611
+ ]
612
+ }
613
+ },
614
+ {
615
+ "id": "sc-authz-tests",
616
+ "type": "scenario",
617
+ "label": "Wrong user refused",
618
+ "x": 520,
619
+ "y": 1560,
620
+ "given": "order 42 that belongs to customer A",
621
+ "when": "customer B and an anonymous caller GET /orders/42",
622
+ "then": "customer B gets 404 or 403, the anonymous caller 401, and the test runs in the pull-request suite tagged with the route"
623
+ },
624
+ {
625
+ "id": "sc-memory-safety",
626
+ "type": "scenario",
627
+ "label": "Overflow refused",
628
+ "x": 520,
629
+ "y": 1690,
630
+ "given": "a function that copies a caller-supplied string into a fixed buffer",
631
+ "when": "it is called with a string longer than the buffer under AddressSanitizer",
632
+ "then": "the copy is truncated or refused with an error, the sanitizer reports 0 overflows, and the analyser flags 0 banned functions",
633
+ "hubWhen": {
634
+ "STANDARD": [
635
+ "cert-misra"
636
+ ]
637
+ }
638
+ },
639
+ {
640
+ "id": "adr-asvs-l1",
641
+ "type": "adr",
642
+ "label": "OWASP ASVS level 1, verified by tools",
643
+ "x": 780,
644
+ "y": 0,
645
+ "concern": "secure-coding",
646
+ "status": "accepted",
647
+ "date": "",
648
+ "context": "Code is written for this element every week, by people who are thinking about the feature, not about the attacker. The forces: the same few vulnerability classes (injection, broken access control, cross-site scripting, unsafe deserialisation, memory corruption in unmanaged code) account for most breaches year after year, and every one of them is a pattern a tool can find; a standard nobody can check against becomes a document nobody reads; validation spread over every layer is validation nobody owns, while validation nowhere lets a string reach the query; static analysis that blocks the merge stops new flaws but stalls work on a false positive, and analysis that only reports fills a queue nobody empties; dynamic testing finds what the running system exposes, but only in an environment someone deploys to; and a finding without a deadline or a signed acceptance is a finding that stays open. What goes into the build (dependencies, base images) and the deadlines for vulnerable dependencies are decided in Software supply chain, credentials in Secrets, who may call what in Authentication and Authorization; this concern is about the code itself, and its deadlines are for findings in our own code. The snippets assume a TypeScript service with its routes in src/app.ts and tests under tests/; Python, Go, the JVM and C get their own tool named beside each.",
649
+ "decision": "The code is held to OWASP ASVS Level 1 (4.0.3, moving to 5.0), and every Level 1 control is mapped to a lint rule, a test or a scanner rather than to a document. Data reaches the database only through parameterised queries or the ORM's query builder, checked by a lint rule on every pull request; output goes through the template engine's auto-escaping and raw-HTML sinks are banned by lint; eval, dynamic code, shell commands with interpolated strings and deserialisation of untrusted data are banned by lint (eslint-plugin-security with no-eval and react/no-danger, Bandit, gosec, SpotBugs find-sec-bugs by language); CSRF, CORS, cookie flags and security headers come from the framework's middleware with secure defaults. Input is validated {{INPUT}}. Static analysis: {{SAST}}. Dynamic testing: {{DAST}}. A finding gets {{FINDINGS}}: critical within {{CRITICAL_DAYS}} days, high {{HIGH_DAYS}}, medium {{MEDIUM_DAYS}}. Authorization-sensitive paths have negative tests. Dependencies and base images are decided in Software supply chain, credentials in Secrets, who may call what in Authentication and Authorization.",
650
+ "consequences": "• Most of the standard is checked on every change by tools; a reviewer checks the rest from a short list.\n• Level 1 verifies code, not design: a feature with a flawed design passes if its code is clean, which is what Level 2's design-level controls, carried by the threat model, add.\n• Lint bans are blunt: the reporting query built from an allow-list of column names needs a suppression with a reason, and reviewers must read suppressions.\n• Needs a framework with auto-escaping and security middleware; hand-rolled HTTP handling has to add both.",
651
+ "alternatives": "1. ASVS Level 2: adds design-level controls, carried by the threat model the Threat modelling pack decides; the right bar for personal, financial or health data.\n2. A language coding standard (SEI CERT, MISRA): for C, C++ and embedded code, where the classes of flaw are different.\n3. The OWASP Top 10 as the only checklist: an awareness document, too coarse to map to checks.",
652
+ "hubWhen": {
653
+ "STANDARD": [
654
+ "asvs-l1"
655
+ ]
656
+ }
657
+ },
658
+ {
659
+ "id": "adr-asvs-l2",
660
+ "type": "adr",
661
+ "label": "OWASP ASVS level 2, with a threat model as the Threat modelling pack decides",
662
+ "x": 780,
663
+ "y": 130,
664
+ "concern": "secure-coding",
665
+ "status": "accepted",
666
+ "date": "",
667
+ "context": "Code is written for this element every week, by people who are thinking about the feature, not about the attacker. The forces: the same few vulnerability classes (injection, broken access control, cross-site scripting, unsafe deserialisation, memory corruption in unmanaged code) account for most breaches year after year, and every one of them is a pattern a tool can find; a standard nobody can check against becomes a document nobody reads; validation spread over every layer is validation nobody owns, while validation nowhere lets a string reach the query; static analysis that blocks the merge stops new flaws but stalls work on a false positive, and analysis that only reports fills a queue nobody empties; dynamic testing finds what the running system exposes, but only in an environment someone deploys to; and a finding without a deadline or a signed acceptance is a finding that stays open. What goes into the build (dependencies, base images) and the deadlines for vulnerable dependencies are decided in Software supply chain, credentials in Secrets, who may call what in Authentication and Authorization; this concern is about the code itself, and its deadlines are for findings in our own code. The snippets assume a TypeScript service with its routes in src/app.ts and tests under tests/; Python, Go, the JVM and C get their own tool named beside each.",
668
+ "decision": "The code is held to OWASP ASVS Level 2 (4.0.3, moving to 5.0): every Level 1 control is mapped to a lint rule, a test or a scanner, and the design-level controls are carried by the threat model the Threat modelling pack decides: when it is made and redone, with which method, where it lives and how each threat ends are that pack's decisions, and this one relies on them. Data reaches the database only through parameterised queries or the ORM's query builder, checked by a lint rule on every pull request; output goes through the template engine's auto-escaping and raw-HTML sinks are banned by lint; eval, dynamic code, shell commands with interpolated strings and deserialisation of untrusted data are banned by lint (eslint-plugin-security, Bandit, gosec, SpotBugs find-sec-bugs by language); CSRF, CORS, cookie flags and security headers come from the framework's middleware. Input is validated {{INPUT}}. Static analysis: {{SAST}}. Dynamic testing: {{DAST}}. A finding gets {{FINDINGS}}: critical within {{CRITICAL_DAYS}} days, high {{HIGH_DAYS}}, medium {{MEDIUM_DAYS}}. Authorization-sensitive paths have negative tests. Dependencies and base images are decided in Software supply chain, credentials in Secrets, who may call what in Authentication and Authorization.",
669
+ "consequences": "• Design flaws (a missing check on a new trust boundary, a data store nobody thought about) are found in the threat model, before an attacker finds them in the code.\n• Level 2 holds only while the threat model is current; this pack's checks do not verify that, the Threat modelling pack's checks do.\n• More controls to map and verify than Level 1, and the design-level ones need people, not scanners.\n• Level 2 also expects verification by someone other than the author; external penetration tests and how often they run are decided in the Secure development process pack.",
670
+ "alternatives": "1. ASVS Level 1: the same tools without the design-level controls; enough where a design flaw is not a reportable incident.\n2. ASVS Level 3: adds verification of every control by a reviewer and architecture-level requirements; for systems where a breach endangers life or critical infrastructure.\n3. The OWASP Top 10 as the only checklist: an awareness document, too coarse to map to checks.",
671
+ "hubWhen": {
672
+ "STANDARD": [
673
+ "asvs-l2"
674
+ ]
675
+ }
676
+ },
677
+ {
678
+ "id": "adr-cert-misra",
679
+ "type": "adr",
680
+ "label": "A language coding standard checked by an analyser",
681
+ "x": 780,
682
+ "y": 260,
683
+ "concern": "secure-coding",
684
+ "status": "accepted",
685
+ "date": "",
686
+ "context": "Code is written for this element every week, by people who are thinking about the feature, not about the attacker. The forces: the same few vulnerability classes (injection, broken access control, cross-site scripting, unsafe deserialisation, memory corruption in unmanaged code) account for most breaches year after year, and every one of them is a pattern a tool can find; a standard nobody can check against becomes a document nobody reads; validation spread over every layer is validation nobody owns, while validation nowhere lets a string reach the query; static analysis that blocks the merge stops new flaws but stalls work on a false positive, and analysis that only reports fills a queue nobody empties; dynamic testing finds what the running system exposes, but only in an environment someone deploys to; and a finding without a deadline or a signed acceptance is a finding that stays open. What goes into the build (dependencies, base images) and the deadlines for vulnerable dependencies are decided in Software supply chain, credentials in Secrets, who may call what in Authentication and Authorization; this concern is about the code itself, and its deadlines are for findings in our own code. The snippets assume a TypeScript service with its routes in src/app.ts and tests under tests/; Python, Go, the JVM and C get their own tool named beside each.",
687
+ "decision": "The code is held to a language coding standard: SEI CERT C/C++ (or CERT Java) for application and systems code, MISRA C:2023 where a safety standard or a customer asks for it. Compliance is checked by an analyser in CI, not by reading: clang-tidy with the cert-*, bugprone-* and clang-analyzer-* checks as errors, cppcheck with the MISRA add-on, or a certified analyser (PC-lint Plus, Polyspace, Coverity) where the safety case needs one; the compiler runs with -Wall -Wextra -Werror, -fstack-protector-strong and _FORTIFY_SOURCE=2, and the tests under AddressSanitizer and UndefinedBehaviorSanitizer. Every array index and buffer length is checked, only bounded string functions are used, integer arithmetic on sizes is checked for overflow, and gets, strcpy, strcat, sprintf, scanf without widths, system and alloca are banned by the analyser; each deviation is recorded with its justification in a deviation record the analyser reads. Queries to any database go through bound parameters, checked by a lint rule. Input is validated {{INPUT}}. Security scanner suites beyond the analyser: {{SAST}}. Dynamic testing: {{DAST}}; with no HTTP surface, libFuzzer or AFL++ over every parser instead. A finding gets {{FINDINGS}}: critical within {{CRITICAL_DAYS}} days, high {{HIGH_DAYS}}, medium {{MEDIUM_DAYS}}. Dependencies and toolchains are decided in Software supply chain, credentials in Secrets.",
688
+ "consequences": "• The flaws that matter in unmanaged code (overruns, overflows, use after free) are caught by the analyser and the sanitizers, not by the customer.\n• The analyser reports many findings on an existing codebase; adopt it with a baseline and fix new code first, or the warnings are ignored.\n• MISRA's rules forbid constructs application developers use daily; deviations need a record and a reviewer, which takes time and a person who owns the standard.\n• A certified analyser costs licences; clang-tidy and cppcheck cover most of CERT and much of MISRA for free.",
689
+ "alternatives": "1. ASVS Level 1 or 2: the web application classes of flaw; wrong for code where the problem is memory.\n2. Rewriting in a memory-safe language (Rust, Go): removes the class rather than checking for it; a project, not a rule.\n3. Sanitizers and fuzzing only, no coding standard: finds what the tests reach, and nothing in the paths they do not.",
690
+ "hubWhen": {
691
+ "STANDARD": [
692
+ "cert-misra"
693
+ ]
694
+ }
695
+ },
696
+ {
697
+ "id": "ff-semgrep",
698
+ "type": "fitness-fn",
699
+ "label": "Semgrep on the code",
700
+ "x": 1040,
701
+ "y": 0,
702
+ "characteristic": "security",
703
+ "scope": "atomic",
704
+ "cadence": "triggered",
705
+ "trigger": "pull-request",
706
+ "invocation": "automated",
707
+ "description": "Semgrep runs the OWASP Top Ten and default rulesets and exits non-zero on an ERROR-severity finding; on the pull request it is a required check with a hard timeout, on a schedule it uploads SARIF to code scanning, where the findings get owners.\n\nThreshold: 0 findings of severity ERROR from p/owasp-top-ten and p/default; the run finishes within {{SAST_MINUTES}} minutes\n\nTool: Semgrep (semgrep scan with p/owasp-top-ten and p/default)\n\n```yaml\n# .github/workflows/semgrep.yml\nname: semgrep\non:\n pull_request: # blocking variant: a required check\n schedule: [{ cron: '0 3 * * *' }] # scheduled variant: findings to the queue\npermissions: { contents: read, security-events: write }\njobs:\n semgrep:\n runs-on: ubuntu-latest\n timeout-minutes: {{SAST_MINUTES}}\n container: { image: semgrep/semgrep:1.90.0 }\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - run: semgrep scan --config p/owasp-top-ten --config p/default --config .semgrep\n --severity ERROR --error --sarif --output semgrep.sarif\n - if: always()\n uses: github/codeql-action/upload-sarif@v3.28.0 # pin by commit SHA in your repository\n with: { sarif_file: semgrep.sarif }\n```",
708
+ "hubWhen": {
709
+ "SAST": [
710
+ "pr-blocking",
711
+ "scheduled"
712
+ ]
713
+ }
714
+ },
715
+ {
716
+ "id": "ff-codeql",
717
+ "type": "fitness-fn",
718
+ "label": "CodeQL security-extended",
719
+ "x": 1040,
720
+ "y": 130,
721
+ "characteristic": "security",
722
+ "scope": "atomic",
723
+ "cadence": "triggered",
724
+ "trigger": "pull-request",
725
+ "invocation": "automated",
726
+ "description": "CodeQL analyses each language of the repository with the security-extended query suite; code scanning's pull-request check is set to fail on high or above and is a required status check in branch protection. List only the languages the repository holds: autobuild fails for one with no sources.\n\nThreshold: 0 open code scanning alerts of severity high or critical on the pull request; the CodeQL check is required for merging\n\nTool: GitHub CodeQL (github/codeql-action)\n\n```yaml\n# .github/workflows/codeql.yml\nname: codeql\non:\n pull_request: { branches: [main] }\n push: { branches: [main] }\npermissions: { contents: read, security-events: write }\njobs:\n analyze:\n runs-on: ubuntu-latest\n strategy: { matrix: { language: [javascript-typescript] } } # add each language the repository holds\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: github/codeql-action/init@v3.28.0 # pin by commit SHA in your repository\n with:\n languages: ${{ matrix.language }}\n queries: security-extended\n - uses: github/codeql-action/autobuild@v3.28.0 # pin by commit SHA in your repository\n - uses: github/codeql-action/analyze@v3.28.0 # pin by commit SHA in your repository\n# Settings > Code security > Code scanning: \"Check failure: High or higher\";\n# branch protection requires the \"CodeQL\" check\n```",
727
+ "hubWhen": {
728
+ "SAST": [
729
+ "pr-blocking",
730
+ "scheduled"
731
+ ]
732
+ }
733
+ },
734
+ {
735
+ "id": "ff-language-scanner",
736
+ "type": "fitness-fn",
737
+ "label": "The language's security scanner",
738
+ "x": 1040,
739
+ "y": 260,
740
+ "characteristic": "security",
741
+ "scope": "atomic",
742
+ "cadence": "triggered",
743
+ "trigger": "pull-request",
744
+ "invocation": "automated",
745
+ "description": "Bandit (Python) and gosec (Go) run in the same job as Semgrep with their configuration in the repository, so their suppressions are reviewed like code; the JVM uses SpotBugs with find-sec-bugs, .NET the Security Code Scan analyzers.\n\nThreshold: 0 high-severity, medium-confidence-or-better findings from the language's scanner outside its suppressions, each suppression with a comment\n\nTool: Bandit and gosec (SpotBugs find-sec-bugs, Security Code Scan for other stacks)\n\n```toml\n# pyproject.toml\n[tool.bandit]\nexclude_dirs = [\"tests\", \".venv\"]\nskips = [] # every skip needs a reviewed reason here\n# CI: bandit -c pyproject.toml -r src --severity-level high --confidence-level medium\n# (exits 1 on a finding; suppress a line with # nosec B608: <reason>)\n\n# Go, in the same job:\n# gosec -severity high -confidence medium -fmt sarif -out gosec.sarif ./...\n# (exits 1 on a finding; suppress with // #nosec G201 -- <reason>)\n```",
746
+ "hubWhen": {
747
+ "SAST": [
748
+ "pr-blocking",
749
+ "scheduled"
750
+ ]
751
+ }
752
+ },
753
+ {
754
+ "id": "ff-eslint-security",
755
+ "type": "fitness-fn",
756
+ "label": "ESLint bans dangerous constructs",
757
+ "x": 1040,
758
+ "y": 390,
759
+ "characteristic": "security",
760
+ "scope": "atomic",
761
+ "cadence": "triggered",
762
+ "trigger": "pull-request",
763
+ "invocation": "automated",
764
+ "description": "The flat ESLint configuration turns the security plugin's rules and the core eval rules into errors and bans raw HTML in React; a disable comment needs a description, which eslint-comments/require-description enforces. Python and Java get the same bans from Bandit (B307 eval, B301 pickle) and find-sec-bugs.\n\nThreshold: 0 errors from eslint-plugin-security, no-eval, no-implied-eval, no-new-func and react/no-danger; the lint is a required check\n\nTool: ESLint with eslint-plugin-security and eslint-plugin-react\n\n```js\n// eslint.config.js\nimport security from 'eslint-plugin-security'\nimport react from 'eslint-plugin-react'\nimport comments from '@eslint-community/eslint-plugin-eslint-comments/configs'\n\nexport default [\n security.configs.recommended,\n comments.recommended,\n {\n plugins: { react },\n rules: {\n 'no-eval': 'error',\n 'no-implied-eval': 'error',\n 'no-new-func': 'error',\n 'security/detect-eval-with-expression': 'error',\n 'security/detect-child-process': 'error',\n 'security/detect-non-literal-regexp': 'error',\n 'security/detect-non-literal-fs-filename': 'error',\n 'react/no-danger': 'error',\n 'no-restricted-properties': ['error', { object: 'document', property: 'write' }],\n '@eslint-community/eslint-comments/require-description': 'error',\n },\n },\n]\n```",
765
+ "hubWhen": {
766
+ "STANDARD": [
767
+ "asvs-l1",
768
+ "asvs-l2"
769
+ ]
770
+ }
771
+ },
772
+ {
773
+ "id": "ff-sqli-lint",
774
+ "type": "fitness-fn",
775
+ "label": "No string-built queries",
776
+ "x": 1040,
777
+ "y": 520,
778
+ "characteristic": "security",
779
+ "scope": "atomic",
780
+ "cadence": "triggered",
781
+ "trigger": "pull-request",
782
+ "invocation": "automated",
783
+ "description": "Semgrep rules kept in the repository match query calls whose SQL is a template literal with an expression, a concatenation or a format call (JavaScript and TypeScript), and a buffer written by sprintf and then passed to a database call (C), and fail the pull request. They run as a lint rule whatever the scanner decision. SonarQube rules S2077 (formatted SQL) and S3649 (SQL injection) do the same for Java and C#, Bandit B608 for Python.\n\nThreshold: 0 queries built by concatenation, interpolation or formatting in the code; the rules are ERROR severity and part of the pull-request lint\n\nTool: Semgrep (repository rules; run with semgrep scan --config .semgrep --error); SonarQube S2077 / S3649 for Java and C#; Bandit B608 for Python\n\n```yaml\n# .semgrep/sql-string-built.yml\nrules:\n - id: sql-string-built\n message: SQL built from a string; bind the value as a parameter (ADR Secure coding)\n severity: ERROR\n languages: [javascript, typescript]\n metadata: { cwe: \"CWE-89\", owasp: \"A03:2021\" }\n patterns:\n - pattern-either:\n - pattern: $DB.query(`...${$X}...`, ...)\n - pattern: $DB.query($A + $B, ...)\n - pattern: $DB.query(`...`.concat(...), ...)\n - pattern: $DB.raw(`...${$X}...`)\n - pattern: $DB.whereRaw(`...${$X}...`)\n - metavariable-regex: { metavariable: $DB, regex: (?i)(db|pool|client|conn|sequelize|knex|prisma) }\n - id: sql-string-built-c\n message: SQL formatted into a buffer and executed; use a prepared statement with bound parameters (ADR Secure coding)\n severity: ERROR\n languages: [c]\n metadata: { cwe: \"CWE-89\" }\n patterns:\n - pattern: |\n $FMT($BUF, ...);\n ...\n $EXEC($DB, $BUF, ...);\n - metavariable-regex: { metavariable: $FMT, regex: ^(sprintf|snprintf|strcat|strcpy)$ }\n - metavariable-regex: { metavariable: $EXEC, regex: ^(sqlite3_exec|sqlite3_prepare_v2|PQexec|mysql_query|mysql_real_query)$ }\n```"
784
+ },
785
+ {
786
+ "id": "ff-zap-baseline",
787
+ "type": "fitness-fn",
788
+ "label": "ZAP scan of each deployment",
789
+ "x": 1040,
790
+ "y": 650,
791
+ "characteristic": "security",
792
+ "scope": "holistic",
793
+ "cadence": "triggered",
794
+ "trigger": "deploy",
795
+ "invocation": "automated",
796
+ "description": "A workflow listens for successful deployments and runs the ZAP baseline scan against the environment's URL; the rules file raises the passive alerts that must block (missing CSP, cookie flags, missing anti-clickjacking) to FAIL and turns known noise to IGNORE with a comment. The baseline scan runs passive rules and the spider only; active rules such as SQL injection (40018) need zaproxy/action-api-scan with the OpenAPI document or action-full-scan, run against the ephemeral or staging environment, never production.\n\nThreshold: 0 ZAP alerts at level FAIL against every environment the pipeline deploys to; the scan finishes within 30 minutes of the deployment\n\nTool: OWASP ZAP (zaproxy/action-baseline; zaproxy/action-api-scan for active rules)\n\n```yaml\n# .github/workflows/dast.yml\nname: dast\non: [deployment_status]\njobs:\n zap:\n if: github.event.deployment_status.state == 'success'\n runs-on: ubuntu-latest\n timeout-minutes: 30\n steps:\n - uses: actions/checkout@v4.2.2 # pin by commit SHA in your repository\n - uses: zaproxy/action-baseline@v0.14.0 # pin by commit SHA in your repository\n with:\n target: ${{ github.event.deployment_status.environment_url }}\n rules_file_name: .zap/rules.tsv\n cmd_options: '-a -j' # alpha passive rules, AJAX spider\n fail_action: true\n allow_issue_writing: false\n# .zap/rules.tsv (id<TAB>action<TAB>comment), passive rules only:\n# 10038\tFAIL\tContent Security Policy header missing\n# 10054\tFAIL\tCookie without SameSite\n# 10020\tFAIL\tMissing anti-clickjacking header\n# 10096\tIGNORE\tTimestamp disclosure: build ids in a header, reviewed\n```",
797
+ "hubWhen": {
798
+ "DAST": [
799
+ "pipeline"
800
+ ]
801
+ }
802
+ },
803
+ {
804
+ "id": "ff-dast-age",
805
+ "type": "fitness-fn",
806
+ "label": "ZAP full scan not older than the limit",
807
+ "x": 1040,
808
+ "y": 780,
809
+ "characteristic": "security",
810
+ "scope": "holistic",
811
+ "cadence": "temporal",
812
+ "every": "{{DAST_DAYS}}d",
813
+ "invocation": "automated",
814
+ "description": "A scheduled workflow runs the ZAP full scan against staging and commits its JSON report to security/dast/ as <date>-zap-staging.json. A daily check fails when there is no such report, when the newest is older than the limit, or when it still holds high-risk alerts. Penetration tests are recorded in security/pentests.yaml and checked by the Secure development process pack, not here.\n\nThreshold: The newest ZAP full scan report in security/dast/ is at most {{DAST_DAYS}} days old and holds 0 high-risk alerts (riskcode 3)\n\nTool: OWASP ZAP (zaproxy/action-full-scan) and a shell check over the reports\n\n```bash\n# the scan: a workflow on a cron that fits {{DAST_DAYS}} days (e.g. '0 3 1 */3 *' for quarterly, with a 90-day limit):\n# - uses: zaproxy/action-full-scan@v0.12.0 # pin by commit SHA in your repository\n# with: { target: https://staging.shop.example, cmd_options: '-J report.json', fail_action: false }\n# then: cp report.json \"security/dast/$(date +%F)-zap-staging.json\" and commit\n# the daily check (GNU date, as on ubuntu-latest):\nlatest=$(ls security/dast/ | grep -E '^[0-9]{4}-[0-9]{2}-[0-9]{2}-zap-.*\\.json$' | sort | tail -1)\n[ -n \"$latest\" ] || { echo \"no ZAP full scan report in security/dast/\"; exit 1; }\nreport_date=$(echo \"$latest\" | cut -c1-10)\nage=$(( ( $(date +%s) - $(date -d \"$report_date\" +%s) ) / 86400 ))\n[ \"$age\" -le {{DAST_DAYS}} ] || { echo \"newest ZAP full scan $report_date is $age days old\"; exit 1; }\njq -e '[.site[].alerts[] | select((.riskcode | tonumber) >= 3)] | length == 0' \"security/dast/$latest\" \\\n || { echo \"$latest still holds high alerts\"; exit 1; }\n```",
815
+ "hubWhen": {
816
+ "DAST": [
817
+ "periodic"
818
+ ]
819
+ }
820
+ },
821
+ {
822
+ "id": "ff-input-400",
823
+ "type": "fitness-fn",
824
+ "label": "Malformed input answered 400 with the field",
825
+ "x": 1040,
826
+ "y": 910,
827
+ "characteristic": "security",
828
+ "scope": "atomic",
829
+ "cadence": "triggered",
830
+ "trigger": "pull-request",
831
+ "invocation": "automated",
832
+ "description": "A test sends each operation a body with a wrong type, an unknown field and an out-of-range value and expects 400 with the field's path in the errors and no stack trace; the zod schemas are strict, so unknown fields are refused. With Pydantic, model_config = ConfigDict(extra='forbid') and an exception handler that maps the validation error to 400 with its loc.\n\nThreshold: 100 % of the element's operations answer 400 naming the failing field to a wrong type, an unknown field and an out-of-range value, with no stack trace in the body\n\nTool: Vitest with supertest over zod schemas (pytest with FastAPI's TestClient over Pydantic)\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app'\n\ndescribe.each([\n [{ quantity: 'two', email: 'a@b.example' }, 'quantity'], // wrong type\n [{ quantity: 1, email: 'a@b.example', extra: 'x' }, 'extra'], // unknown field: schema is strict\n [{ quantity: 10_001, email: 'a@b.example' }, 'quantity'], // out of range\n])('POST /orders with %j', (body, field) => {\n it(`answers 400 naming ${field}`, async () => {\n const res = await request(app).post('/orders').send(body).expect(400)\n expect(res.body.errors.map((e: { path: string }) => e.path)).toContain(field)\n expect(JSON.stringify(res.body)).not.toMatch(/node_modules|\\bat \\w+ \\(/) // no stack trace\n })\n})\n```",
833
+ "hubWhen": {
834
+ "INPUT": [
835
+ "boundary-schema"
836
+ ]
837
+ }
838
+ },
839
+ {
840
+ "id": "ff-argument-guards",
841
+ "type": "fitness-fn",
842
+ "label": "Exported functions refuse bad arguments",
843
+ "x": 1040,
844
+ "y": 1040,
845
+ "characteristic": "security",
846
+ "scope": "atomic",
847
+ "cadence": "triggered",
848
+ "trigger": "pull-request",
849
+ "invocation": "automated",
850
+ "description": "A test enumerates the functions exported from the package's public surface (not a list kept by hand) and calls each with the usual bad arguments; every call must fail with the shared typed error that names the argument, which means the function checked before doing anything. A function that legitimately accepts one of the values declares it in GUARD_EXCEPTIONS beside the test, where a reviewer sees it. For Python, the same test over the module's __all__ with pytest.raises(ArgumentError).\n\nThreshold: 100 % of the exported functions of the public surface fail with the typed ArgumentError, naming the argument, on a negative number, an out-of-range integer, null, an empty string and a wrong-typed object\n\nTool: Vitest over the public surface (pytest for Python)\n\n```ts\nimport * as api from '../src/index' // the package's public surface\nimport { ArgumentError } from '../src/errors' // the typed error every guard throws, with .argument\n\nconst BAD: unknown[][] = [[-1], [2 ** 31], [null], [''], [{ unexpected: true }]]\nconst GUARD_EXCEPTIONS: Record<string, unknown[]> = {} // 'parseOptional': [null], reviewed\nconst exported = Object.entries(api).filter(([, v]) => typeof v === 'function') as Array<[string, (...a: unknown[]) => unknown]>\n\ndescribe.each(exported)('%s guards its arguments', (name, fn) => {\n const cases = BAD.filter((args) => !(GUARD_EXCEPTIONS[name] ?? []).some((v) => JSON.stringify(v) === JSON.stringify(args[0])))\n it.each(cases)('refuses %j with a typed error naming the argument', async (...args) => {\n await expect(Promise.resolve().then(() => fn(...args))).rejects.toSatisfy(\n (e: unknown) => e instanceof ArgumentError && typeof e.argument === 'string' && e.argument.length > 0,\n )\n })\n})\n```",
851
+ "hubWhen": {
852
+ "INPUT": [
853
+ "everywhere"
854
+ ]
855
+ }
856
+ },
857
+ {
858
+ "id": "ff-framework-defaults",
859
+ "type": "fitness-fn",
860
+ "label": "Middleware defenses present in responses",
861
+ "x": 1040,
862
+ "y": 1170,
863
+ "characteristic": "security",
864
+ "scope": "atomic",
865
+ "cadence": "triggered",
866
+ "trigger": "pull-request",
867
+ "invocation": "automated",
868
+ "description": "A test starts the element with its production configuration and checks what the framework's middleware must produce: a 403 on a POST without the CSRF token, the security headers on a page, and the flags on every cookie it sets. A hand-rolled replacement that forgets one of them fails here. For Django, the same test with the test client and SECURE_* settings; for Spring, MockMvc against the security filter chain.\n\nThreshold: A state-changing request without the CSRF token is refused with 403; every response carries Content-Security-Policy, Strict-Transport-Security and X-Content-Type-Options, and every cookie is Secure, HttpOnly and SameSite\n\nTool: Vitest with supertest (helmet and csurf or csrf-csrf on Express)\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app' // started with NODE_ENV=production and the production middleware\n\nit('refuses a state-changing request without the CSRF token', async () => {\n await request(app).post('/orders').send({ quantity: 1 }).expect(403)\n})\n\nit('carries the middleware headers and cookie flags', async () => {\n const res = await request(app).get('/').expect(200)\n expect(res.headers['content-security-policy']).toBeDefined()\n expect(res.headers['strict-transport-security']).toMatch(/max-age=\\d{7,}/)\n expect(res.headers['x-content-type-options']).toBe('nosniff')\n const cookies = ([] as string[]).concat(res.headers['set-cookie'] ?? [])\n for (const cookie of cookies) {\n expect(cookie).toMatch(/;\\s*Secure/i)\n expect(cookie).toMatch(/;\\s*HttpOnly/i)\n expect(cookie).toMatch(/;\\s*SameSite=(Lax|Strict)/i)\n }\n})\n```",
869
+ "hubWhen": {
870
+ "STANDARD": [
871
+ "asvs-l1",
872
+ "asvs-l2"
873
+ ]
874
+ }
875
+ },
876
+ {
877
+ "id": "ff-authz-coverage",
878
+ "type": "fitness-fn",
879
+ "label": "Every sensitive route has negative tests",
880
+ "x": 1040,
881
+ "y": 1300,
882
+ "characteristic": "security",
883
+ "scope": "atomic",
884
+ "cadence": "triggered",
885
+ "trigger": "pull-request",
886
+ "invocation": "automated",
887
+ "description": "A test lists the element's routes from its router, keeps those that take an object id from the path or live under /admin, and fails for every one without a test file that carries the tag authz:METHOD /path; the tagged test itself calls the route as the wrong user, the wrong tenant and anonymously. A new sensitive route fails the suite until its negative tests exist.\n\nThreshold: 100 % of routes with an id in the path or under /admin have a test tagged with the route (authz:METHOD /path) in the pull-request suite\n\nTool: Vitest over the router's table and the test files\n\n```ts\nimport { readFileSync } from 'node:fs'\nimport { globSync } from 'glob'\nimport { routes } from '../src/app' // the router's table: { method, path }\n\nconst tagged = new Set(\n globSync('tests/**/*.test.ts').flatMap((f) => [...readFileSync(f, 'utf8').matchAll(/authz:([A-Z]+ \\S+)/g)].map((m) => m[1])),\n)\nconst sensitive = routes.filter((r) => /:\\w+/.test(r.path) || r.path.startsWith('/admin'))\n\nit.each(sensitive)('$method $path has negative authorization tests', (r) => {\n expect(tagged, `write a test tagged \"authz:${r.method} ${r.path}\" that calls it as the wrong user, the wrong tenant and anonymously`)\n .toContain(`${r.method} ${r.path}`)\n})\n```"
888
+ },
889
+ {
890
+ "id": "ff-triage-queue",
891
+ "type": "fitness-fn",
892
+ "label": "Scheduled findings get an owner in time",
893
+ "x": 1040,
894
+ "y": 1430,
895
+ "characteristic": "security",
896
+ "scope": "atomic",
897
+ "cadence": "triggered",
898
+ "trigger": "nightly",
899
+ "invocation": "automated",
900
+ "description": "The nightly scanners upload SARIF to code scanning; the triage queue is the open high and critical alerts. A daily job fails for every such alert older than one working day (three days on a Monday) that no open issue labelled sast, with an assignee, names by its number; the issue's assignee is the owner and the deadline runs from the alert.\n\nThreshold: 0 open high or critical code scanning alerts older than 1 working day without an assigned issue that names the alert\n\nTool: GitHub CLI over code scanning alerts and issues, in a scheduled job\n\n```bash\nlimit_days=$([ \"$(date +%u)\" = 1 ] && echo 3 || echo 1) # one working day; three over a weekend\nsince=$(date -u -d \"-$limit_days days\" +%FT%TZ)\ngh api --paginate \"/repos/$REPO/code-scanning/alerts?state=open&per_page=100\" \\\n | jq -r --arg since \"$since\" '.[] | select(.created_at < $since and (.rule.security_severity_level | IN(\"high\", \"critical\"))) | .number' > due.txt\ngh issue list --repo \"$REPO\" --label sast --state open --limit 500 --json title,assignees \\\n --jq '.[] | select(.assignees | length > 0) | .title' > owned.txt\nstatus=0\nwhile read -r n; do\n grep -q \"alert #$n\\b\" owned.txt || { echo \"code scanning alert #$n has no owner after $limit_days day(s)\"; status=1; }\ndone < due.txt\nexit $status\n```",
901
+ "hubWhen": {
902
+ "SAST": [
903
+ "scheduled"
904
+ ]
905
+ }
906
+ },
907
+ {
908
+ "id": "ff-findings-sla",
909
+ "type": "fitness-fn",
910
+ "label": "No finding past its deadline",
911
+ "x": 1040,
912
+ "y": 1560,
913
+ "characteristic": "security",
914
+ "scope": "atomic",
915
+ "cadence": "triggered",
916
+ "trigger": "pull-request",
917
+ "invocation": "automated",
918
+ "description": "A job on the main branch reads the repository's open code scanning alerts (Semgrep, CodeQL, ZAP and the language scanners all upload SARIF there) and fails on any past its severity's deadline, naming the rule and the file. With a risk register, an alert whose \"<rule id> <path>\" a still-valid acceptance names is skipped; without one, nothing is. Penetration test findings are filed as alerts through a SARIF upload so the same check covers them.\n\nThreshold: 0 open code scanning alerts older than {{CRITICAL_DAYS}} days (critical), {{HIGH_DAYS}} days (high) or {{MEDIUM_DAYS}} days (medium) that no valid acceptance in the risk register names\n\nTool: GitHub code scanning alerts API through the GitHub CLI, with jq (and yq for the register)\n\n```bash\n# acceptances still valid today, as JSON (an empty list without a register)\nif [ -f security/risk-acceptances.yaml ]; then yq -o=json '.' security/risk-acceptances.yaml > register.json; else echo '[]' > register.json; fi\ngh api --paginate \"/repos/$REPO/code-scanning/alerts?state=open&per_page=100\" | jq -e \\\n --argjson crit {{CRITICAL_DAYS}} --argjson high {{HIGH_DAYS}} --argjson med {{MEDIUM_DAYS}} --slurpfile reg register.json '\n ($reg[0] // [] | map(select((.expires | tostring | . + \"T00:00:00Z\" | fromdateiso8601) > now)) | map(.finding)) as $accepted\n | [.[] | {sev: .rule.security_severity_level, age: ((now - (.created_at | fromdateiso8601)) / 86400),\n rule: .rule.id, file: .most_recent_instance.location.path}\n | select((.sev == \"critical\" and .age > $crit) or (.sev == \"high\" and .age > $high) or (.sev == \"medium\" and .age > $med))\n | \"\\(.rule) \\(.file)\" as $key | select(($accepted | index($key)) == null)]\n | if length > 0 then (map(\"\\(.rule) \\(.file) \\(.sev) \\(.age | floor)d\") | join(\"\\n\") | halt_error(1)) else true end'\n```",
919
+ "hubWhen": {
920
+ "FINDINGS": [
921
+ "sla",
922
+ "risk-accepted"
923
+ ]
924
+ }
925
+ },
926
+ {
927
+ "id": "ff-risk-register",
928
+ "type": "fitness-fn",
929
+ "label": "Risk acceptances complete and current",
930
+ "x": 1040,
931
+ "y": 1690,
932
+ "characteristic": "security",
933
+ "scope": "atomic",
934
+ "cadence": "triggered",
935
+ "trigger": "pull-request",
936
+ "invocation": "automated",
937
+ "description": "A test over the register security/risk-acceptances.yaml fails on an incomplete, self-approved, expired or over-long acceptance; the deadline job skips only the alerts a valid acceptance names (by \"<rule id> <path>\"), so an overdue finding without an acceptance still fails the build.\n\nThreshold: 0 acceptances without finding, owner, second approver, reason and expiry, self-approved, expired, or valid longer than {{ACCEPTANCE_DAYS}} days\n\nTool: Vitest over the risk register\n\n```ts\nimport { readFileSync } from 'node:fs'\nimport { parse } from 'yaml'\nimport { expect, it } from 'vitest'\n\n// security/risk-acceptances.yaml:\n// - { finding: \"js/sql-injection src/report.ts\", owner: \"ola\", approver: \"sec-team/marek\",\n// reason: \"allow-listed column names; module replaced in Q1\", controls: \"WAF rule 942100\", accepted: 2026-10-01, expires: 2026-12-30 }\ntype Acceptance = { finding: string; owner: string; approver: string; reason: string; controls: string; accepted: string; expires: string }\nconst register: Acceptance[] = parse(readFileSync('security/risk-acceptances.yaml', 'utf8')) ?? []\nconst DAY = 86_400_000\n\nit('every risk acceptance is complete, approved by a second person and current', () => {\n const bad = register.filter((r) =>\n !r.finding || !r.owner || !r.approver || r.owner === r.approver || !r.reason || !r.controls\n || Date.parse(r.expires) < Date.now()\n || (Date.parse(r.expires) - Date.parse(r.accepted)) / DAY > {{ACCEPTANCE_DAYS}})\n expect(bad.map((r) => r.finding)).toEqual([])\n})\n```",
938
+ "hubWhen": {
939
+ "FINDINGS": [
940
+ "risk-accepted"
941
+ ]
942
+ }
943
+ },
944
+ {
945
+ "id": "ff-clang-tidy",
946
+ "type": "fitness-fn",
947
+ "label": "CERT and MISRA checks as errors",
948
+ "x": 1040,
949
+ "y": 1820,
950
+ "characteristic": "security",
951
+ "scope": "atomic",
952
+ "cadence": "triggered",
953
+ "trigger": "pull-request",
954
+ "invocation": "automated",
955
+ "description": "clang-tidy runs over the compilation database with the CERT, bugprone and analyzer checks as errors and the unsafe-functions check naming the banned functions (system among them, so a command built from data cannot run); cppcheck's MISRA add-on runs beside it with the rule texts, and suppressions live in a deviation file reviewed like code. The tests run under the sanitizers in a second configuration.\n\nThreshold: 0 warnings from the cert-*, bugprone-* and clang-analyzer-* checks, 0 uses of the banned functions, and 0 MISRA violations outside recorded deviations; the build fails on any\n\nTool: clang-tidy and cppcheck --addon=misra (PC-lint Plus or Polyspace where the safety case needs a certified analyser)\n\n```yaml\n# .clang-tidy (CI: run-clang-tidy -p build -quiet; exits non-zero on an error)\nChecks: >\n -*, cert-*, bugprone-*, clang-analyzer-*, misc-*,\n cppcoreguidelines-pro-bounds-array-to-pointer-decay,\n cppcoreguidelines-pro-bounds-constant-array-index\nWarningsAsErrors: 'cert-*,bugprone-*,clang-analyzer-*'\nCheckOptions:\n - { key: bugprone-unsafe-functions.ReportDefaultFunctions, value: true }\n - { key: bugprone-unsafe-functions.CustomFunctions,\n value: '^::gets$,fgets,;^::strcpy$,strlcpy,;^::strcat$,strlcat,;^::sprintf$,snprintf,;^::system$,,;^::alloca$,,' }\n# MISRA C:2023, in the same job:\n# cppcheck --addon=misra.json --enable=warning,style --error-exitcode=1 \\\n# --suppressions-list=misra-deviations.txt --project=build/compile_commands.json\n# sanitizers: cmake -DCMAKE_CXX_FLAGS=\"-fsanitize=address,undefined -fno-omit-frame-pointer\" && ctest\n```",
956
+ "hubWhen": {
957
+ "STANDARD": [
958
+ "cert-misra"
959
+ ]
960
+ }
961
+ }
962
+ ],
963
+ "relations": [
964
+ {
965
+ "id": "req-param-queries--derives--need",
966
+ "sourceId": "req-param-queries",
967
+ "targetId": "need",
968
+ "relationType": "derives"
969
+ },
970
+ {
971
+ "id": "req-output-encoding--derives--need",
972
+ "sourceId": "req-output-encoding",
973
+ "targetId": "need",
974
+ "relationType": "derives"
975
+ },
976
+ {
977
+ "id": "req-input-boundary--derives--need",
978
+ "sourceId": "req-input-boundary",
979
+ "targetId": "need",
980
+ "relationType": "derives"
981
+ },
982
+ {
983
+ "id": "req-input-everywhere--derives--need",
984
+ "sourceId": "req-input-everywhere",
985
+ "targetId": "need",
986
+ "relationType": "derives"
987
+ },
988
+ {
989
+ "id": "req-no-dynamic-code--derives--need",
990
+ "sourceId": "req-no-dynamic-code",
991
+ "targetId": "need",
992
+ "relationType": "derives"
993
+ },
994
+ {
995
+ "id": "req-framework-defaults--derives--need",
996
+ "sourceId": "req-framework-defaults",
997
+ "targetId": "need",
998
+ "relationType": "derives"
999
+ },
1000
+ {
1001
+ "id": "req-sast-pr--derives--need",
1002
+ "sourceId": "req-sast-pr",
1003
+ "targetId": "need",
1004
+ "relationType": "derives"
1005
+ },
1006
+ {
1007
+ "id": "req-sast-scheduled--derives--need",
1008
+ "sourceId": "req-sast-scheduled",
1009
+ "targetId": "need",
1010
+ "relationType": "derives"
1011
+ },
1012
+ {
1013
+ "id": "req-dast-pipeline--derives--need",
1014
+ "sourceId": "req-dast-pipeline",
1015
+ "targetId": "need",
1016
+ "relationType": "derives"
1017
+ },
1018
+ {
1019
+ "id": "req-dast-periodic--derives--need",
1020
+ "sourceId": "req-dast-periodic",
1021
+ "targetId": "need",
1022
+ "relationType": "derives"
1023
+ },
1024
+ {
1025
+ "id": "req-findings-sla--derives--need",
1026
+ "sourceId": "req-findings-sla",
1027
+ "targetId": "need",
1028
+ "relationType": "derives"
1029
+ },
1030
+ {
1031
+ "id": "req-risk-accepted--derives--need",
1032
+ "sourceId": "req-risk-accepted",
1033
+ "targetId": "need",
1034
+ "relationType": "derives"
1035
+ },
1036
+ {
1037
+ "id": "req-authz-tests--derives--need",
1038
+ "sourceId": "req-authz-tests",
1039
+ "targetId": "need",
1040
+ "relationType": "derives"
1041
+ },
1042
+ {
1043
+ "id": "req-memory-safety--derives--need",
1044
+ "sourceId": "req-memory-safety",
1045
+ "targetId": "need",
1046
+ "relationType": "derives"
1047
+ },
1048
+ {
1049
+ "id": "sc-param-queries--verifies--req-param-queries",
1050
+ "sourceId": "sc-param-queries",
1051
+ "targetId": "req-param-queries",
1052
+ "relationType": "verifies"
1053
+ },
1054
+ {
1055
+ "id": "sc-output-encoding--verifies--req-output-encoding",
1056
+ "sourceId": "sc-output-encoding",
1057
+ "targetId": "req-output-encoding",
1058
+ "relationType": "verifies"
1059
+ },
1060
+ {
1061
+ "id": "sc-input-boundary--verifies--req-input-boundary",
1062
+ "sourceId": "sc-input-boundary",
1063
+ "targetId": "req-input-boundary",
1064
+ "relationType": "verifies"
1065
+ },
1066
+ {
1067
+ "id": "sc-input-everywhere--verifies--req-input-everywhere",
1068
+ "sourceId": "sc-input-everywhere",
1069
+ "targetId": "req-input-everywhere",
1070
+ "relationType": "verifies"
1071
+ },
1072
+ {
1073
+ "id": "sc-no-dynamic-code--verifies--req-no-dynamic-code",
1074
+ "sourceId": "sc-no-dynamic-code",
1075
+ "targetId": "req-no-dynamic-code",
1076
+ "relationType": "verifies"
1077
+ },
1078
+ {
1079
+ "id": "sc-framework-defaults--verifies--req-framework-defaults",
1080
+ "sourceId": "sc-framework-defaults",
1081
+ "targetId": "req-framework-defaults",
1082
+ "relationType": "verifies"
1083
+ },
1084
+ {
1085
+ "id": "sc-sast-pr--verifies--req-sast-pr",
1086
+ "sourceId": "sc-sast-pr",
1087
+ "targetId": "req-sast-pr",
1088
+ "relationType": "verifies"
1089
+ },
1090
+ {
1091
+ "id": "sc-sast-scheduled--verifies--req-sast-scheduled",
1092
+ "sourceId": "sc-sast-scheduled",
1093
+ "targetId": "req-sast-scheduled",
1094
+ "relationType": "verifies"
1095
+ },
1096
+ {
1097
+ "id": "sc-dast-pipeline--verifies--req-dast-pipeline",
1098
+ "sourceId": "sc-dast-pipeline",
1099
+ "targetId": "req-dast-pipeline",
1100
+ "relationType": "verifies"
1101
+ },
1102
+ {
1103
+ "id": "sc-dast-periodic--verifies--req-dast-periodic",
1104
+ "sourceId": "sc-dast-periodic",
1105
+ "targetId": "req-dast-periodic",
1106
+ "relationType": "verifies"
1107
+ },
1108
+ {
1109
+ "id": "sc-findings-sla--verifies--req-findings-sla",
1110
+ "sourceId": "sc-findings-sla",
1111
+ "targetId": "req-findings-sla",
1112
+ "relationType": "verifies"
1113
+ },
1114
+ {
1115
+ "id": "sc-risk-accepted--verifies--req-risk-accepted",
1116
+ "sourceId": "sc-risk-accepted",
1117
+ "targetId": "req-risk-accepted",
1118
+ "relationType": "verifies"
1119
+ },
1120
+ {
1121
+ "id": "sc-authz-tests--verifies--req-authz-tests",
1122
+ "sourceId": "sc-authz-tests",
1123
+ "targetId": "req-authz-tests",
1124
+ "relationType": "verifies"
1125
+ },
1126
+ {
1127
+ "id": "sc-memory-safety--verifies--req-memory-safety",
1128
+ "sourceId": "sc-memory-safety",
1129
+ "targetId": "req-memory-safety",
1130
+ "relationType": "verifies"
1131
+ },
1132
+ {
1133
+ "id": "ff-semgrep--implements--adr-asvs-l1",
1134
+ "sourceId": "ff-semgrep",
1135
+ "targetId": "adr-asvs-l1",
1136
+ "relationType": "implements"
1137
+ },
1138
+ {
1139
+ "id": "ff-semgrep--implements--adr-asvs-l2",
1140
+ "sourceId": "ff-semgrep",
1141
+ "targetId": "adr-asvs-l2",
1142
+ "relationType": "implements"
1143
+ },
1144
+ {
1145
+ "id": "ff-semgrep--implements--adr-cert-misra",
1146
+ "sourceId": "ff-semgrep",
1147
+ "targetId": "adr-cert-misra",
1148
+ "relationType": "implements"
1149
+ },
1150
+ {
1151
+ "id": "ff-codeql--implements--adr-asvs-l1",
1152
+ "sourceId": "ff-codeql",
1153
+ "targetId": "adr-asvs-l1",
1154
+ "relationType": "implements"
1155
+ },
1156
+ {
1157
+ "id": "ff-codeql--implements--adr-asvs-l2",
1158
+ "sourceId": "ff-codeql",
1159
+ "targetId": "adr-asvs-l2",
1160
+ "relationType": "implements"
1161
+ },
1162
+ {
1163
+ "id": "ff-codeql--implements--adr-cert-misra",
1164
+ "sourceId": "ff-codeql",
1165
+ "targetId": "adr-cert-misra",
1166
+ "relationType": "implements"
1167
+ },
1168
+ {
1169
+ "id": "ff-language-scanner--implements--adr-asvs-l1",
1170
+ "sourceId": "ff-language-scanner",
1171
+ "targetId": "adr-asvs-l1",
1172
+ "relationType": "implements"
1173
+ },
1174
+ {
1175
+ "id": "ff-language-scanner--implements--adr-asvs-l2",
1176
+ "sourceId": "ff-language-scanner",
1177
+ "targetId": "adr-asvs-l2",
1178
+ "relationType": "implements"
1179
+ },
1180
+ {
1181
+ "id": "ff-language-scanner--implements--adr-cert-misra",
1182
+ "sourceId": "ff-language-scanner",
1183
+ "targetId": "adr-cert-misra",
1184
+ "relationType": "implements"
1185
+ },
1186
+ {
1187
+ "id": "ff-eslint-security--implements--adr-asvs-l1",
1188
+ "sourceId": "ff-eslint-security",
1189
+ "targetId": "adr-asvs-l1",
1190
+ "relationType": "implements"
1191
+ },
1192
+ {
1193
+ "id": "ff-eslint-security--implements--adr-asvs-l2",
1194
+ "sourceId": "ff-eslint-security",
1195
+ "targetId": "adr-asvs-l2",
1196
+ "relationType": "implements"
1197
+ },
1198
+ {
1199
+ "id": "ff-sqli-lint--implements--adr-asvs-l1",
1200
+ "sourceId": "ff-sqli-lint",
1201
+ "targetId": "adr-asvs-l1",
1202
+ "relationType": "implements"
1203
+ },
1204
+ {
1205
+ "id": "ff-sqli-lint--implements--adr-asvs-l2",
1206
+ "sourceId": "ff-sqli-lint",
1207
+ "targetId": "adr-asvs-l2",
1208
+ "relationType": "implements"
1209
+ },
1210
+ {
1211
+ "id": "ff-sqli-lint--implements--adr-cert-misra",
1212
+ "sourceId": "ff-sqli-lint",
1213
+ "targetId": "adr-cert-misra",
1214
+ "relationType": "implements"
1215
+ },
1216
+ {
1217
+ "id": "ff-zap-baseline--implements--adr-asvs-l1",
1218
+ "sourceId": "ff-zap-baseline",
1219
+ "targetId": "adr-asvs-l1",
1220
+ "relationType": "implements"
1221
+ },
1222
+ {
1223
+ "id": "ff-zap-baseline--implements--adr-asvs-l2",
1224
+ "sourceId": "ff-zap-baseline",
1225
+ "targetId": "adr-asvs-l2",
1226
+ "relationType": "implements"
1227
+ },
1228
+ {
1229
+ "id": "ff-zap-baseline--implements--adr-cert-misra",
1230
+ "sourceId": "ff-zap-baseline",
1231
+ "targetId": "adr-cert-misra",
1232
+ "relationType": "implements"
1233
+ },
1234
+ {
1235
+ "id": "ff-dast-age--implements--adr-asvs-l1",
1236
+ "sourceId": "ff-dast-age",
1237
+ "targetId": "adr-asvs-l1",
1238
+ "relationType": "implements"
1239
+ },
1240
+ {
1241
+ "id": "ff-dast-age--implements--adr-asvs-l2",
1242
+ "sourceId": "ff-dast-age",
1243
+ "targetId": "adr-asvs-l2",
1244
+ "relationType": "implements"
1245
+ },
1246
+ {
1247
+ "id": "ff-dast-age--implements--adr-cert-misra",
1248
+ "sourceId": "ff-dast-age",
1249
+ "targetId": "adr-cert-misra",
1250
+ "relationType": "implements"
1251
+ },
1252
+ {
1253
+ "id": "ff-input-400--implements--adr-asvs-l1",
1254
+ "sourceId": "ff-input-400",
1255
+ "targetId": "adr-asvs-l1",
1256
+ "relationType": "implements"
1257
+ },
1258
+ {
1259
+ "id": "ff-input-400--implements--adr-asvs-l2",
1260
+ "sourceId": "ff-input-400",
1261
+ "targetId": "adr-asvs-l2",
1262
+ "relationType": "implements"
1263
+ },
1264
+ {
1265
+ "id": "ff-input-400--implements--adr-cert-misra",
1266
+ "sourceId": "ff-input-400",
1267
+ "targetId": "adr-cert-misra",
1268
+ "relationType": "implements"
1269
+ },
1270
+ {
1271
+ "id": "ff-argument-guards--implements--adr-asvs-l1",
1272
+ "sourceId": "ff-argument-guards",
1273
+ "targetId": "adr-asvs-l1",
1274
+ "relationType": "implements"
1275
+ },
1276
+ {
1277
+ "id": "ff-argument-guards--implements--adr-asvs-l2",
1278
+ "sourceId": "ff-argument-guards",
1279
+ "targetId": "adr-asvs-l2",
1280
+ "relationType": "implements"
1281
+ },
1282
+ {
1283
+ "id": "ff-argument-guards--implements--adr-cert-misra",
1284
+ "sourceId": "ff-argument-guards",
1285
+ "targetId": "adr-cert-misra",
1286
+ "relationType": "implements"
1287
+ },
1288
+ {
1289
+ "id": "ff-framework-defaults--implements--adr-asvs-l1",
1290
+ "sourceId": "ff-framework-defaults",
1291
+ "targetId": "adr-asvs-l1",
1292
+ "relationType": "implements"
1293
+ },
1294
+ {
1295
+ "id": "ff-framework-defaults--implements--adr-asvs-l2",
1296
+ "sourceId": "ff-framework-defaults",
1297
+ "targetId": "adr-asvs-l2",
1298
+ "relationType": "implements"
1299
+ },
1300
+ {
1301
+ "id": "ff-authz-coverage--implements--adr-asvs-l1",
1302
+ "sourceId": "ff-authz-coverage",
1303
+ "targetId": "adr-asvs-l1",
1304
+ "relationType": "implements"
1305
+ },
1306
+ {
1307
+ "id": "ff-authz-coverage--implements--adr-asvs-l2",
1308
+ "sourceId": "ff-authz-coverage",
1309
+ "targetId": "adr-asvs-l2",
1310
+ "relationType": "implements"
1311
+ },
1312
+ {
1313
+ "id": "ff-authz-coverage--implements--adr-cert-misra",
1314
+ "sourceId": "ff-authz-coverage",
1315
+ "targetId": "adr-cert-misra",
1316
+ "relationType": "implements"
1317
+ },
1318
+ {
1319
+ "id": "ff-triage-queue--implements--adr-asvs-l1",
1320
+ "sourceId": "ff-triage-queue",
1321
+ "targetId": "adr-asvs-l1",
1322
+ "relationType": "implements"
1323
+ },
1324
+ {
1325
+ "id": "ff-triage-queue--implements--adr-asvs-l2",
1326
+ "sourceId": "ff-triage-queue",
1327
+ "targetId": "adr-asvs-l2",
1328
+ "relationType": "implements"
1329
+ },
1330
+ {
1331
+ "id": "ff-triage-queue--implements--adr-cert-misra",
1332
+ "sourceId": "ff-triage-queue",
1333
+ "targetId": "adr-cert-misra",
1334
+ "relationType": "implements"
1335
+ },
1336
+ {
1337
+ "id": "ff-findings-sla--implements--adr-asvs-l1",
1338
+ "sourceId": "ff-findings-sla",
1339
+ "targetId": "adr-asvs-l1",
1340
+ "relationType": "implements"
1341
+ },
1342
+ {
1343
+ "id": "ff-findings-sla--implements--adr-asvs-l2",
1344
+ "sourceId": "ff-findings-sla",
1345
+ "targetId": "adr-asvs-l2",
1346
+ "relationType": "implements"
1347
+ },
1348
+ {
1349
+ "id": "ff-findings-sla--implements--adr-cert-misra",
1350
+ "sourceId": "ff-findings-sla",
1351
+ "targetId": "adr-cert-misra",
1352
+ "relationType": "implements"
1353
+ },
1354
+ {
1355
+ "id": "ff-risk-register--implements--adr-asvs-l1",
1356
+ "sourceId": "ff-risk-register",
1357
+ "targetId": "adr-asvs-l1",
1358
+ "relationType": "implements"
1359
+ },
1360
+ {
1361
+ "id": "ff-risk-register--implements--adr-asvs-l2",
1362
+ "sourceId": "ff-risk-register",
1363
+ "targetId": "adr-asvs-l2",
1364
+ "relationType": "implements"
1365
+ },
1366
+ {
1367
+ "id": "ff-risk-register--implements--adr-cert-misra",
1368
+ "sourceId": "ff-risk-register",
1369
+ "targetId": "adr-cert-misra",
1370
+ "relationType": "implements"
1371
+ },
1372
+ {
1373
+ "id": "ff-clang-tidy--implements--adr-cert-misra",
1374
+ "sourceId": "ff-clang-tidy",
1375
+ "targetId": "adr-cert-misra",
1376
+ "relationType": "implements"
1377
+ }
1378
+ ]
1379
+ }