Repository navigation
Release 1.26.15: TC-3554 seal the epoch-0 root in root_wrap (DO NOT MERGE without Naomi's GO) - #670
Merged
Merged
Conversation
…ional once sealed
- root_wrap table (migration m20261120_000000_root_wrap, PG + SQLite): one row
(id = 1), wrapped = nonce || AES-256-GCM(K_wrap, root), node_did,
kms_root_epoch, created_at.
- K_wrap = dstack GetKey("tinycloud/keys/primary-wrap") on the current root;
AAD = "tinycloud/root-wrap/v1" || app_id || pinned DID. Keys and plaintext
zeroized.
- DstackKmsEpoch boot: parse pins, connect, CREATE TABLE IF NOT EXISTS
root_wrap, read. Absent: fetch + full verify through the transport, insert
ON CONFLICT DO NOTHING, re-read. Then unseal and check the DID against the
pins, then EXPECTED_NODE_DID, before migrations or any other write. No
blob and no transport refuses; no fallback to the current root.
- Tests: seal/unseal vector, tampered, wrong AAD, one-row + concurrent
insert (SQLite, PG when available), DID mismatch after unseal, no blob +
no transport, sealed root boots without the sidecar, tampered blob, and
ordering (no migration / renewal_identity before the DID check).
Details: TC-3554
…om root_wrap (DEPLOY ONLY AFTER A BLOB EXISTS IN PROD) DEPLOY ONLY AFTER A BLOB EXISTS IN PROD. The blob is sealed by a boot of a root_wrap release on 1.26.14's sidecar compose; this compose has no sidecar and no transport, so with no blob the node refuses to start. - docker-compose.dstack-postgres.yaml: remove the key-recovery service, its volume, depends_on and KEY_RECOVERY_SOCKET. Pins unchanged (KMS_ROOT_PUBKEY 0334c76e…e910e1, app id, epoch-0 DID). - Lockstep: docker.yml n0_template_hash 6a577c6d… (raw 272f43b8…), docs/releasing.md N0 hash text and rollback note, byte-identical scripts/ci/fixtures/tc959-n0-compose.yaml, tc959-docker.mjs compose_mounts without key-recovery:/run/key-recovery. Details: TC-3554
…the unsealed-root copy Bobbie N1: info `opened the node root from root_wrap` (event root_wrap_opened, root_epoch only; no key material or row contents) after the blob opens and passes every check. kms_epoch_identity's a_sealed_root_boots_without_the_sidecar asserts the fetched, sealed and opened lines on the first boot, and on a restart still on the sidecar the opened line with no fetch or seal. Bobbie N4: open_wrapped moves the unsealed root into StaticSecret instead of copying it, and zeroizes it on the short-root error. test-ruling: TC-3554 Details: TC-3554
…behaviour Bobbie N1-N3: gate the sidecar-free compose on a seal line and a second sidecar-compose restart that logs the opened line and no fetch. Recovery copies the root_wrap row out and confirms epoch 0 is still fetchable before deleting it; deleting it with epoch 0 gone loses the node identity for good (open question: how long Phala keeps epoch 0). releasing.md: a backup restore carries the row; a fresh database refuses until one sidecar boot seals it. Details: TC-3554
…ease order and recovery Naomi's amendment to Bobbie N1/N2: - The blob-open log text is exactly "opened identity root from root_wrap" (event root_wrap_opened); kms_epoch_identity asserts the new text. - The doc gives the release order: seal boot, then a restart that opens from the blob (confirmed by that line), then the sidecar-free compose. - Recovery: copy the root_wrap row out as a backup before any delete; never delete it while epoch 0 cannot be fetched. test-ruling: TC-3554 Details: TC-3554
….26.15 Reverts fdd7717. 1.26.15 ships on main's sidecar compose (N0 template 70c71aa0…) so its first boot seals the root_wrap blob; the sidecar-free compose moves to the 1.26.16 PR, gated on that seal and a restart that opens from root_wrap. Details: TC-3554
…mpose A backup restore carries the root_wrap row. A fresh database reseals on the sidecar compose's first boot; on a sidecar-free compose it refuses until one sidecar boot seals it (expected). Details: TC-3554
- TC-3554: seal the epoch-0 root in root_wrap on the sidecar compose; later boots open it without the sidecar or KMS. One migration. Upgrade notes and release order in CHANGELOG. Details: TC-3554
samgbafa
marked this pull request as ready for review
November 20, 2026 16:41
…ker compose v2.26.0
deploy-phala gains a step after "Validate and pin deployment image" and
before the deploy: it downloads the sha256-pinned docker compose v2.26.0
release binary (the dstack 0.5.15 guest's version) and runs `config -q` on
the exact spliced compose sent to Phala, with placeholders for required
`${NAME:?}` inputs. The guest's schema refused long-form `devices`, which
stopped the witness boot; this fails the workflow before any CVM change.
The runner-compose `config --quiet` in the deploy step stays.
Modelled on openkey#643. No test pins the step list.
Details: TC-3554
- The node's sealed identity root is not user data; no space or owner purge deletes it. - Fixes space_purge_table_inventory on PostgreSQL (node_did matches the %_did rule). Details: TC-3554
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release 1.26.15. Ready for review. DO NOT MERGE without Naomi's GO. Nothing deploys from this PR by itself.
This is release 1.26.15 for TC-3554, off main after #668 (v1.26.14,
3f66adcb). It replaces #669. The node's identity root (KMS root epoch 0) is sealed once into the database and opened from there on every later boot, so at runtime the node stops depending on the KMS serving epoch 0 or on the key-recovery sidecar.This release ships on main's sidecar compose, unchanged (N0 template
70c71aa0acb7ebe157a1c1fac3e30fb3536b7cc21ba51d4013f905599c22ea4f). Its first boot seals the blob. The sidecar-free compose is release 1.26.16, in stacked draft #671 (feat/tc-3554-sidecar-free), gated on this release's seal and a restart.Commits
709626c6feat(node): seal the epoch-0 root inroot_wrap; transport optional once sealed.root_wrap(id SMALLINT PK CHECK id = 1, wrapped, node_did, kms_root_epoch, created_at). Migrationm20261120_000000_root_wrapcovers PG and SQLite through a sharedcreate_table().K_wrap= dstackGetKey("tinycloud/keys/primary-wrap")on the current root.AAD = "tinycloud/root-wrap/v1" || app_id || pinned DID.DstackKmsEpoch):CREATE TABLE IF NOT EXISTS root_wrap, read the row.INSERT … ON CONFLICT DO NOTHINGand re-read. If the row is present: no sidecar or KMS call, even when a transport is configured.expected_did, thenEXPECTED_NODE_DID. Only after that do migrations andrenewal_identityrun.fdd77177and its reverta6f87fb0. The sidecar-free compose was first committed here. It is reverted so this release keeps main's compose byte-for-byte: the compose, thedocker.ymlN0 hash, the fixture,compose_mountsand thereleasing.mdhashes all equal main. It moves to 1.26.16.af95c4f2Bobbie N1 and N4:opened identity root from root_wrapat info level (event = "root_wrap_opened"; the only field isroot_epoch; no key material or row contents) after the blob opens and passes every check.open_wrappedmoves the unsealed root intoStaticSecretinstead of copying it.fae43a00and182a5a40: Bobbie N1-N3, then Naomi's amendment:056c2121:releasing.mdrestore note. A backup restore carries the row. A fresh database is resealed on the sidecar compose's first boot; on a sidecar-free compose it refuses until one sidecar boot seals it.030a1f8dRelease 1.26.15, the same shape as Release 1.26.14: TC-3554 restore the node on its epoch-0 KMS root #668'sf1ab627e:tinycloud-node-server/Cargo.toml,Cargo.lockandtest/m1-realdata-e2e/Cargo.lockmove to 1.26.15.c70ae664ci(deploy): Naomi's guest compose check, modelled on openkey#643.deploy-phaladownloads the sha256-pinned docker compose v2.26.0 release binary, the version the dstack 0.5.15 guest runs. It runsconfig -qon the exact spliced compose sent to Phala, with placeholders for required${NAME:?}inputs. This happens after "Validate and pin deployment image" and before the deploy.devices, which stopped the witness boot. With this check, a compose like that fails the workflow before any CVM change.config --quietcheck in the deploy step stays.releasing.mdbullet.The renewal_identity reset fallback from #669 is dropped.
renewal_identitystill holds the original renewer, and the reset was ruled off the deploy path.Release order (Naomi decides the rollout)
sealed the node root into root_wrap.opened identity root from root_wrapand must not logfetched and verified the node root …, which would mean a key-recovery fetch.Ordering nuance
To decide whether the blob is present, the node must reach the database first. So before the DID check, the database actions are connect,
CREATE TABLE IF NOT EXISTS root_wrapand the read. The insert happens only after the fetched root passes the full verifier. Nothing else (other migrations,renewal_identity, any write) runs before the DID check, and the integration tests assert thatroot_wrapis the only table present after any refusal.Re-key risk
K_wrapderives from the current KMS root. If Phala rotates the root again, the blob stops opening and the node refuses to start. The recovery runbook is indocs/tc-3554-kms-epoch-fetch.md:root_wraprow out as a backup. It is ciphertext, so it is safe to keep.Never delete the row while epoch 0 can't be fetched. Open question: how long does Phala keep epoch 0 retrievable?
Rollback: rolling back to 1.26.14 after 1.26.15 has migrated crosses a schema migration and has not been reviewed.
DID-resolution guard
No new
verify_signatureor resolve calls. #668'sissued_by_pinentry is unchanged.Verification (local)
At
c70ae664, the guest compose check:test-deploy-recovery.py: 30 OK.test-phala-os-guard.sh: all passed.test-docker-tags.py: ok.test-quota-authority.py: 26 OK.docker.ymlYAML parses.Run once at
030a1f8d. Rust is unchanged since then:cargo test -p tinycloud-node --features dstack --test kms_epoch_identity--test did_resolution_single_entrycargo fmt --all --checkcargo clippy -p tinycloud-node -p tinycloud-core --all-targets -- -D warningspython3 scripts/ci/test-deploy-recovery.pynode scripts/tc959-check.mjsscripts/againstorigin/maindocker.ymldiffers only by the new step)Earlier full run, on the same code before the log-text and doc commits:
sql_identity_cli: 1 passed.items_after_test_moduleatroutes/encryption.rs:874.Test files touched (for the test-edit ruling)
tinycloud-node-server/tests/kms_epoch_identity.rs:assert_never_asked_for_a_keybecomesassert_never_asked_for_the_node_key; it allows onlyGetKey(tinycloud/keys/primary-wrap).root_wrapexists, empty" instead of "database never opened".did_mismatch_*becomes…_before_any_other_database_write.no_transport_configured_refuses_before_any_callis replaced byno_blob_and_no_transport_refuses_startup.a_sealed_root_boots_without_the_sidecar,a_tampered_blob_refuses_startup_without_fallbackandan_unsealed_root_with_another_did_refuses_before_any_other_write.a_sealed_root_boots_without_the_sidecarchecks the startup log lines:opened identity root from root_wraplines.tinycloud-node-server/src/dstack_kms.rs(unit tests):exactly_one_transport_must_be_configuredbecomesat_most_one_transport_may_be_configured.a_wrapped_root_opens_to_the_pinned_identityanda_wrapped_root_is_refused_unless_every_check_passes.tinycloud-core/src/root_wrap.rs: a new module with new tests (known-answer vector, fresh nonce, tampered blob, wrong AAD, one row with the first insert winning, concurrent SQLite inserts, concurrent PG inserts on Actions).scripts/tc959-docker.mjs: unchanged against main (the edit was reverted).test-ruling: TC-3554
Details: TC-3554