Commit b864480
committed
feat(registry): store FEE params in their own table
Review of the FIL-480 draft rejected extending blob_locations with the
per-blob FEE wrap material. blob_locations is a reconstructible cache of
the indexing-service contract — every row can be re-derived from the
indexer or the accept receipt, and the table disappears when the topology
moves to a real indexer. A wrapped CEK is not reconstructible: lose the
row and the ciphertext is unreadable forever. Key material therefore does
not belong in the one table whose design allows it to be rebuilt, or
truncated (the live test already does).
blob_encryption_params holds it instead, with no foreign key to
blob_locations: the two have independent lifecycles, and an FK would
force location-before-params write ordering. Because nothing cascades,
DeleteLocation no longer shreds — a caller removing a blob must delete
from both tables.
Two fixes to the material itself, both raised in review:
- Add header_len. The stored blob is envelope||ciphertext and nothing
recorded where the envelope ends, so a read could not locate byte 0 of
the ciphertext without decoding the header, leaving the "no
header round-trip" goal out of reach.
- Store the whole COSE Enc_structure as aad instead of the protected
header. The structure's context string differs between a COSE_Encrypt
and a COSE_Encrypt0, which a bare row cannot record, so the protected
header alone is not enough to rebuild the AAD. The header stays
recoverable from the Enc_structure as element 1.
Every column is NOT NULL, so the all-or-nothing invariant is structural
rather than a nullable-column check: the existence of a row is what marks
a blob as encrypted. BlobEncryptionParams.Validate rejects an incomplete
set before SQL, replacing ValidateFEE/ErrPartialFEE.
Migration 00013 is reshaped in place — it has not shipped anywhere.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>1 parent b3b1e3a commit b864480
8 files changed
Lines changed: 521 additions & 301 deletions
File tree
- inmem
- migrations
- sql
- registry
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
62 | 63 | | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
| |||
151 | 148 | | |
152 | 149 | | |
153 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
154 | 182 | | |
155 | 183 | | |
156 | 184 | | |
| |||
387 | 415 | | |
388 | 416 | | |
389 | 417 | | |
390 | | - | |
391 | | - | |
392 | | - | |
| 418 | + | |
| 419 | + | |
393 | 420 | | |
394 | 421 | | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | 422 | | |
399 | 423 | | |
400 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
401 | 436 | | |
402 | 437 | | |
403 | 438 | | |
| |||
0 commit comments