Repository navigation
sdk: make key epoch selection explicit - #1629
Merged
Merged
Conversation
GetKeyAtEpochs(ctx, domain, algorithm, &rootEpoch, nil) and get_key_at_epochs(domain, algorithm, Some(root_epoch), None) already select a root epoch alone, so the root-only variants in Go and Rust only add a second way to say the same thing. Signed-off-by: Kevin Wang <wy721@qq.com>
SealEnv and the SealedEnv public-key verifiers defaulted the app epoch to 0. They run offline and cannot know the current epochs, so a caller that fetched the key after an app key rotation and passed only the root epoch, as every SDK README showed, sealed an envelope naming app epoch 0. The guest then decrypts with the app-epoch-0 key and fails at boot. Take root_epoch and app_epoch as required arguments in that order in all four SDKs and vmm-cli, fold Go's SealEnvAtEpochs and VerifySealedEnvPublicKeyAtEpochs and Rust's seal_env_at_epochs and verify_sealed_env_public_key_at_epochs into the plain names, and pass both epochs of the GetSealedEnvPubKey response in the READMEs. Signed-off-by: Kevin Wang <wy721@qq.com>
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.
Problem
sealEnv/seal_env/SealEnvand the SealedEnv public-key verifiers defaulted the app epoch to 0. They run offline, so they cannot know the current epochs. A caller that passed only the root epoch, as every SDK README showed, sealed an envelope naming app epoch 0 after an app key rotation. The guest then decrypts with the app-epoch-0 key and the CVM fails at boot.GetKeyAtRootEpoch/get_key_at_root_epochduplicateGetKeyAtEpochs(..., &root, nil)/get_key_at_epochs(..., Some(root), None).Fix
root_epoch, app_epochas required arguments, in that order, for sealing and for SealedEnv public-key verification. Go'sSealEnvAtEpochs/VerifySealedEnvPublicKeyAtEpochsand Rust'sseal_env_at_epochs/verify_sealed_env_public_key_at_epochsare folded into the plain names. Old call sites now fail to compile or raise on the missing argument, so nothing keeps sealing to epoch 0 by accident.GetKeyAtRootEpochandget_key_at_root_epoch.docs/app-key-epochs.mdpass both epochs of theGetSealedEnvPubKeyresponse.Both changes are breaking and recorded in
CHANGELOG.md. Neither function was in a published SDK package: crates.iodstack-sdkis at 0.1.3, and the newest Go SDK tag,sdk/go/v0.1.0, predates them.The VMM web UI already seals with the epochs from the response and is unchanged.
Verification
cargo fmt,clippy -D warnings, andcargo test --workspaceagainst the simulator.gofmt,go vet, andgo test ./dstack ./tappdagainst the simulator.tsc --noEmit, andvitestonsealed-env.test.ts.pytest tests/test_seal_env.py, plus ruff, ruff format and mypy.#1508 touches nearby code (GetKey epoch decoding, SealedEnv fixture tests). Whichever PR lands second needs a small rebase.