Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keymanager: Validate latest trust root height in key manager requests #4910

Merged
merged 1 commit into from
Sep 1, 2022

Conversation

peternose
Copy link
Contributor

Key manager requests should include latest consensus trust root

The key manager protocol should add the latest known trust root (or just the height) to (private key) EnclaveRPC requests. This would allow the key manager to detect whether the runtimes querying it have a fresh enough state (e.g. within 50 blocks) and reject operations if not.

Obviously the bad view can be either on the key manager side (Byzantine key manager operator) or the runtime side (Byzantine runtime operator). In case the key manager node is Byzantine the runtime can just switch to a different one (this already happens automatically when key manager requests fail).

This should be supported in a backwards compatible manner by making the new field optional.

Test

Happy path is already covered with e2e tests. Unhappy path was tested locally.

  • If key manager client is not up to date, height is not sent and after decoding takes a default value of None. Validation is skipped.
  • If key manager client is up to date but height is lower than trust root's height, the client will receive an error, e.g. private ephemeral key not available: call failed: height is not fresh.
  • If key manager is not up to date, the client will send height but it will not decode properly. The client will again receive an error, e.g. private ephemeral key not available: call failed: unknown field.

@peternose peternose changed the title Peternose/feature/key manager height keymanager: Validate latest trust root height in key manager requests Aug 29, 2022
@peternose peternose added the rust label Aug 29, 2022
@peternose peternose force-pushed the peternose/feature/key-manager-height branch from ffbf57c to 10483c4 Compare August 29, 2022 08:34
@codecov
Copy link

codecov bot commented Aug 29, 2022

Codecov Report

Merging #4910 (e1df6f9) into master (5a149fc) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #4910      +/-   ##
==========================================
- Coverage   66.60%   66.57%   -0.03%     
==========================================
  Files         464      464              
  Lines       50981    50981              
==========================================
- Hits        33955    33940      -15     
- Misses      12834    12844      +10     
- Partials     4192     4197       +5     
Impacted Files Coverage Δ
go/genesis/api/api.go 73.91% <100.00%> (ø)
go/worker/keymanager/worker.go 65.31% <100.00%> (+0.21%) ⬆️
...onsensus/tendermint/apps/beacon/state/state_vrf.go 73.33% <0.00%> (-13.34%) ⬇️
.../worker/compute/executor/committee/transactions.go 84.09% <0.00%> (-6.82%) ⬇️
go/worker/common/committee/p2p.go 70.00% <0.00%> (-6.67%) ⬇️
go/runtime/host/sandbox/sandbox.go 60.40% <0.00%> (-6.49%) ⬇️
go/common/grpc/auth/auth.go 94.73% <0.00%> (-5.27%) ⬇️
go/worker/beacon/tx_retry.go 90.47% <0.00%> (-4.77%) ⬇️
go/common/sgx/common.go 66.01% <0.00%> (-3.89%) ⬇️
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@peternose peternose marked this pull request as ready for review August 29, 2022 09:23
Copy link
Member

@kostko kostko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just remove the height checks from public key queries as those have no authentication anyway.

keymanager-lib/src/methods.rs Outdated Show resolved Hide resolved
keymanager-lib/src/methods.rs Outdated Show resolved Hide resolved
@peternose peternose force-pushed the peternose/feature/key-manager-height branch from 10483c4 to 55b0787 Compare August 29, 2022 11:09
@peternose peternose requested a review from kostko August 31, 2022 09:39
@peternose peternose force-pushed the peternose/feature/key-manager-height branch from 55b0787 to 64ad8e0 Compare September 1, 2022 11:56
@peternose peternose force-pushed the peternose/feature/key-manager-height branch from 64ad8e0 to e1df6f9 Compare September 1, 2022 14:12
@peternose peternose merged commit 2e768ce into master Sep 1, 2022
@peternose peternose deleted the peternose/feature/key-manager-height branch September 1, 2022 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants