Commit 192fd99
committed
fix(service/auth): emit WWW-Authenticate DPoP on all proof rejections (DSPX-3397)
Server-side DPoP validation only attached a WWW-Authenticate header for
DPoPNonceError (use_dpop_nonce). Every other proof rejection (tampered htu,
replayed jti, malformed nonce, bad ath, wrong htm) returned a bare 401 with
no challenge header, so RFC 9449 §7.1-compliant clients/tests could not tell
a DPoP failure from an unrelated 401.
This made the opentdf/tests xtest negative cases unreliable: tampered_htu
failed always (htu is checked before nonce), replayed_jti was flaky (gated on
whether the cached nonce had rotated, deciding whether the nonce or jti check
fired first), and tampered_nonce failed whenever a non-nonce check tripped first.
Add a DPoPProofError marker type (delegating Error, Unwrap), wrap all non-nonce
validateDPoP errors with it in checkToken, and have both MuxHandler and
ConnectAuthNInterceptor emit `WWW-Authenticate: DPoP error="invalid_dpop_proof"`
(plus a fresh DPoP-Nonce when require_nonce is on). The use_dpop_nonce path is
unchanged.
Add unit tests covering the error type, the malformed-nonce wrap contract, and
the challenge headers for both handlers across nonce-on/off.
Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>1 parent 2a7095a commit 192fd99
3 files changed
Lines changed: 177 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
380 | 391 | | |
381 | 392 | | |
382 | 393 | | |
| |||
471 | 482 | | |
472 | 483 | | |
473 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
474 | 501 | | |
475 | 502 | | |
476 | 503 | | |
| |||
616 | 643 | | |
617 | 644 | | |
618 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
619 | 656 | | |
620 | 657 | | |
621 | 658 | | |
| |||
1061 | 1098 | | |
1062 | 1099 | | |
1063 | 1100 | | |
| 1101 | + | |
1064 | 1102 | | |
1065 | | - | |
1066 | | - | |
| 1103 | + | |
1067 | 1104 | | |
1068 | | - | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
1069 | 1109 | | |
1070 | 1110 | | |
1071 | 1111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
847 | 902 | | |
848 | 903 | | |
849 | 904 | | |
| |||
1441 | 1496 | | |
1442 | 1497 | | |
1443 | 1498 | | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1444 | 1541 | | |
1445 | 1542 | | |
1446 | 1543 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
106 | 132 | | |
107 | 133 | | |
108 | 134 | | |
| |||
131 | 157 | | |
132 | 158 | | |
133 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
135 | 167 | | |
136 | 168 | | |
| |||
141 | 173 | | |
142 | 174 | | |
143 | 175 | | |
144 | | - | |
| 176 | + | |
145 | 177 | | |
146 | 178 | | |
147 | 179 | | |
| |||
285 | 317 | | |
286 | 318 | | |
287 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
288 | 324 | | |
289 | 325 | | |
290 | 326 | | |
| |||
0 commit comments