Repository navigation
Seal the enclave spending policy to the imported key - #1110
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughHost and enclave KMS now encrypt wallet keys together with policy bytes and bind the ciphertext to a policy hash. The enclave server installs a policy from an accepted wallet, prevents policy replacement, and denies signing operations until a policy is loaded. ChangesSealed wallet policy
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant EnvelopeEncryption
participant VsockServer
participant EnclaveKms
EnvelopeEncryption->>VsockServer: Provide encrypted wallet
VsockServer->>EnclaveKms: decrypt_wallet_key(encrypted wallet)
EnclaveKms-->>VsockServer: Return wallet key and policy bytes
VsockServer->>VsockServer: Validate and seal policy hash
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
Summary
The enclave now treats the spending policy as part of the encrypted key. The host seals the policy bytes with the wallet key, and import installs that policy. A later policy change is refused, a second blob with a different policy is refused, and signing is refused until a policy is loaded. An empty policy denies. Older blobs that carry no policy binding fail closed.
Re-importing an older blob still opens that blob's policy. There is no rollback counter.
Test plan
cargo test --manifest-path keep-enclave/enclave/Cargo.tomlcargo test -p keep-enclave-host --libSummary by CodeRabbit
New Features
Bug Fixes