@radicaltools/mcp 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/{chunk-Z7THA3L5.js → chunk-KEIZXREX.js} +68 -35
- package/dist/{elkLayout-TAUBPPVN.js → elkLayout-MFJXDTJG.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 +1893 -468
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"trigger": "LIST RELATIONS WHERE (source.type = \"person\" OR source.external = true) AND target.external != true AND (target.type = \"system\" OR target.type = \"container\" OR target.type = \"webapp\" OR target.type = \"component\")",
|
|
19
19
|
"applyTo": "target",
|
|
20
20
|
"why": "people or external systems reach these elements, so who is calling has to be decided.",
|
|
21
|
-
"group": "
|
|
21
|
+
"group": "security"
|
|
22
22
|
},
|
|
23
23
|
"sources": [
|
|
24
24
|
{
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"url": "https://owasp.org/www-project-application-security-verification-standard/"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"title": "NIST SP 800-63B, Digital Identity Guidelines: Authentication and
|
|
30
|
-
"url": "https://pages.nist.gov/800-63-
|
|
29
|
+
"title": "NIST SP 800-63B-4, Digital Identity Guidelines: Authentication and Authenticator Management",
|
|
30
|
+
"url": "https://pages.nist.gov/800-63-4/sp800-63b.html"
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
"title": "RFC 9700, Best Current Practice for OAuth 2.0 Security",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
{
|
|
37
37
|
"title": "OpenID Connect Core 1.0",
|
|
38
38
|
"url": "https://openid.net/specs/openid-connect-core-1_0.html"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"title": "OWASP Password Storage Cheat Sheet",
|
|
42
|
+
"url": "https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html"
|
|
39
43
|
}
|
|
40
44
|
],
|
|
41
45
|
"templateParams": [
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
{
|
|
60
64
|
"value": "none",
|
|
61
65
|
"label": "nobody signs in",
|
|
62
|
-
"description": "
|
|
66
|
+
"description": "No person signs in; everything people reach is public and the same for everyone. Pick it for read-only public sites and tools; the decision records it so nothing comes to depend on who is calling. Other systems may still call with credentials of their own (next question)."
|
|
63
67
|
}
|
|
64
68
|
]
|
|
65
69
|
},
|
|
@@ -67,7 +71,7 @@
|
|
|
67
71
|
"key": "MACHINE",
|
|
68
72
|
"title": "Other systems",
|
|
69
73
|
"label": "How do other systems call it?",
|
|
70
|
-
"hint": "A call from inside the network is not a call from a known system: each caller needs an identity of its own, and its own list of what it may do.",
|
|
74
|
+
"hint": "A call from inside the network is not a call from a known system: each caller needs an identity of its own, and its own list of what it may do. Independent of how people sign in.",
|
|
71
75
|
"defaultValue": "oauth",
|
|
72
76
|
"options": [
|
|
73
77
|
{
|
|
@@ -87,8 +91,8 @@
|
|
|
87
91
|
},
|
|
88
92
|
{
|
|
89
93
|
"value": "none",
|
|
90
|
-
"label": "none
|
|
91
|
-
"description": "
|
|
94
|
+
"label": "none",
|
|
95
|
+
"description": "No other system calls it; only people reach it. Pick it when the model shows no other system calling."
|
|
92
96
|
}
|
|
93
97
|
]
|
|
94
98
|
},
|
|
@@ -96,17 +100,17 @@
|
|
|
96
100
|
"key": "STEP_UP",
|
|
97
101
|
"title": "Second factor",
|
|
98
102
|
"label": "Do some operations need a second factor?",
|
|
99
|
-
"hint": "A stolen session alone should not be enough for the operations that do the most harm: changing permissions, moving money, exporting data.",
|
|
103
|
+
"hint": "A stolen session alone should not be enough for the operations that do the most harm: changing permissions, moving money, exporting data. Only when people sign in (not with nobody signs in).",
|
|
100
104
|
"defaultValue": "yes",
|
|
101
105
|
"options": [
|
|
102
106
|
{
|
|
103
107
|
"value": "yes",
|
|
104
|
-
"label": "
|
|
108
|
+
"label": "a second factor for risky operations",
|
|
105
109
|
"description": "Risky operations ask for a second factor confirmed in the last 5 minutes (step-up). Pick it when any operation moves money, changes rights or exports data."
|
|
106
110
|
},
|
|
107
111
|
{
|
|
108
112
|
"value": "no",
|
|
109
|
-
"label": "
|
|
113
|
+
"label": "the session alone",
|
|
110
114
|
"description": "A signed-in session may do everything its account may. Pick it only when no operation is worth more than the session itself."
|
|
111
115
|
}
|
|
112
116
|
]
|
|
@@ -125,7 +129,7 @@
|
|
|
125
129
|
},
|
|
126
130
|
{
|
|
127
131
|
"key": "PRIVILEGED_OPS",
|
|
128
|
-
"label": "Which operations need a second factor?",
|
|
132
|
+
"label": "Which operations need a second factor? (a second factor for risky operations only)",
|
|
129
133
|
"defaultValue": "changing permissions, exporting data, payouts"
|
|
130
134
|
}
|
|
131
135
|
]
|
|
@@ -139,7 +143,7 @@
|
|
|
139
143
|
"y": 0,
|
|
140
144
|
"kind": "brief",
|
|
141
145
|
"source": "Hub concern pack: Authentication",
|
|
142
|
-
"description": "People and other systems reach this element from outside. Whatever it does on their behalf rests on knowing who they are: a stolen or guessed credential, a session that outlives its user, a token that cannot be taken back, or a call from a system nobody vouched for each turns into data read or changed by the wrong party. Sign-in also has to stay usable, and the evidence of who did what has to hold up after an incident."
|
|
146
|
+
"description": "People and other systems reach this element from outside. Whatever it does on their behalf rests on knowing who they are: a stolen or guessed credential, a session that outlives its user, a token that cannot be taken back, or a call from a system nobody vouched for each turns into data read or changed by the wrong party. Sign-in also has to stay usable, and the evidence of who did what has to hold up after an incident. The snippets assume the application under src/ (src/app exports the router's table, src/auth the sign-in code, src/audit the audit store) and the tests under tests/ with their fixtures in tests/auth."
|
|
143
147
|
},
|
|
144
148
|
{
|
|
145
149
|
"id": "req-reject",
|
|
@@ -167,7 +171,7 @@
|
|
|
167
171
|
"ears_type": "event-driven",
|
|
168
172
|
"trigger": "a session has seen no request for {{SESSION_MINUTES}} minutes",
|
|
169
173
|
"action": "end it, so that the next request has to sign in again",
|
|
170
|
-
"rationale": "A session left open on a shared or lost device is a credential nobody is watching (ASVS V3.3
|
|
174
|
+
"rationale": "A session left open on a shared or lost device is a credential nobody is watching (ASVS V3.3; NIST SP 800-63B-4 sec. 2.2.3, inactivity timeout).",
|
|
171
175
|
"hubWhen": {
|
|
172
176
|
"IDENTITY": [
|
|
173
177
|
"idp",
|
|
@@ -199,7 +203,7 @@
|
|
|
199
203
|
"x": 260,
|
|
200
204
|
"y": 390,
|
|
201
205
|
"ears_type": "ubiquitous",
|
|
202
|
-
"action": "record every sign-in, failed sign-in, sign-out and revocation in the audit
|
|
206
|
+
"action": "record every sign-in, failed sign-in, sign-out and revocation in the audit trail, with the account, the time, the client and the source address, and never record the credential itself; where the trail is kept and for how long is decided in the Audit trail pack",
|
|
203
207
|
"rationale": "After an incident this is the record of who was in; with the credential in it, the log becomes the leak (ASVS V7.1).",
|
|
204
208
|
"hubWhen": {
|
|
205
209
|
"IDENTITY": [
|
|
@@ -217,7 +221,7 @@
|
|
|
217
221
|
"ears_type": "unwanted-behaviour",
|
|
218
222
|
"unwanted_condition": "five sign-ins to one account fail within 15 minutes",
|
|
219
223
|
"action": "delay further attempts on that account and from that source address, longer after each failure up to 15 minutes, and tell the account's owner",
|
|
220
|
-
"rationale": "With your own user store, credential stuffing and guessing hit you directly; an identity provider does this for you (NIST 800-63B
|
|
224
|
+
"rationale": "With your own user store, credential stuffing and guessing hit you directly; an identity provider does this for you (NIST SP 800-63B-4 sec. 3.2.2, rate limiting).",
|
|
221
225
|
"hubWhen": {
|
|
222
226
|
"IDENTITY": [
|
|
223
227
|
"own"
|
|
@@ -232,7 +236,7 @@
|
|
|
232
236
|
"y": 650,
|
|
233
237
|
"ears_type": "ubiquitous",
|
|
234
238
|
"action": "store passwords only as Argon2id hashes (at least 19 MiB memory, 2 iterations, 1 lane), accept passwords of 8 to 64 characters, and refuse one found in known breaches",
|
|
235
|
-
"rationale": "A leaked user table must not become a list of working passwords; length and breach checks beat composition rules (OWASP Password Storage Cheat Sheet
|
|
239
|
+
"rationale": "A leaked user table must not become a list of working passwords; length and breach checks beat composition rules (OWASP Password Storage Cheat Sheet; NIST SP 800-63B-4 sec. 3.1.1.2, password verifiers).",
|
|
236
240
|
"hubWhen": {
|
|
237
241
|
"IDENTITY": [
|
|
238
242
|
"own"
|
|
@@ -268,7 +272,7 @@
|
|
|
268
272
|
"ears_type": "event-driven",
|
|
269
273
|
"trigger": "another system calls the element",
|
|
270
274
|
"action": "require it to authenticate with {{MACHINE}}, with credentials of its own that expire or are rotated within 90 days, and let each caller run only the operations listed for it",
|
|
271
|
-
"rationale": "A call from inside the network is not a call from a known system; each caller
|
|
275
|
+
"rationale": "A call from inside the network is not a call from a known system; each caller authenticates as a client of its own (RFC 9700 2.5) and holds only the privileges listed for it (RFC 9700 2.3).",
|
|
272
276
|
"hubWhen": {
|
|
273
277
|
"MACHINE": [
|
|
274
278
|
"oauth",
|
|
@@ -284,8 +288,8 @@
|
|
|
284
288
|
"x": 260,
|
|
285
289
|
"y": 1040,
|
|
286
290
|
"ears_type": "ubiquitous",
|
|
287
|
-
"action": "offer no sign-in
|
|
288
|
-
"rationale": "Nobody signs in, so nothing may depend on knowing
|
|
291
|
+
"action": "offer people no sign-in and no session, keep no person's credential, and run for anyone who reaches it only operations that are safe for anyone",
|
|
292
|
+
"rationale": "Nobody signs in, so nothing may depend on knowing which person is calling; this makes that a requirement instead of an accident.",
|
|
289
293
|
"hubWhen": {
|
|
290
294
|
"IDENTITY": [
|
|
291
295
|
"none"
|
|
@@ -348,7 +352,7 @@
|
|
|
348
352
|
"y": 390,
|
|
349
353
|
"given": "an account",
|
|
350
354
|
"when": "it signs in, fails to sign in, signs out and has a session revoked",
|
|
351
|
-
"then": "the audit
|
|
355
|
+
"then": "the audit trail holds the four events with account, time, client and address, and no credential",
|
|
352
356
|
"hubWhen": {
|
|
353
357
|
"IDENTITY": [
|
|
354
358
|
"idp",
|
|
@@ -430,7 +434,7 @@
|
|
|
430
434
|
"y": 1040,
|
|
431
435
|
"given": "the element as deployed",
|
|
432
436
|
"when": "every route or command it offers is listed",
|
|
433
|
-
"then": "none signs in, keeps a session or stores a credential",
|
|
437
|
+
"then": "none signs a person in, keeps a session or stores a person's credential",
|
|
434
438
|
"hubWhen": {
|
|
435
439
|
"IDENTITY": [
|
|
436
440
|
"none"
|
|
@@ -447,8 +451,8 @@
|
|
|
447
451
|
"status": "accepted",
|
|
448
452
|
"date": "",
|
|
449
453
|
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold.",
|
|
450
|
-
"decision": "Users sign in through an external identity provider with OpenID Connect (authorization code flow with PKCE); we store no password. Sessions end after {{SESSION_MINUTES}} minutes without a request and are revoked within {{REVOKE_SECONDS}} seconds: access tokens live
|
|
451
|
-
"consequences": "• No passwords to store, reset or leak; MFA, lockout and breached-password checks come from the provider.\n• The provider is on the sign-in path: when it is down nobody new signs in, sessions already open keep working until they expire.\n• Revocation within {{REVOKE_SECONDS}} s means
|
|
454
|
+
"decision": "Users sign in through an external identity provider with OpenID Connect (authorization code flow with PKCE); we store no password. Sessions end after {{SESSION_MINUTES}} minutes without a request and are revoked within {{REVOKE_SECONDS}} seconds. Revocation is a server-side check on every instance (a shared session or revocation store, or token introspection), not the token's lifetime: providers keep the shortest access-token lifetime at minutes, not seconds (Entra ID 10 minutes at the least), so access tokens live 5 to 10 minutes and refresh tokens are rotated on use. Calls from other systems: {{MACHINE}}. Step-up: {{STEP_UP}}. Operations open without sign-in are on a public list kept in the code. Choosing the provider: the one the users' organisation already runs (Entra ID, Okta, Google Workspace) for business users; Auth0, Cognito or Keycloak for consumers, by cost per active user and where the data may be kept.",
|
|
455
|
+
"consequences": "• No passwords to store, reset or leak; MFA, lockout and breached-password checks come from the provider.\n• The provider is on the sign-in path: when it is down nobody new signs in, sessions already open keep working until they expire.\n• Revocation within {{REVOKE_SECONDS}} s means a revocation store or introspection call on every request, a little latency and one more thing every instance must reach.\n• Who may do what (authorisation) is still yours to design: a valid token says who, not what.",
|
|
452
456
|
"alternatives": "1. Our own user store: full control of the experience, but you own password storage, lockout, MFA and breach response.\n2. Server-side sessions only (cookies): simple for one web app, awkward for APIs called by other systems and mobile clients.\n3. Long-lived tokens without revocation: fewer calls to the provider, but a stolen token works until it expires.",
|
|
453
457
|
"hubWhen": {
|
|
454
458
|
"IDENTITY": [
|
|
@@ -466,7 +470,7 @@
|
|
|
466
470
|
"status": "accepted",
|
|
467
471
|
"date": "",
|
|
468
472
|
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold.",
|
|
469
|
-
"decision": "Users sign in with an account in our own user store: passwords kept as Argon2id hashes, failed attempts slowed per account and per address, breached passwords refused (Have I Been Pwned range API). Sessions end after {{SESSION_MINUTES}} minutes without a request and are revoked within {{REVOKE_SECONDS}} seconds; session state lives on the server, so revoking is deleting it. Calls from other systems: {{MACHINE}}. Operations open without sign-in are on a public list kept in the code. Use the framework's maintained identity library (ASP.NET Core Identity, Spring Security, Devise,
|
|
473
|
+
"decision": "Users sign in with an account in our own user store: passwords kept as Argon2id hashes, failed attempts slowed per account and per address, breached passwords refused (Have I Been Pwned range API). Sessions end after {{SESSION_MINUTES}} minutes without a request and are revoked within {{REVOKE_SECONDS}} seconds; session state lives on the server, so revoking is deleting it. Calls from other systems: {{MACHINE}}. Step-up: {{STEP_UP}}. Operations open without sign-in are on a public list kept in the code. Use the framework's maintained identity library (ASP.NET Core Identity, Spring Security, Devise, Better Auth) rather than code of our own.",
|
|
470
474
|
"consequences": "• We own the whole of sign-in: password storage, resets, lockout, MFA and the response to a breach.\n• No third party on the sign-in path, and no per-user cost of a provider.\n• Server-side sessions make revocation immediate, but every instance needs the session store.\n• Single sign-on with customers' own identity providers is a later project.",
|
|
471
475
|
"alternatives": "1. An external identity provider (OpenID Connect): no passwords to keep, MFA and lockout included, but a dependency on the sign-in path and a cost per user.\n2. Passwordless sign-in by e-mail link or passkeys only: nothing to guess, but sign-in is as safe as the mailbox or needs passkey support everywhere.",
|
|
472
476
|
"hubWhen": {
|
|
@@ -484,9 +488,9 @@
|
|
|
484
488
|
"concern": "authentication",
|
|
485
489
|
"status": "accepted",
|
|
486
490
|
"date": "",
|
|
487
|
-
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold. Here
|
|
488
|
-
"decision": "
|
|
489
|
-
"consequences": "• Nothing to steal at sign-in and nothing to revoke.\n• Any feature that depends on who the user is (their own data, rights, an audit of who did what) needs this decision superseded first.\n• Abuse is limited by what the element offers, not by who asks: rate limits and the shape of the operations matter more.",
|
|
491
|
+
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold. Here no person needs to be told apart: the element serves the same to everyone who reaches it.",
|
|
492
|
+
"decision": "No person signs in: the element has no sign-in and no session for people and keeps no person's credential; everything people reach is public and safe for anyone. Other systems: {{MACHINE}}. Any credential the element checks belongs to a calling system, never to a person. Anything that would need to know which person is calling is out of scope until this decision is superseded.",
|
|
493
|
+
"consequences": "• Nothing to steal at sign-in and nothing to revoke for people.\n• Any feature that depends on who the user is (their own data, rights, an audit of who did what) needs this decision superseded first.\n• Abuse is limited by what the element offers, not by who asks: rate limits and the shape of the operations matter more.",
|
|
490
494
|
"alternatives": "1. Sign-in through an external identity provider, kept for later.\n2. A shared secret for everyone: no real identity, and a secret everyone knows is not one.",
|
|
491
495
|
"hubWhen": {
|
|
492
496
|
"IDENTITY": [
|
|
@@ -494,15 +498,64 @@
|
|
|
494
498
|
]
|
|
495
499
|
}
|
|
496
500
|
},
|
|
501
|
+
{
|
|
502
|
+
"id": "adr-stepup",
|
|
503
|
+
"type": "adr",
|
|
504
|
+
"label": "A second factor for risky operations",
|
|
505
|
+
"x": 780,
|
|
506
|
+
"y": 390,
|
|
507
|
+
"concern": "authentication",
|
|
508
|
+
"status": "accepted",
|
|
509
|
+
"date": "",
|
|
510
|
+
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold.",
|
|
511
|
+
"decision": "A second factor confirmed within the last 5 minutes is required before each of: {{PRIVILEGED_OPS}}. The operations are listed in one place in the code (a set the request pipeline checks), the time of the last second-factor confirmation is kept with the session, and the check runs on the server before the operation, never only in the interface. With an identity provider, the step-up is an OpenID Connect request with acr_values or max_age=300 and the id token's auth_time is checked; with our own store, the TOTP or passkey verification sets the confirmation time.",
|
|
512
|
+
"consequences": "• A stolen session alone cannot move money, change rights or export data.\n• Each listed operation gains a prompt; the list must stay short and known, or users learn to click through.\n• The confirmation time is part of the session state and travels with it across instances.",
|
|
513
|
+
"alternatives": "1. The session alone: no prompts, and a stolen session is worth everything the account may do.\n2. A second factor at every sign-in only: stronger sign-in, but a session stolen after it is as powerful as before.",
|
|
514
|
+
"hubWhen": {
|
|
515
|
+
"IDENTITY": [
|
|
516
|
+
"idp",
|
|
517
|
+
"own"
|
|
518
|
+
],
|
|
519
|
+
"STEP_UP": [
|
|
520
|
+
"yes"
|
|
521
|
+
]
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"id": "adr-no-stepup",
|
|
526
|
+
"type": "adr",
|
|
527
|
+
"label": "The session alone is enough",
|
|
528
|
+
"x": 780,
|
|
529
|
+
"y": 520,
|
|
530
|
+
"concern": "authentication",
|
|
531
|
+
"status": "accepted",
|
|
532
|
+
"date": "",
|
|
533
|
+
"context": "People or other systems reach this element from outside, so it must know who is calling before it acts for them. The forces: credentials leak and get guessed (credential stuffing tries billions of leaked pairs); sessions outlive the person on a shared or lost device; self-contained tokens stay valid until they expire unless revocation is designed in; other systems call too, and a call from inside the network is not a call from a known system; and after an incident the record of who did what has to hold.",
|
|
534
|
+
"decision": "No operation asks for a second factor beyond sign-in: a signed-in session may do everything its account may. This holds while no operation moves money, changes rights or exports data in bulk; the first such operation supersedes this decision.",
|
|
535
|
+
"consequences": "• Nothing to prompt for and nothing to keep about the second factor.\n• A stolen session is worth everything the account may do, so the idle and revocation limits carry the weight.\n• The first risky operation needs this decision superseded, not an exception.",
|
|
536
|
+
"alternatives": "1. A second factor for risky operations: one more prompt where it matters.\n2. Shorter sessions for everyone instead: cheaper to build, and annoying for everyone instead of for the few risky operations.",
|
|
537
|
+
"hubWhen": {
|
|
538
|
+
"IDENTITY": [
|
|
539
|
+
"idp",
|
|
540
|
+
"own"
|
|
541
|
+
],
|
|
542
|
+
"STEP_UP": [
|
|
543
|
+
"no"
|
|
544
|
+
]
|
|
545
|
+
}
|
|
546
|
+
},
|
|
497
547
|
{
|
|
498
548
|
"id": "ff-reject",
|
|
499
549
|
"type": "fitness-fn",
|
|
500
550
|
"label": "Unauthenticated calls refused",
|
|
501
551
|
"x": 1040,
|
|
502
552
|
"y": 0,
|
|
503
|
-
"
|
|
504
|
-
"
|
|
505
|
-
"
|
|
553
|
+
"characteristic": "security",
|
|
554
|
+
"scope": "atomic",
|
|
555
|
+
"cadence": "triggered",
|
|
556
|
+
"trigger": "pull-request",
|
|
557
|
+
"invocation": "automated",
|
|
558
|
+
"description": "A test lists the element's operations from its router (not from a list kept by hand), calls each without a credential, with an expired token and with a token of a session revoked in the test, and expects 401 from every one that is not on the public list. A new operation fails the test until it is protected or added to the public list, which shows up in the pull request.\n\nThreshold: Every operation not on the public list answers 401 without a credential, with an expired one and with a revoked one; 0 operations outside the public list answer anything else\n\nTool: Vitest with supertest (or the test runner and HTTP client of your stack: JUnit with MockMvc, xUnit with WebApplicationFactory, RSpec request specs)\n\n```ts\nimport request from 'supertest'\nimport { app, routes } from '../src/app' // routes: the router's table\nimport { PUBLIC } from '../src/auth/publicRoutes' // the public list, in the code\nimport { EXPIRED, signIn, signOut } from './auth/fixtures'\n\nconst revoked = await signIn()\nawait signOut(revoked)\n\ndescribe.each(routes.filter((r) => !PUBLIC.has(`${r.method} ${r.path}`)))('$method $path', (route) => {\n it('refuses a call without a credential', async () => {\n await request(app)[route.method.toLowerCase()](route.example).expect(401)\n })\n it('refuses an expired token', async () => {\n await request(app)[route.method.toLowerCase()](route.example).set('Authorization', `Bearer ${EXPIRED}`).expect(401)\n })\n it('refuses a revoked session', async () => {\n await request(app)[route.method.toLowerCase()](route.example).set('Authorization', `Bearer ${revoked}`).expect(401)\n })\n})\n```",
|
|
506
559
|
"hubWhen": {
|
|
507
560
|
"IDENTITY": [
|
|
508
561
|
"idp",
|
|
@@ -516,13 +569,113 @@
|
|
|
516
569
|
"label": "Session limits hold",
|
|
517
570
|
"x": 1040,
|
|
518
571
|
"y": 130,
|
|
519
|
-
"
|
|
520
|
-
"
|
|
521
|
-
"
|
|
572
|
+
"characteristic": "security",
|
|
573
|
+
"scope": "atomic",
|
|
574
|
+
"cadence": "triggered",
|
|
575
|
+
"trigger": "pull-request",
|
|
576
|
+
"invocation": "automated",
|
|
577
|
+
"description": "An integration test signs in on two instances, revokes the session on one and polls the other until it refuses, failing past {{REVOKE_SECONDS}} seconds. A second test runs against instances started with the idle timeout set to 5 seconds (the same setting that is {{SESSION_MINUTES}} minutes in production, read from the environment), waits 6 seconds and expects the next request to be refused; fake timers cannot move the server's clock, so the limit itself is made short for the drill. Where the session alone is enough, these two limits are the whole control, so this test is what keeps that decision honest.\n\nThreshold: An idle session ends after {{SESSION_MINUTES}} minutes; a revoked one is refused within {{REVOKE_SECONDS}} seconds on every instance\n\nTool: Vitest against two instances started by Testcontainers or docker compose with SESSION_IDLE_SECONDS=5 (or the equivalent of your stack)\n\n```ts\nimport { instanceA, instanceB, signIn, signOut, call, sleep } from './auth/instances' // started with SESSION_IDLE_SECONDS=5\nimport { REVOKE_SECONDS } from './auth/limits' // {{REVOKE_SECONDS}}, from the decision\n\nit('a revoked session stops on every instance in time', async () => {\n const token = await signIn(instanceA)\n await signOut(instanceA, token)\n const started = Date.now()\n while ((await call(instanceB, token)).status !== 401) {\n expect(Date.now() - started).toBeLessThan(REVOKE_SECONDS * 1000)\n await sleep(1000)\n }\n})\n\nit('an idle session ends after the idle limit', async () => {\n const token = await signIn(instanceA)\n expect((await call(instanceA, token)).status).toBe(200)\n await sleep(6_000) // past SESSION_IDLE_SECONDS=5 of the drill instances\n expect((await call(instanceA, token)).status).toBe(401)\n})\n```",
|
|
578
|
+
"hubWhen": {
|
|
579
|
+
"IDENTITY": [
|
|
580
|
+
"idp",
|
|
581
|
+
"own"
|
|
582
|
+
]
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"id": "ff-audit",
|
|
587
|
+
"type": "fitness-fn",
|
|
588
|
+
"label": "Sign-in events recorded, credentials not",
|
|
589
|
+
"x": 1040,
|
|
590
|
+
"y": 260,
|
|
591
|
+
"characteristic": "security",
|
|
592
|
+
"scope": "atomic",
|
|
593
|
+
"cadence": "triggered",
|
|
594
|
+
"trigger": "pull-request",
|
|
595
|
+
"invocation": "automated",
|
|
596
|
+
"description": "An integration test performs the four events for one account with a password and token of a known random value, reads back the audit records whose target is the account and checks their fields (action, at, source.client and source.address, as in the Audit trail pack's record format), then searches them and the captured application log for the credential values.\n\nThreshold: Each of sign-in, failed sign-in, sign-out and revocation produces 1 audit record naming the account as its target, with time, client and source address; 0 occurrences of the password or token in the audit trail and the application log\n\nTool: Vitest with supertest, the logs captured to a file by the test harness\n\n```ts\nimport { readFileSync } from 'node:fs'\nimport { app } from '../src/app'\nimport { audit } from '../src/audit/store'\nimport { createAccount, signInAs, signOut, revokeAll } from './auth/fixtures'\n\nit('audits the four sign-in events without the credential', async () => {\n const password = `pw-${crypto.randomUUID()}`\n const account = await createAccount({ password })\n const token = await signInAs(app, account, password)\n await signInAs(app, account, 'wrong-' + password).catch(() => undefined)\n await signOut(app, token)\n await revokeAll(app, account)\n const records = await audit.find({ target: { type: 'account', id: account.id } })\n expect(records.map((r) => r.action).sort()).toEqual(['revoke', 'sign-in', 'sign-in-failed', 'sign-out'])\n for (const r of records) expect(r).toMatchObject({ at: expect.any(Date), source: { client: expect.any(String), address: expect.any(String) } })\n const logs = JSON.stringify(records) + readFileSync(process.env.APP_LOG_FILE!, 'utf8')\n expect(logs).not.toContain(password)\n expect(logs).not.toContain(token)\n})\n```",
|
|
597
|
+
"hubWhen": {
|
|
598
|
+
"IDENTITY": [
|
|
599
|
+
"idp",
|
|
600
|
+
"own"
|
|
601
|
+
]
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
{
|
|
605
|
+
"id": "ff-lockout",
|
|
606
|
+
"type": "fitness-fn",
|
|
607
|
+
"label": "Guessing slowed",
|
|
608
|
+
"x": 1040,
|
|
609
|
+
"y": 390,
|
|
610
|
+
"characteristic": "security",
|
|
611
|
+
"scope": "atomic",
|
|
612
|
+
"cadence": "triggered",
|
|
613
|
+
"trigger": "pull-request",
|
|
614
|
+
"invocation": "automated",
|
|
615
|
+
"description": "An integration test fails five sign-ins for one account, measures the sixth (a 429 or a response at least 1 second slower than the first failure counts as delayed), and checks the outbox for the owner's notification.\n\nThreshold: After 5 failed sign-ins within 15 minutes the 6th attempt on that account is refused or delayed by at least 1 second, and 1 notification to the account's owner is sent\n\nTool: Vitest with supertest, with the mail or notification sender captured by the test harness\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app'\nimport { createAccount, notifications } from './auth/fixtures'\n\nit('slows the sixth attempt and tells the owner', async () => {\n const account = await createAccount({ password: 'correct horse battery staple' })\n const attempt = () => request(app).post('/auth/sign-in').send({ email: account.email, password: 'wrong' })\n const first = Date.now()\n await attempt()\n const firstMs = Date.now() - first\n for (let i = 0; i < 4; i++) await attempt()\n const started = Date.now()\n const sixth = await attempt()\n const delayed = sixth.status === 429 || Date.now() - started >= firstMs + 1000\n expect(delayed).toBe(true)\n expect(await notifications.sentTo(account.email, 'sign-in-attempts')).toHaveLength(1)\n})\n```",
|
|
616
|
+
"hubWhen": {
|
|
617
|
+
"IDENTITY": [
|
|
618
|
+
"own"
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
"id": "ff-passwords",
|
|
624
|
+
"type": "fitness-fn",
|
|
625
|
+
"label": "Passwords hashed and checked",
|
|
626
|
+
"x": 1040,
|
|
627
|
+
"y": 520,
|
|
628
|
+
"characteristic": "security",
|
|
629
|
+
"scope": "atomic",
|
|
630
|
+
"cadence": "triggered",
|
|
631
|
+
"trigger": "pull-request",
|
|
632
|
+
"invocation": "automated",
|
|
633
|
+
"description": "An integration test sets passwords through the sign-up operation (a breached one from the Pwned Passwords range API, too short, too long, and two valid ones) and reads the stored hashes to check the algorithm and its parameters.\n\nThreshold: 100% of stored password hashes start with $argon2id$v=19$m=19456,t=2,p=1$ (or stronger parameters); a breached password and one of 7 or 65 characters are refused; one of 8 and one of 64 are accepted\n\nTool: Vitest with supertest and a direct database read\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app'\nimport { db } from './db'\n\nconst signUp = (password: string) => request(app).post('/auth/sign-up').send({ email: `${crypto.randomUUID()}@example.test`, password })\n\nit('refuses breached and mis-sized passwords, stores the rest as Argon2id', async () => {\n expect((await signUp('password123')).status).toBe(400) // in Pwned Passwords\n expect((await signUp('abcdefg')).status).toBe(400) // 7 characters\n expect((await signUp('x'.repeat(65))).status).toBe(400) // 65 characters\n expect((await signUp('Aq7!tRw9')).status).toBe(201) // 8 characters\n expect((await signUp(crypto.randomUUID().repeat(2).slice(0, 64))).status).toBe(201)\n const { rows } = await db.query('select password_hash from users')\n for (const { password_hash } of rows) expect(password_hash).toMatch(/^\\$argon2id\\$v=19\\$m=(1945[6-9]|194[6-9]\\d|19[5-9]\\d\\d|[2-9]\\d{4}|[1-9]\\d{5,}),t=([2-9]|\\d{2,}),p=\\d+\\$/)\n})\n```",
|
|
634
|
+
"hubWhen": {
|
|
635
|
+
"IDENTITY": [
|
|
636
|
+
"own"
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"id": "ff-stepup",
|
|
642
|
+
"type": "fitness-fn",
|
|
643
|
+
"label": "Risky operations ask for a second factor",
|
|
644
|
+
"x": 1040,
|
|
645
|
+
"y": 650,
|
|
646
|
+
"characteristic": "security",
|
|
647
|
+
"scope": "atomic",
|
|
648
|
+
"cadence": "triggered",
|
|
649
|
+
"trigger": "pull-request",
|
|
650
|
+
"invocation": "automated",
|
|
651
|
+
"description": "A test reads the step-up list from the code, calls each listed operation with a session whose last second-factor confirmation is set to 6 minutes ago, expects a refusal, confirms the second factor and expects the operation to run.\n\nThreshold: Every operation on the step-up list refuses a session whose second factor is older than 5 minutes (401 or 403) and runs after a fresh confirmation; 0 listed operations run without one\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'\nimport { STEP_UP_OPERATIONS } from '../src/auth/stepUp' // the operations of the decision: {{PRIVILEGED_OPS}}\nimport { sessionWithMfaAgeMinutes, confirmSecondFactor } from './auth/fixtures'\n\ndescribe.each([...STEP_UP_OPERATIONS])('$method $path', (op) => {\n it('refuses a stale second factor and runs after a fresh one', async () => {\n const token = await sessionWithMfaAgeMinutes(6)\n const stale = await request(app)[op.method.toLowerCase()](op.example).set('Authorization', `Bearer ${token}`)\n expect([401, 403]).toContain(stale.status)\n await confirmSecondFactor(token)\n const fresh = await request(app)[op.method.toLowerCase()](op.example).set('Authorization', `Bearer ${token}`)\n expect(fresh.status).toBeLessThan(400)\n })\n})\n```",
|
|
522
652
|
"hubWhen": {
|
|
523
653
|
"IDENTITY": [
|
|
524
654
|
"idp",
|
|
525
655
|
"own"
|
|
656
|
+
],
|
|
657
|
+
"STEP_UP": [
|
|
658
|
+
"yes"
|
|
659
|
+
]
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
"id": "ff-machine",
|
|
664
|
+
"type": "fitness-fn",
|
|
665
|
+
"label": "Calling systems known and limited",
|
|
666
|
+
"x": 1040,
|
|
667
|
+
"y": 780,
|
|
668
|
+
"characteristic": "security",
|
|
669
|
+
"scope": "atomic",
|
|
670
|
+
"cadence": "triggered",
|
|
671
|
+
"trigger": "pull-request",
|
|
672
|
+
"invocation": "automated",
|
|
673
|
+
"description": "An integration test calls as a registered system (OAuth client, client certificate or API key, whichever the decision names) an operation on its list, one off it, and once without authenticating, and checks the registry of system credentials for any issued or rotated more than 90 days ago.\n\nThreshold: A call without a system credential and a call with one to an operation off the caller's list are refused (401 or 403); 0 system credentials older than 90 days in the credential registry\n\nTool: Vitest with supertest, the system credential issued by the test fixture (an OAuth client, a client certificate or an API key, as decided)\n\n```ts\nimport request from 'supertest'\nimport { app } from '../src/app'\nimport { systemCredentials } from '../src/auth/systemCredentials' // the registry: id, issued or rotated at, allowed operations\nimport { asSystem } from './auth/fixtures' // sets the credential of the decision on the request\n\nit('lets a known system run only its operations', async () => {\n const partner = await asSystem('partner-billing', { operations: ['POST /invoices'] })\n expect((await partner(request(app).post('/invoices').send({}))).status).toBeLessThan(400)\n expect([401, 403]).toContain((await partner(request(app).delete('/orders/1'))).status)\n expect((await request(app).post('/invoices').send({})).status).toBe(401)\n})\n\nit('has no system credential older than 90 days', async () => {\n const limit = Date.now() - 90 * 86_400_000\n expect((await systemCredentials.all()).filter((c) => c.rotatedAt.getTime() < limit)).toEqual([])\n})\n```",
|
|
674
|
+
"hubWhen": {
|
|
675
|
+
"MACHINE": [
|
|
676
|
+
"oauth",
|
|
677
|
+
"mtls",
|
|
678
|
+
"keys"
|
|
526
679
|
]
|
|
527
680
|
}
|
|
528
681
|
},
|
|
@@ -531,10 +684,13 @@
|
|
|
531
684
|
"type": "fitness-fn",
|
|
532
685
|
"label": "Nothing to sign in to",
|
|
533
686
|
"x": 1040,
|
|
534
|
-
"y":
|
|
535
|
-
"
|
|
536
|
-
"
|
|
537
|
-
"
|
|
687
|
+
"y": 910,
|
|
688
|
+
"characteristic": "security",
|
|
689
|
+
"scope": "atomic",
|
|
690
|
+
"cadence": "triggered",
|
|
691
|
+
"trigger": "pull-request",
|
|
692
|
+
"invocation": "automated",
|
|
693
|
+
"description": "A dependency rule fails the build when a sign-in or session library is added, which would mean a sign-in arrived without its decision. Token validation libraries (jose, jsonwebtoken) stay allowed: calling systems authenticate as decided under Other systems.\n\nThreshold: No operation signs a person in, starts a session or reads a person's credential, and no sign-in or session library is a dependency\n\nTool: dependency-cruiser (or the equivalent for your stack: ArchUnit, NetArchTest, a RuboCop custom cop)\n\n```js\n// .dependency-cruiser.cjs\nmodule.exports = {\n forbidden: [{\n name: 'no-sign-in',\n comment: 'ADR Nobody signs in: supersede it before adding sign-in or sessions for people',\n severity: 'error',\n from: {},\n to: { path: 'node_modules/(passport|next-auth|@auth/|express-session|iron-session|oidc-client-ts|better-auth|lucia)' },\n }],\n}\n```",
|
|
538
694
|
"hubWhen": {
|
|
539
695
|
"IDENTITY": [
|
|
540
696
|
"none"
|
|
@@ -675,6 +831,60 @@
|
|
|
675
831
|
"targetId": "adr-own",
|
|
676
832
|
"relationType": "implements"
|
|
677
833
|
},
|
|
834
|
+
{
|
|
835
|
+
"id": "ff-session--implements--adr-no-stepup",
|
|
836
|
+
"sourceId": "ff-session",
|
|
837
|
+
"targetId": "adr-no-stepup",
|
|
838
|
+
"relationType": "implements"
|
|
839
|
+
},
|
|
840
|
+
{
|
|
841
|
+
"id": "ff-audit--implements--adr-idp",
|
|
842
|
+
"sourceId": "ff-audit",
|
|
843
|
+
"targetId": "adr-idp",
|
|
844
|
+
"relationType": "implements"
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
"id": "ff-audit--implements--adr-own",
|
|
848
|
+
"sourceId": "ff-audit",
|
|
849
|
+
"targetId": "adr-own",
|
|
850
|
+
"relationType": "implements"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
"id": "ff-lockout--implements--adr-own",
|
|
854
|
+
"sourceId": "ff-lockout",
|
|
855
|
+
"targetId": "adr-own",
|
|
856
|
+
"relationType": "implements"
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
"id": "ff-passwords--implements--adr-own",
|
|
860
|
+
"sourceId": "ff-passwords",
|
|
861
|
+
"targetId": "adr-own",
|
|
862
|
+
"relationType": "implements"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"id": "ff-stepup--implements--adr-stepup",
|
|
866
|
+
"sourceId": "ff-stepup",
|
|
867
|
+
"targetId": "adr-stepup",
|
|
868
|
+
"relationType": "implements"
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
"id": "ff-machine--implements--adr-idp",
|
|
872
|
+
"sourceId": "ff-machine",
|
|
873
|
+
"targetId": "adr-idp",
|
|
874
|
+
"relationType": "implements"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"id": "ff-machine--implements--adr-own",
|
|
878
|
+
"sourceId": "ff-machine",
|
|
879
|
+
"targetId": "adr-own",
|
|
880
|
+
"relationType": "implements"
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
"id": "ff-machine--implements--adr-none",
|
|
884
|
+
"sourceId": "ff-machine",
|
|
885
|
+
"targetId": "adr-none",
|
|
886
|
+
"relationType": "implements"
|
|
887
|
+
},
|
|
678
888
|
{
|
|
679
889
|
"id": "ff-none--implements--adr-none",
|
|
680
890
|
"sourceId": "ff-none",
|