@selfauth/conformance 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +16 -2
- package/cases/admin.json +326 -0
- package/cases/audit-and-errors.json +233 -0
- package/cases/csrf.json +413 -0
- package/cases/email-verification.json +567 -0
- package/cases/identity.json +546 -0
- package/cases/login.json +446 -0
- package/cases/logout.json +213 -0
- package/cases/password-change.json +270 -0
- package/cases/password-reset.json +698 -0
- package/cases/rate-limits.json +667 -0
- package/cases/rbac.json +575 -0
- package/cases/registration.json +782 -0
- package/cases/resources.json +373 -0
- package/cases/sessions.json +308 -0
- package/dist/compliance.d.ts +118 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +201 -0
- package/dist/compliance.js.map +1 -0
- package/dist/coverage.d.ts +26 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +105 -0
- package/dist/coverage.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/load.d.ts +12 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +26 -0
- package/dist/load.js.map +1 -0
- package/dist/render.d.ts +19 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +20 -0
- package/dist/render.js.map +1 -0
- package/dist/report.d.ts +3 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +31 -0
- package/dist/report.js.map +1 -0
- package/dist/runner/assertions.d.ts +11 -0
- package/dist/runner/assertions.d.ts.map +1 -0
- package/dist/runner/assertions.js +253 -0
- package/dist/runner/assertions.js.map +1 -0
- package/dist/runner/driver.d.ts +58 -0
- package/dist/runner/driver.d.ts.map +1 -0
- package/dist/runner/driver.js +2 -0
- package/dist/runner/driver.js.map +1 -0
- package/dist/runner/run.d.ts +17 -0
- package/dist/runner/run.d.ts.map +1 -0
- package/dist/runner/run.js +390 -0
- package/dist/runner/run.js.map +1 -0
- package/dist/schema.d.ts +168 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +121 -0
- package/dist/schema.js.map +1 -0
- package/package.json +53 -3
- package/verification.json +165 -0
package/cases/csrf.json
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cases": [
|
|
3
|
+
{
|
|
4
|
+
"id": "CT-CSRF-001",
|
|
5
|
+
"title": "Cross-site requests to state-changing operations are rejected and audited",
|
|
6
|
+
"category": "csrf",
|
|
7
|
+
"level": "core",
|
|
8
|
+
"requirements": ["SEC-CSRF-001", "SEC-CSRF-003", "SEC-CSRF-005"],
|
|
9
|
+
"config": {
|
|
10
|
+
"http": {
|
|
11
|
+
"trustedOrigins": ["https://app.example.test"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"given": [
|
|
15
|
+
{
|
|
16
|
+
"user": "alice",
|
|
17
|
+
"email": "alice@example.test",
|
|
18
|
+
"password": "correct horse battery staple",
|
|
19
|
+
"state": "active"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"steps": [
|
|
23
|
+
{
|
|
24
|
+
"op": "rawRequest",
|
|
25
|
+
"note": "login CSRF",
|
|
26
|
+
"input": {
|
|
27
|
+
"operation": "login",
|
|
28
|
+
"headers": {
|
|
29
|
+
"Sec-Fetch-Site": "cross-site",
|
|
30
|
+
"Origin": "https://evil.test"
|
|
31
|
+
},
|
|
32
|
+
"body": {
|
|
33
|
+
"email": "alice@example.test",
|
|
34
|
+
"password": "correct horse battery staple"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"expect": {
|
|
38
|
+
"outcome": "error",
|
|
39
|
+
"code": "CSRF_FAILED",
|
|
40
|
+
"sessionCreated": false
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"op": "rawRequest",
|
|
45
|
+
"input": {
|
|
46
|
+
"operation": "register",
|
|
47
|
+
"headers": {
|
|
48
|
+
"Sec-Fetch-Site": "cross-site"
|
|
49
|
+
},
|
|
50
|
+
"body": {
|
|
51
|
+
"email": "x@example.test",
|
|
52
|
+
"password": "correct horse battery staple"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"expect": {
|
|
56
|
+
"outcome": "error",
|
|
57
|
+
"code": "CSRF_FAILED"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"op": "login",
|
|
62
|
+
"input": {
|
|
63
|
+
"email": "alice@example.test",
|
|
64
|
+
"password": "correct horse battery staple"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"op": "rawRequest",
|
|
69
|
+
"input": {
|
|
70
|
+
"operation": "logout",
|
|
71
|
+
"headers": {
|
|
72
|
+
"Sec-Fetch-Site": "cross-site"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"expect": {
|
|
76
|
+
"outcome": "error",
|
|
77
|
+
"code": "CSRF_FAILED"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"op": "getCurrentUser",
|
|
82
|
+
"expect": {
|
|
83
|
+
"outcome": "success"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"op": "inspectEvents",
|
|
88
|
+
"input": {
|
|
89
|
+
"type": "csrf.rejected"
|
|
90
|
+
},
|
|
91
|
+
"expect": {
|
|
92
|
+
"outcome": "success",
|
|
93
|
+
"assert": {
|
|
94
|
+
"countAtLeast": 1
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "CT-CSRF-002",
|
|
102
|
+
"title": "Untrusted Origin headers are rejected",
|
|
103
|
+
"category": "csrf",
|
|
104
|
+
"level": "core",
|
|
105
|
+
"requirements": ["SEC-CSRF-003"],
|
|
106
|
+
"config": {
|
|
107
|
+
"http": {
|
|
108
|
+
"trustedOrigins": ["https://app.example.test"]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"given": [
|
|
112
|
+
{
|
|
113
|
+
"user": "alice",
|
|
114
|
+
"email": "alice@example.test",
|
|
115
|
+
"password": "correct horse battery staple",
|
|
116
|
+
"state": "active"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"steps": [
|
|
120
|
+
{
|
|
121
|
+
"op": "login",
|
|
122
|
+
"input": {
|
|
123
|
+
"email": "alice@example.test",
|
|
124
|
+
"password": "correct horse battery staple"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"op": "rawRequest",
|
|
129
|
+
"input": {
|
|
130
|
+
"operation": "logoutAll",
|
|
131
|
+
"headers": {
|
|
132
|
+
"Origin": "https://app.example.test.evil.test"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"expect": {
|
|
136
|
+
"outcome": "error",
|
|
137
|
+
"code": "CSRF_FAILED"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"op": "rawRequest",
|
|
142
|
+
"input": {
|
|
143
|
+
"operation": "logoutAll",
|
|
144
|
+
"headers": {
|
|
145
|
+
"Origin": "null"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"expect": {
|
|
149
|
+
"outcome": "error",
|
|
150
|
+
"code": "CSRF_FAILED"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"op": "getCurrentUser",
|
|
155
|
+
"expect": {
|
|
156
|
+
"outcome": "success"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "CT-CSRF-003",
|
|
163
|
+
"title": "Requests with neither Origin nor Sec-Fetch-Site need a CSRF token",
|
|
164
|
+
"category": "csrf",
|
|
165
|
+
"level": "core",
|
|
166
|
+
"requirements": ["SEC-CSRF-003"],
|
|
167
|
+
"given": [
|
|
168
|
+
{
|
|
169
|
+
"user": "alice",
|
|
170
|
+
"email": "alice@example.test",
|
|
171
|
+
"password": "correct horse battery staple",
|
|
172
|
+
"state": "active"
|
|
173
|
+
}
|
|
174
|
+
],
|
|
175
|
+
"steps": [
|
|
176
|
+
{
|
|
177
|
+
"op": "login",
|
|
178
|
+
"input": {
|
|
179
|
+
"email": "alice@example.test",
|
|
180
|
+
"password": "correct horse battery staple"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"op": "rawRequest",
|
|
185
|
+
"input": {
|
|
186
|
+
"operation": "logoutAll",
|
|
187
|
+
"omitHeaders": ["Origin", "Sec-Fetch-Site", "Referer", "$config.csrfHeaderName"]
|
|
188
|
+
},
|
|
189
|
+
"expect": {
|
|
190
|
+
"outcome": "error",
|
|
191
|
+
"code": "CSRF_FAILED"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"op": "getCurrentUser",
|
|
196
|
+
"expect": {
|
|
197
|
+
"outcome": "success"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"id": "CT-CSRF-004",
|
|
204
|
+
"title": "Header mode requires the custom CSRF header even from a trusted origin",
|
|
205
|
+
"category": "csrf",
|
|
206
|
+
"level": "core",
|
|
207
|
+
"requirements": ["SEC-CSRF-004"],
|
|
208
|
+
"config": {
|
|
209
|
+
"http": {
|
|
210
|
+
"trustedOrigins": ["https://app.example.test"],
|
|
211
|
+
"csrf": {
|
|
212
|
+
"mode": "header"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"given": [
|
|
217
|
+
{
|
|
218
|
+
"user": "alice",
|
|
219
|
+
"email": "alice@example.test",
|
|
220
|
+
"password": "correct horse battery staple",
|
|
221
|
+
"state": "active"
|
|
222
|
+
}
|
|
223
|
+
],
|
|
224
|
+
"steps": [
|
|
225
|
+
{
|
|
226
|
+
"op": "login",
|
|
227
|
+
"input": {
|
|
228
|
+
"email": "alice@example.test",
|
|
229
|
+
"password": "correct horse battery staple"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"op": "rawRequest",
|
|
234
|
+
"input": {
|
|
235
|
+
"operation": "logoutAll",
|
|
236
|
+
"headers": {
|
|
237
|
+
"Origin": "https://app.example.test",
|
|
238
|
+
"Sec-Fetch-Site": "same-site"
|
|
239
|
+
},
|
|
240
|
+
"omitHeaders": ["X-SelfAuth-CSRF"]
|
|
241
|
+
},
|
|
242
|
+
"expect": {
|
|
243
|
+
"outcome": "error",
|
|
244
|
+
"code": "CSRF_FAILED"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"op": "rawRequest",
|
|
249
|
+
"input": {
|
|
250
|
+
"operation": "logoutAll",
|
|
251
|
+
"headers": {
|
|
252
|
+
"Origin": "https://app.example.test",
|
|
253
|
+
"Sec-Fetch-Site": "same-site",
|
|
254
|
+
"X-SelfAuth-CSRF": "1"
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
"expect": {
|
|
258
|
+
"outcome": "success"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
]
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "CT-CSRF-005",
|
|
265
|
+
"title": "Token mode with SameSite=None requires a session-bound CSRF token",
|
|
266
|
+
"category": "csrf",
|
|
267
|
+
"level": "core",
|
|
268
|
+
"requirements": ["SEC-CSRF-004", "SEC-COOKIE-005"],
|
|
269
|
+
"config": {
|
|
270
|
+
"authentication": {
|
|
271
|
+
"sessions": {
|
|
272
|
+
"cookie": {
|
|
273
|
+
"sameSite": "none"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"http": {
|
|
278
|
+
"trustedOrigins": ["https://app.example.test"],
|
|
279
|
+
"csrf": {
|
|
280
|
+
"mode": "token"
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
"given": [
|
|
285
|
+
{
|
|
286
|
+
"user": "alice",
|
|
287
|
+
"email": "alice@example.test",
|
|
288
|
+
"password": "correct horse battery staple",
|
|
289
|
+
"state": "active"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"user": "bob",
|
|
293
|
+
"email": "bob@example.test",
|
|
294
|
+
"password": "correct horse battery staple",
|
|
295
|
+
"state": "active"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"steps": [
|
|
299
|
+
{
|
|
300
|
+
"op": "login",
|
|
301
|
+
"input": {
|
|
302
|
+
"email": "alice@example.test",
|
|
303
|
+
"password": "correct horse battery staple"
|
|
304
|
+
},
|
|
305
|
+
"save": "sess"
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"op": "login",
|
|
309
|
+
"as": "bob",
|
|
310
|
+
"input": {
|
|
311
|
+
"email": "bob@example.test",
|
|
312
|
+
"password": "correct horse battery staple"
|
|
313
|
+
},
|
|
314
|
+
"save": "bobSess"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"op": "rawRequest",
|
|
318
|
+
"input": {
|
|
319
|
+
"operation": "logoutAll",
|
|
320
|
+
"headers": {
|
|
321
|
+
"Origin": "https://app.example.test"
|
|
322
|
+
},
|
|
323
|
+
"omitCsrfToken": true
|
|
324
|
+
},
|
|
325
|
+
"expect": {
|
|
326
|
+
"outcome": "error",
|
|
327
|
+
"code": "CSRF_FAILED"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
"op": "rawRequest",
|
|
332
|
+
"note": "another session's token",
|
|
333
|
+
"input": {
|
|
334
|
+
"operation": "logoutAll",
|
|
335
|
+
"headers": {
|
|
336
|
+
"Origin": "https://app.example.test"
|
|
337
|
+
},
|
|
338
|
+
"csrfToken": "$bobSess.csrfToken"
|
|
339
|
+
},
|
|
340
|
+
"expect": {
|
|
341
|
+
"outcome": "error",
|
|
342
|
+
"code": "CSRF_FAILED"
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"op": "rawRequest",
|
|
347
|
+
"input": {
|
|
348
|
+
"operation": "logoutAll",
|
|
349
|
+
"headers": {
|
|
350
|
+
"Origin": "https://app.example.test"
|
|
351
|
+
},
|
|
352
|
+
"csrfToken": "$sess.csrfToken"
|
|
353
|
+
},
|
|
354
|
+
"expect": {
|
|
355
|
+
"outcome": "success"
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "CT-CORS-001",
|
|
362
|
+
"title": "CORS never reflects untrusted origins with credentials",
|
|
363
|
+
"category": "csrf",
|
|
364
|
+
"level": "core",
|
|
365
|
+
"requirements": ["SEC-CORS-001"],
|
|
366
|
+
"config": {
|
|
367
|
+
"http": {
|
|
368
|
+
"trustedOrigins": ["https://app.example.test"]
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"given": [],
|
|
372
|
+
"steps": [
|
|
373
|
+
{
|
|
374
|
+
"op": "rawRequest",
|
|
375
|
+
"input": {
|
|
376
|
+
"method": "OPTIONS",
|
|
377
|
+
"operation": "login",
|
|
378
|
+
"headers": {
|
|
379
|
+
"Origin": "https://evil.test",
|
|
380
|
+
"Access-Control-Request-Method": "POST"
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
"expect": {
|
|
384
|
+
"outcome": "success",
|
|
385
|
+
"assert": {
|
|
386
|
+
"header.access-control-allow-origin": {
|
|
387
|
+
"notEqual": "https://evil.test"
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"op": "rawRequest",
|
|
394
|
+
"input": {
|
|
395
|
+
"method": "OPTIONS",
|
|
396
|
+
"operation": "login",
|
|
397
|
+
"headers": {
|
|
398
|
+
"Origin": "https://app.example.test",
|
|
399
|
+
"Access-Control-Request-Method": "POST"
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"expect": {
|
|
403
|
+
"outcome": "success",
|
|
404
|
+
"assert": {
|
|
405
|
+
"header.access-control-allow-origin": "https://app.example.test",
|
|
406
|
+
"header.access-control-allow-credentials": "true"
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
]
|
|
413
|
+
}
|