Commit 39fead5
fix(dkms): bind re-seal AAD into the recover possession-proof (close pre-mainnet invariant)
The dKMS node re-seals a recovered CEK under the caller-supplied `aad_b64`,
which was NOT bound into the recover possession-proof. A MITM that tampered
`aad_b64` in transit could make the node seal under an AAD of its choosing;
it was safe only because the decrypt boundary independently rebuilt the AAD
and failed closed (a compensating control, not a fix).
Now the canonical possession-proof preimage binds `sha256(reseal_aad)`
(`ddrm_envelope::recover_proof_message`, domain bumped v1 -> v2). The client
signs over the exact AAD it sends (key-provider), and the node verifies the
proof over the byte-identical `args.aad_b64` in `verify_session` BEFORE any
CEK is recovered or re-sealed. The AAD (DecryptTranscriptV1) already carries
`node_set_id` + `segment_digests`, so all three are bound transitively; the
32-byte digest keeps the preimage bounded for long presentations.
A MITM cannot re-sign the proof (it lacks the token-bound caller key), so a
tampered `aad_b64` now fails closed at the node (`session_invalid`). The
decrypt boundary's rebuild remains as defense-in-depth.
- ddrm-envelope: recover_proof_message/sign/verify take `reseal_aad`; bind
sha256; bump DKMS_RECOVER_DOMAIN to /v2; unit test asserts tampered-AAD ->
verify=false.
- dkms-authority: verify_session verifies over decode(args.aad_b64) before
recover; SECURITY INVARIANT comment rewritten to CLOSED; landing test
recover_fails_closed_on_a_tampered_aad (35 legacy / 25 default tests green).
- key-provider: recover_proof_b64 + both delegate paths sign over the
request's aad_b64.
- dev harnesses (ddrm-runtime-open, dkms-live-recover): each direct node
recover signs over its request AAD.
- docs: THREAT_MODEL §7 + DEPLOY_CHECKLIST + AUDITOR_PACKET §1 flipped
open -> closed, with the landing test referenced.
Gates: ddrm-envelope + dkms-authority tests, key-provider/dev-script builds,
verify-capsules, alignment-check all green.
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 7feccd3 commit 39fead5
8 files changed
Lines changed: 245 additions & 119 deletions
File tree
- capsules
- ddrm-envelope/src
- dkms-authority/src
- key-provider/src
- docs
- scripts/dev
- ddrm-runtime-open/src
- dkms-live-recover/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
1060 | | - | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1061 | 1064 | | |
1062 | 1065 | | |
1063 | 1066 | | |
| |||
1107 | 1110 | | |
1108 | 1111 | | |
1109 | 1112 | | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
1116 | 1123 | | |
1117 | 1124 | | |
1118 | 1125 | | |
1119 | 1126 | | |
1120 | 1127 | | |
1121 | 1128 | | |
| 1129 | + | |
1122 | 1130 | | |
| 1131 | + | |
1123 | 1132 | | |
1124 | 1133 | | |
1125 | | - | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
1126 | 1142 | | |
1127 | 1143 | | |
1128 | 1144 | | |
1129 | 1145 | | |
1130 | | - | |
1131 | | - | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1132 | 1149 | | |
1133 | 1150 | | |
1134 | 1151 | | |
1135 | 1152 | | |
1136 | 1153 | | |
1137 | 1154 | | |
1138 | 1155 | | |
| 1156 | + | |
1139 | 1157 | | |
1140 | | - | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1141 | 1166 | | |
1142 | 1167 | | |
1143 | 1168 | | |
1144 | 1169 | | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1148 | 1174 | | |
1149 | 1175 | | |
1150 | 1176 | | |
1151 | 1177 | | |
1152 | 1178 | | |
1153 | 1179 | | |
1154 | 1180 | | |
| 1181 | + | |
1155 | 1182 | | |
1156 | 1183 | | |
1157 | 1184 | | |
1158 | | - | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
1159 | 1193 | | |
1160 | 1194 | | |
1161 | 1195 | | |
| |||
2417 | 2451 | | |
2418 | 2452 | | |
2419 | 2453 | | |
2420 | | - | |
2421 | | - | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
2422 | 2457 | | |
2423 | 2458 | | |
2424 | 2459 | | |
2425 | | - | |
2426 | | - | |
| 2460 | + | |
| 2461 | + | |
2427 | 2462 | | |
2428 | 2463 | | |
2429 | | - | |
2430 | | - | |
2431 | | - | |
2432 | | - | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
2433 | 2468 | | |
2434 | | - | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
2435 | 2473 | | |
2436 | 2474 | | |
2437 | 2475 | | |
2438 | 2476 | | |
2439 | 2477 | | |
2440 | | - | |
| 2478 | + | |
2441 | 2479 | | |
2442 | 2480 | | |
2443 | 2481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1025 | 1025 | | |
1026 | 1026 | | |
1027 | 1027 | | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
1038 | 1036 | | |
1039 | 1037 | | |
1040 | 1038 | | |
| |||
1796 | 1794 | | |
1797 | 1795 | | |
1798 | 1796 | | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
1799 | 1804 | | |
1800 | 1805 | | |
1801 | 1806 | | |
1802 | 1807 | | |
1803 | 1808 | | |
1804 | 1809 | | |
1805 | 1810 | | |
| 1811 | + | |
1806 | 1812 | | |
1807 | 1813 | | |
1808 | 1814 | | |
1809 | | - | |
| 1815 | + | |
1810 | 1816 | | |
1811 | 1817 | | |
1812 | 1818 | | |
| |||
2444 | 2450 | | |
2445 | 2451 | | |
2446 | 2452 | | |
| 2453 | + | |
2447 | 2454 | | |
2448 | 2455 | | |
2449 | 2456 | | |
| |||
2454 | 2461 | | |
2455 | 2462 | | |
2456 | 2463 | | |
| 2464 | + | |
2457 | 2465 | | |
2458 | 2466 | | |
2459 | 2467 | | |
| |||
2526 | 2534 | | |
2527 | 2535 | | |
2528 | 2536 | | |
2529 | | - | |
| 2537 | + | |
| 2538 | + | |
2530 | 2539 | | |
2531 | 2540 | | |
2532 | 2541 | | |
| |||
2603 | 2612 | | |
2604 | 2613 | | |
2605 | 2614 | | |
2606 | | - | |
| 2615 | + | |
| 2616 | + | |
2607 | 2617 | | |
2608 | 2618 | | |
2609 | 2619 | | |
| |||
2693 | 2703 | | |
2694 | 2704 | | |
2695 | 2705 | | |
2696 | | - | |
| 2706 | + | |
2697 | 2707 | | |
2698 | 2708 | | |
2699 | 2709 | | |
| |||
2779 | 2789 | | |
2780 | 2790 | | |
2781 | 2791 | | |
2782 | | - | |
2783 | | - | |
| 2792 | + | |
| 2793 | + | |
2784 | 2794 | | |
2785 | 2795 | | |
2786 | 2796 | | |
| |||
2808 | 2818 | | |
2809 | 2819 | | |
2810 | 2820 | | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
2811 | 2843 | | |
2812 | 2844 | | |
2813 | 2845 | | |
| |||
3005 | 3037 | | |
3006 | 3038 | | |
3007 | 3039 | | |
| 3040 | + | |
3008 | 3041 | | |
3009 | 3042 | | |
3010 | 3043 | | |
| |||
3068 | 3101 | | |
3069 | 3102 | | |
3070 | 3103 | | |
3071 | | - | |
| 3104 | + | |
3072 | 3105 | | |
3073 | 3106 | | |
3074 | 3107 | | |
| |||
3816 | 3849 | | |
3817 | 3850 | | |
3818 | 3851 | | |
| 3852 | + | |
3819 | 3853 | | |
3820 | 3854 | | |
3821 | 3855 | | |
| |||
3882 | 3916 | | |
3883 | 3917 | | |
3884 | 3918 | | |
| 3919 | + | |
3885 | 3920 | | |
3886 | 3921 | | |
3887 | 3922 | | |
| |||
3909 | 3944 | | |
3910 | 3945 | | |
3911 | 3946 | | |
3912 | | - | |
| 3947 | + | |
3913 | 3948 | | |
3914 | 3949 | | |
3915 | 3950 | | |
| |||
0 commit comments