Repository navigation
Commit 515cc02
committed
fix(config): refuse secret writes that begin inside a reset instead of letting them survive it
resetAllState waits for the secret writes that are in flight when it starts, clears both caches,
drops both write claims and then deletes the keys. A storeSecret that begins after that in-flight
snapshot is invisible to all of it: it puts the value into the secret cache on entry, the reset
clears that cache underneath it, and the write's durable commit lands after the delete pass. The
success path never touches the cache again, so the value stays out of the cache while it stays in
durable storage, and the next initialize - what a restarted provider does - reads it back out and
surfaces to the user a secret they had just reset away.
Secret writes are therefore refused while a reset is in progress, with a SettingsWriteError naming
the key, and the flag is cleared only after the reset has re-initialized so the whole window is
covered. Refusing was chosen over serializing the reset: a serialized reset lets the write apply
and then erases it, which discards silently a save the user just asked for, whereas a refusal
leaves durable storage empty, which is what a reset promises, and hands the caller an error on a
path that already reports which keys it could not store. Serialization was available and was
rejected for that reason rather than omitted.
Case: erases a secret whose write begins after the reset has snapshotted the pending writes. It
parks the reset inside its own delete pass, starts the write in that window and reads three things:
the durable double behind the secrets, this instance's cache, and the cache after a fresh
initialize - the third is what makes it a security finding rather than a cache artefact. Case alone
against f3ca33b: Test Files 1 failed | 9 passed (10), Tests 1 failed | 315 passed (316), with
'expected late-secret to be undefined' on the durable read. With the gate: 10 test files and 316
tests, 0 failed. Control, the gate condition disabled: 1 failed | 315 passed again, so the case
measures the gate.
Review row: database id 4478349061 (Major, Security & Privacy).1 parent f3ca33b commit 515cc02
2 files changed
Lines changed: 62 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
410 | 413 | | |
411 | 414 | | |
412 | 415 | | |
| |||
453 | 456 | | |
454 | 457 | | |
455 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
456 | 466 | | |
457 | 467 | | |
458 | 468 | | |
| |||
738 | 748 | | |
739 | 749 | | |
740 | 750 | | |
| 751 | + | |
741 | 752 | | |
742 | 753 | | |
743 | 754 | | |
| |||
761 | 772 | | |
762 | 773 | | |
763 | 774 | | |
| 775 | + | |
764 | 776 | | |
765 | 777 | | |
766 | 778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
230 | 280 | | |
231 | 281 | | |
232 | 282 | | |
| |||
0 commit comments