fix: publish enclave metadata atomically without clobbering #18
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/atomic-metadata-publication"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix the normal STEVE-enabled enclave startup race in metadata publication, independently of the platform E2E-speed changes.
write_metadata_topreviously created the final/metadata.jsonpathname before streaming JSON into it. Normal enclave startup launches STEVE and bootproofd asynchronously; bootproofd can open the existing but empty/partial file and exit on the JSON error.persist_noclobber: no partial final pathname and no replacement of an existing destination, including a concurrently created file or dangling symlink.0666 & !umaskpermissions; support both basename-only and nested relative paths.Regression evidence
The deterministic regression calls the actual serialization/publication helper, checks during serialization after the first JSON field, and requires the final pathname to remain absent without inspecting temporary-file internals. No timing sleeps or probability of a racing reader are needed.
metadata destination became visible before serialization completed(exit 101).Validation
cargo test --offline --locked --workspace --all-targets --all-features: 144 passed, 0 failed, 2 ignored. Ignored tests are not counted as executed.Native STEVE binary + the unchanged bootproofd binary from the failing image: 30/30 offline startup-order cases passed (reader before publication, after publication, and concurrent start). Each checks daemon health and the real
/attestationhandler's metadata-read path using an invalid nonce. This is not NSM/cryptographic attestation.Full strict workspace Clippy has the same pre-existing
await_holding_lockdiagnostic atcrates/steve-sdk/src/tests.rs:966as untouched main; no unrelated SDK cleanup is included.Independent review: approved, no blocking findings, bound to the exact published diff. Scoped formatting/strict Clippy passed. Workspace formatting findings were also reproduced on unchanged SDK code.
Separate platform adoption: public/platform#486.
Test-only cleanup
Removed 52 net lines: the redundant threaded-writers test, exact partial temporary-file byte assertions, and the supplementary nested-relative-path case. Production code is byte-identical to
d0703497e5c7b04871d43fed8407d1d1a09ea892. The trimmed atomicity regression still rejects the old create-before-serialize behavior and passes with the fix after a clean rebuild. Fresh workspace tests, scoped formatting, strict STEVE Clippy, and independent diff-bound review passed. Cleanup evidence:/home/tuna/git/metadata-publication-fix-evidence/test-trim-93qh7kbc/.The live results below remain bound to their original revision; live/cloud tests were not rerun for this test-only change.
Completed live dev validation
The unchanged
make -j1 test-e2e-platform-portspassed: 8 steps, 0 failures, exit 0, on the normal dev host/account. Platformefc9562f9987b8fe0f282dc67818f4c61c370ec5; STEVEd0703497e5c7b04871d43fed8407d1d1a09ea892.make prepare-componentsbuilt STEVE forx86_64-unknown-linux-musl, published the matching dev prebuilt set, and passed the API component preflight. The live Make invocation selected that exact set:139a69cc01ced50ba04b70da515ab4c2676d9c3c576589d75599758b6e91e081.us-west-2,ap-south-1). Prepared component artifacts are intentionally retained.The other component pins were the existing dev selections. This is one successful live correctness run, not a production failure-rate estimate, exhaustive default-pin matrix, full E2E suite, or speed benchmark. The successful Make command took 629.433 seconds, including its setup and test teardown, but excluding separate component qualification and external host restoration; no timing comparison is claimed.
Evidence is preserved locally under
/home/tuna/git/metadata-publication-fix-evidence/:component-preparation.log,qualified-components.lock.json,retry-02/live-ports/ports/{console.log,result.json},retry-02/restoration-independent.json, and the before/after AWS inventories withretry-02/aws-resource-additions.json. Public source archives were independently downloaded and matched to every tracked committed file.da6d1ca85dto694b5afbd6Merged via CLI
Pull request closed