@selfauth/conformance 0.0.0-stage → 0.1.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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +16 -2
  3. package/cases/admin.json +326 -0
  4. package/cases/audit-and-errors.json +233 -0
  5. package/cases/csrf.json +413 -0
  6. package/cases/email-verification.json +567 -0
  7. package/cases/identity.json +546 -0
  8. package/cases/login.json +446 -0
  9. package/cases/logout.json +213 -0
  10. package/cases/password-change.json +270 -0
  11. package/cases/password-reset.json +698 -0
  12. package/cases/rate-limits.json +667 -0
  13. package/cases/rbac.json +575 -0
  14. package/cases/registration.json +782 -0
  15. package/cases/resources.json +373 -0
  16. package/cases/sessions.json +308 -0
  17. package/dist/coverage.d.ts +26 -0
  18. package/dist/coverage.d.ts.map +1 -0
  19. package/dist/coverage.js +105 -0
  20. package/dist/coverage.js.map +1 -0
  21. package/dist/index.d.ts +7 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +7 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/load.d.ts +12 -0
  26. package/dist/load.d.ts.map +1 -0
  27. package/dist/load.js +26 -0
  28. package/dist/load.js.map +1 -0
  29. package/dist/report.d.ts +3 -0
  30. package/dist/report.d.ts.map +1 -0
  31. package/dist/report.js +31 -0
  32. package/dist/report.js.map +1 -0
  33. package/dist/runner/assertions.d.ts +11 -0
  34. package/dist/runner/assertions.d.ts.map +1 -0
  35. package/dist/runner/assertions.js +253 -0
  36. package/dist/runner/assertions.js.map +1 -0
  37. package/dist/runner/driver.d.ts +58 -0
  38. package/dist/runner/driver.d.ts.map +1 -0
  39. package/dist/runner/driver.js +2 -0
  40. package/dist/runner/driver.js.map +1 -0
  41. package/dist/runner/run.d.ts +17 -0
  42. package/dist/runner/run.d.ts.map +1 -0
  43. package/dist/runner/run.js +390 -0
  44. package/dist/runner/run.js.map +1 -0
  45. package/dist/schema.d.ts +168 -0
  46. package/dist/schema.d.ts.map +1 -0
  47. package/dist/schema.js +121 -0
  48. package/dist/schema.js.map +1 -0
  49. package/package.json +53 -3
  50. package/verification.json +165 -0
@@ -0,0 +1,667 @@
1
+ {
2
+ "cases": [
3
+ {
4
+ "id": "CT-RATE-001",
5
+ "title": "Login is limited per account, even for unknown accounts and correct passwords",
6
+ "category": "rate-limits",
7
+ "level": "core",
8
+ "requirements": ["SEC-RATE-001", "SEC-RATE-004", "AUTHN-LOGIN-006", "SEC-AUDIT-001"],
9
+ "given": [
10
+ {
11
+ "user": "alice",
12
+ "email": "alice@example.test",
13
+ "password": "correct horse battery staple",
14
+ "state": "active"
15
+ }
16
+ ],
17
+ "steps": [
18
+ {
19
+ "op": "login",
20
+ "input": {
21
+ "email": "alice@example.test",
22
+ "password": "wrong password!!"
23
+ },
24
+ "expect": {
25
+ "outcome": "error",
26
+ "code": "INVALID_CREDENTIALS"
27
+ }
28
+ },
29
+ {
30
+ "op": "login",
31
+ "input": {
32
+ "email": "alice@example.test",
33
+ "password": "wrong password!!"
34
+ },
35
+ "expect": {
36
+ "outcome": "error",
37
+ "code": "INVALID_CREDENTIALS"
38
+ }
39
+ },
40
+ {
41
+ "op": "login",
42
+ "input": {
43
+ "email": "alice@example.test",
44
+ "password": "wrong password!!"
45
+ },
46
+ "expect": {
47
+ "outcome": "error",
48
+ "code": "INVALID_CREDENTIALS"
49
+ }
50
+ },
51
+ {
52
+ "op": "login",
53
+ "input": {
54
+ "email": "alice@example.test",
55
+ "password": "wrong password!!"
56
+ },
57
+ "expect": {
58
+ "outcome": "error",
59
+ "code": "INVALID_CREDENTIALS"
60
+ }
61
+ },
62
+ {
63
+ "op": "login",
64
+ "input": {
65
+ "email": "alice@example.test",
66
+ "password": "wrong password!!"
67
+ },
68
+ "expect": {
69
+ "outcome": "error",
70
+ "code": "INVALID_CREDENTIALS"
71
+ }
72
+ },
73
+ {
74
+ "op": "login",
75
+ "note": "correct password, still limited",
76
+ "input": {
77
+ "email": "alice@example.test",
78
+ "password": "correct horse battery staple"
79
+ },
80
+ "expect": {
81
+ "outcome": "error",
82
+ "code": "RATE_LIMITED",
83
+ "sessionCreated": false
84
+ },
85
+ "save": "limited"
86
+ },
87
+ {
88
+ "op": "login",
89
+ "input": {
90
+ "email": "nobody@example.test",
91
+ "password": "wrong password!!"
92
+ },
93
+ "expect": {
94
+ "outcome": "error",
95
+ "code": "INVALID_CREDENTIALS"
96
+ }
97
+ },
98
+ {
99
+ "op": "login",
100
+ "input": {
101
+ "email": "nobody@example.test",
102
+ "password": "wrong password!!"
103
+ },
104
+ "expect": {
105
+ "outcome": "error",
106
+ "code": "INVALID_CREDENTIALS"
107
+ }
108
+ },
109
+ {
110
+ "op": "login",
111
+ "input": {
112
+ "email": "nobody@example.test",
113
+ "password": "wrong password!!"
114
+ },
115
+ "expect": {
116
+ "outcome": "error",
117
+ "code": "INVALID_CREDENTIALS"
118
+ }
119
+ },
120
+ {
121
+ "op": "login",
122
+ "input": {
123
+ "email": "nobody@example.test",
124
+ "password": "wrong password!!"
125
+ },
126
+ "expect": {
127
+ "outcome": "error",
128
+ "code": "INVALID_CREDENTIALS"
129
+ }
130
+ },
131
+ {
132
+ "op": "login",
133
+ "input": {
134
+ "email": "nobody@example.test",
135
+ "password": "wrong password!!"
136
+ },
137
+ "expect": {
138
+ "outcome": "error",
139
+ "code": "INVALID_CREDENTIALS"
140
+ }
141
+ },
142
+ {
143
+ "op": "login",
144
+ "input": {
145
+ "email": "nobody@example.test",
146
+ "password": "wrong password!!"
147
+ },
148
+ "expect": {
149
+ "outcome": "error",
150
+ "code": "RATE_LIMITED",
151
+ "indistinguishableFrom": "limited"
152
+ }
153
+ },
154
+ {
155
+ "op": "inspectEvents",
156
+ "input": {
157
+ "type": "rate_limit.triggered"
158
+ },
159
+ "expect": {
160
+ "outcome": "success",
161
+ "assert": {
162
+ "countAtLeast": 1
163
+ }
164
+ }
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ "id": "CT-RATE-002",
170
+ "title": "Rate-limit blocks are temporary",
171
+ "category": "rate-limits",
172
+ "level": "core",
173
+ "requirements": ["SEC-RATE-003"],
174
+ "given": [
175
+ {
176
+ "user": "alice",
177
+ "email": "alice@example.test",
178
+ "password": "correct horse battery staple",
179
+ "state": "active"
180
+ }
181
+ ],
182
+ "steps": [
183
+ {
184
+ "op": "login",
185
+ "input": {
186
+ "email": "alice@example.test",
187
+ "password": "wrong password!!"
188
+ }
189
+ },
190
+ {
191
+ "op": "login",
192
+ "input": {
193
+ "email": "alice@example.test",
194
+ "password": "wrong password!!"
195
+ }
196
+ },
197
+ {
198
+ "op": "login",
199
+ "input": {
200
+ "email": "alice@example.test",
201
+ "password": "wrong password!!"
202
+ }
203
+ },
204
+ {
205
+ "op": "login",
206
+ "input": {
207
+ "email": "alice@example.test",
208
+ "password": "wrong password!!"
209
+ }
210
+ },
211
+ {
212
+ "op": "login",
213
+ "input": {
214
+ "email": "alice@example.test",
215
+ "password": "wrong password!!"
216
+ }
217
+ },
218
+ {
219
+ "op": "login",
220
+ "input": {
221
+ "email": "alice@example.test",
222
+ "password": "wrong password!!"
223
+ }
224
+ },
225
+ {
226
+ "op": "login",
227
+ "input": {
228
+ "email": "alice@example.test",
229
+ "password": "correct horse battery staple"
230
+ },
231
+ "expect": {
232
+ "outcome": "error",
233
+ "code": "RATE_LIMITED"
234
+ }
235
+ },
236
+ {
237
+ "op": "advanceClock",
238
+ "input": {
239
+ "minutes": 60
240
+ }
241
+ },
242
+ {
243
+ "op": "login",
244
+ "input": {
245
+ "email": "alice@example.test",
246
+ "password": "correct horse battery staple"
247
+ },
248
+ "expect": {
249
+ "outcome": "success",
250
+ "sessionCreated": true
251
+ }
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ "id": "CT-RATE-003",
257
+ "title": "Login is limited per client address across accounts",
258
+ "category": "rate-limits",
259
+ "level": "core",
260
+ "requirements": ["SEC-RATE-001"],
261
+ "config": {
262
+ "authentication": {
263
+ "rateLimit": {
264
+ "login": {
265
+ "perAddress": {
266
+ "limit": 10
267
+ }
268
+ }
269
+ }
270
+ }
271
+ },
272
+ "given": [],
273
+ "steps": [
274
+ {
275
+ "op": "login",
276
+ "input": {
277
+ "email": "spray0@example.test",
278
+ "password": "wrong password!!"
279
+ },
280
+ "expect": {
281
+ "outcome": "error",
282
+ "code": "INVALID_CREDENTIALS"
283
+ }
284
+ },
285
+ {
286
+ "op": "login",
287
+ "input": {
288
+ "email": "spray1@example.test",
289
+ "password": "wrong password!!"
290
+ },
291
+ "expect": {
292
+ "outcome": "error",
293
+ "code": "INVALID_CREDENTIALS"
294
+ }
295
+ },
296
+ {
297
+ "op": "login",
298
+ "input": {
299
+ "email": "spray2@example.test",
300
+ "password": "wrong password!!"
301
+ },
302
+ "expect": {
303
+ "outcome": "error",
304
+ "code": "INVALID_CREDENTIALS"
305
+ }
306
+ },
307
+ {
308
+ "op": "login",
309
+ "input": {
310
+ "email": "spray3@example.test",
311
+ "password": "wrong password!!"
312
+ },
313
+ "expect": {
314
+ "outcome": "error",
315
+ "code": "INVALID_CREDENTIALS"
316
+ }
317
+ },
318
+ {
319
+ "op": "login",
320
+ "input": {
321
+ "email": "spray4@example.test",
322
+ "password": "wrong password!!"
323
+ },
324
+ "expect": {
325
+ "outcome": "error",
326
+ "code": "INVALID_CREDENTIALS"
327
+ }
328
+ },
329
+ {
330
+ "op": "login",
331
+ "input": {
332
+ "email": "spray5@example.test",
333
+ "password": "wrong password!!"
334
+ },
335
+ "expect": {
336
+ "outcome": "error",
337
+ "code": "INVALID_CREDENTIALS"
338
+ }
339
+ },
340
+ {
341
+ "op": "login",
342
+ "input": {
343
+ "email": "spray6@example.test",
344
+ "password": "wrong password!!"
345
+ },
346
+ "expect": {
347
+ "outcome": "error",
348
+ "code": "INVALID_CREDENTIALS"
349
+ }
350
+ },
351
+ {
352
+ "op": "login",
353
+ "input": {
354
+ "email": "spray7@example.test",
355
+ "password": "wrong password!!"
356
+ },
357
+ "expect": {
358
+ "outcome": "error",
359
+ "code": "INVALID_CREDENTIALS"
360
+ }
361
+ },
362
+ {
363
+ "op": "login",
364
+ "input": {
365
+ "email": "spray8@example.test",
366
+ "password": "wrong password!!"
367
+ },
368
+ "expect": {
369
+ "outcome": "error",
370
+ "code": "INVALID_CREDENTIALS"
371
+ }
372
+ },
373
+ {
374
+ "op": "login",
375
+ "input": {
376
+ "email": "spray9@example.test",
377
+ "password": "wrong password!!"
378
+ },
379
+ "expect": {
380
+ "outcome": "error",
381
+ "code": "INVALID_CREDENTIALS"
382
+ }
383
+ },
384
+ {
385
+ "op": "login",
386
+ "input": {
387
+ "email": "spray-final@example.test",
388
+ "password": "wrong password!!"
389
+ },
390
+ "expect": {
391
+ "outcome": "error",
392
+ "code": "RATE_LIMITED"
393
+ }
394
+ }
395
+ ]
396
+ },
397
+ {
398
+ "id": "CT-RATE-004",
399
+ "title": "Forwarding headers are not trusted by default",
400
+ "category": "rate-limits",
401
+ "level": "core",
402
+ "requirements": ["SEC-RATE-005"],
403
+ "config": {
404
+ "authentication": {
405
+ "rateLimit": {
406
+ "login": {
407
+ "perAddress": {
408
+ "limit": 10
409
+ }
410
+ }
411
+ }
412
+ }
413
+ },
414
+ "given": [],
415
+ "steps": [
416
+ {
417
+ "op": "rawRequest",
418
+ "input": {
419
+ "operation": "login",
420
+ "headers": {
421
+ "X-Forwarded-For": "203.0.113.0",
422
+ "Forwarded": "for=203.0.113.0"
423
+ },
424
+ "body": {
425
+ "email": "spray0@example.test",
426
+ "password": "wrong password!!"
427
+ }
428
+ },
429
+ "expect": {
430
+ "outcome": "error",
431
+ "code": "INVALID_CREDENTIALS"
432
+ }
433
+ },
434
+ {
435
+ "op": "rawRequest",
436
+ "input": {
437
+ "operation": "login",
438
+ "headers": {
439
+ "X-Forwarded-For": "203.0.113.1",
440
+ "Forwarded": "for=203.0.113.1"
441
+ },
442
+ "body": {
443
+ "email": "spray1@example.test",
444
+ "password": "wrong password!!"
445
+ }
446
+ },
447
+ "expect": {
448
+ "outcome": "error",
449
+ "code": "INVALID_CREDENTIALS"
450
+ }
451
+ },
452
+ {
453
+ "op": "rawRequest",
454
+ "input": {
455
+ "operation": "login",
456
+ "headers": {
457
+ "X-Forwarded-For": "203.0.113.2",
458
+ "Forwarded": "for=203.0.113.2"
459
+ },
460
+ "body": {
461
+ "email": "spray2@example.test",
462
+ "password": "wrong password!!"
463
+ }
464
+ },
465
+ "expect": {
466
+ "outcome": "error",
467
+ "code": "INVALID_CREDENTIALS"
468
+ }
469
+ },
470
+ {
471
+ "op": "rawRequest",
472
+ "input": {
473
+ "operation": "login",
474
+ "headers": {
475
+ "X-Forwarded-For": "203.0.113.3",
476
+ "Forwarded": "for=203.0.113.3"
477
+ },
478
+ "body": {
479
+ "email": "spray3@example.test",
480
+ "password": "wrong password!!"
481
+ }
482
+ },
483
+ "expect": {
484
+ "outcome": "error",
485
+ "code": "INVALID_CREDENTIALS"
486
+ }
487
+ },
488
+ {
489
+ "op": "rawRequest",
490
+ "input": {
491
+ "operation": "login",
492
+ "headers": {
493
+ "X-Forwarded-For": "203.0.113.4",
494
+ "Forwarded": "for=203.0.113.4"
495
+ },
496
+ "body": {
497
+ "email": "spray4@example.test",
498
+ "password": "wrong password!!"
499
+ }
500
+ },
501
+ "expect": {
502
+ "outcome": "error",
503
+ "code": "INVALID_CREDENTIALS"
504
+ }
505
+ },
506
+ {
507
+ "op": "rawRequest",
508
+ "input": {
509
+ "operation": "login",
510
+ "headers": {
511
+ "X-Forwarded-For": "203.0.113.5",
512
+ "Forwarded": "for=203.0.113.5"
513
+ },
514
+ "body": {
515
+ "email": "spray5@example.test",
516
+ "password": "wrong password!!"
517
+ }
518
+ },
519
+ "expect": {
520
+ "outcome": "error",
521
+ "code": "INVALID_CREDENTIALS"
522
+ }
523
+ },
524
+ {
525
+ "op": "rawRequest",
526
+ "input": {
527
+ "operation": "login",
528
+ "headers": {
529
+ "X-Forwarded-For": "203.0.113.6",
530
+ "Forwarded": "for=203.0.113.6"
531
+ },
532
+ "body": {
533
+ "email": "spray6@example.test",
534
+ "password": "wrong password!!"
535
+ }
536
+ },
537
+ "expect": {
538
+ "outcome": "error",
539
+ "code": "INVALID_CREDENTIALS"
540
+ }
541
+ },
542
+ {
543
+ "op": "rawRequest",
544
+ "input": {
545
+ "operation": "login",
546
+ "headers": {
547
+ "X-Forwarded-For": "203.0.113.7",
548
+ "Forwarded": "for=203.0.113.7"
549
+ },
550
+ "body": {
551
+ "email": "spray7@example.test",
552
+ "password": "wrong password!!"
553
+ }
554
+ },
555
+ "expect": {
556
+ "outcome": "error",
557
+ "code": "INVALID_CREDENTIALS"
558
+ }
559
+ },
560
+ {
561
+ "op": "rawRequest",
562
+ "input": {
563
+ "operation": "login",
564
+ "headers": {
565
+ "X-Forwarded-For": "203.0.113.8",
566
+ "Forwarded": "for=203.0.113.8"
567
+ },
568
+ "body": {
569
+ "email": "spray8@example.test",
570
+ "password": "wrong password!!"
571
+ }
572
+ },
573
+ "expect": {
574
+ "outcome": "error",
575
+ "code": "INVALID_CREDENTIALS"
576
+ }
577
+ },
578
+ {
579
+ "op": "rawRequest",
580
+ "input": {
581
+ "operation": "login",
582
+ "headers": {
583
+ "X-Forwarded-For": "203.0.113.9",
584
+ "Forwarded": "for=203.0.113.9"
585
+ },
586
+ "body": {
587
+ "email": "spray9@example.test",
588
+ "password": "wrong password!!"
589
+ }
590
+ },
591
+ "expect": {
592
+ "outcome": "error",
593
+ "code": "INVALID_CREDENTIALS"
594
+ }
595
+ },
596
+ {
597
+ "op": "rawRequest",
598
+ "input": {
599
+ "operation": "login",
600
+ "headers": {
601
+ "X-Forwarded-For": "198.51.100.7"
602
+ },
603
+ "body": {
604
+ "email": "spray-final@example.test",
605
+ "password": "wrong password!!"
606
+ }
607
+ },
608
+ "expect": {
609
+ "outcome": "error",
610
+ "code": "RATE_LIMITED"
611
+ }
612
+ }
613
+ ]
614
+ },
615
+ {
616
+ "id": "CT-RATE-005",
617
+ "title": "Registration is rate limited",
618
+ "category": "rate-limits",
619
+ "level": "core",
620
+ "requirements": ["SEC-RATE-002"],
621
+ "given": [],
622
+ "steps": [
623
+ {
624
+ "op": "register",
625
+ "input": {
626
+ "email": "same@example.test",
627
+ "password": "correct horse battery staple"
628
+ },
629
+ "expect": {
630
+ "outcome": "success"
631
+ }
632
+ },
633
+ {
634
+ "op": "register",
635
+ "input": {
636
+ "email": "same@example.test",
637
+ "password": "correct horse battery staple"
638
+ },
639
+ "expect": {
640
+ "outcome": "success"
641
+ }
642
+ },
643
+ {
644
+ "op": "register",
645
+ "input": {
646
+ "email": "same@example.test",
647
+ "password": "correct horse battery staple"
648
+ },
649
+ "expect": {
650
+ "outcome": "success"
651
+ }
652
+ },
653
+ {
654
+ "op": "register",
655
+ "input": {
656
+ "email": "same@example.test",
657
+ "password": "correct horse battery staple"
658
+ },
659
+ "expect": {
660
+ "outcome": "error",
661
+ "code": "RATE_LIMITED"
662
+ }
663
+ }
664
+ ]
665
+ }
666
+ ]
667
+ }