Add support for compute runtime quote policy#6474
Add support for compute runtime quote policy#6474martintomazic wants to merge 6 commits intomasterfrom
Conversation
✅ Deploy Preview for oasisprotocol-oasis-core canceled.
|
d0c991e to
859e7a8
Compare
| - .buildkite/scripts/test_e2e.sh --timeout 20m | ||
| --scenario e2e/runtime/runtime-encryption | ||
| --scenario e2e/runtime/compute-policy | ||
|
|
There was a problem hiding this comment.
e2e test with mocked TEE was instrumental to realizing that without compute_policy on the rust side of the protocol, RHP would fail due to the missing field.
To test that compute policy is applied e2e you can disable pcs in the quote policy (fixture) and run:
export OASIS_UNSAFE_ALLOW_DEBUG_ENCLAVES=1
export OASIS_UNSAFE_MOCK_TEE=1
export OASIS_TEE_HARDWARE=intel-sgx
make
.buildkite/scripts/test_e2e.sh --scenario e2e/runtime/compute-policy
The test would gets stuck (as expected).
Full SGX test would be desired here (easy). It would be also nice to add another one, where we e.g. set MinTCBEvaluationDataNumber and verify via the control status that the registration failed... Still not optimal as technically we would catch node local attestation to halt early and not consensus rejecting byzantine compute.
Testing that rofl nodes pass on the lower TCB but compute node is rejected would be even harder as we would need two different SGX environments to make it work.
What do you think?
There was a problem hiding this comment.
Yes, it would be great if we can test it in real SGX.
For the two different environments, let's open a separate issue to test that E2E.
859e7a8 to
b795a2e
Compare
| n.dataDir, | ||
| n.chainContext, | ||
| n.Identity, | ||
| willRegisterComputeRuntime, |
There was a problem hiding this comment.
Previously I was passing runtime roles (see). Now we only need bool flag.
No matter what name I choose here, passing the variable through workers, feels like abstraction leak.
I could avoid all this and use the config.GlobalConfig directly in the common.GetQuotePolicy. I hate global state though, but here might be acceptable with a TODO issue given this shows abstractions are not best in the first place?
There was a problem hiding this comment.
Yes, this seems awkward. For example the common worker constructor is already doing config lookups so it seems fine to have them there.
Removing the use of global config and explicitly passing it instead is a different issue.
| /// The compute runtime quote policy. | ||
| #[cbor(optional)] | ||
| compute_policy: sgx::QuotePolicy, |
There was a problem hiding this comment.
This field is ignored for now and only here to pass e2e test.
In practice we probably need new RHP method (similar to node identity), to signal whether compute policy should be respected or not. Technically not breaking?
The runtime should sign with its RAK whether the intention of this enclave is to be used as the one registering on the consensus (having access to keymanager) or is the intention to be used in the less constrained environments (default policy only). Similar solution to what is done for the node_id, i.e. make it part of the hash structure and sign with RAK and validate signature on the consensus side.
Do we really need this / what are possible attack vectors without it?
There was a problem hiding this comment.
I would avoid this extra verification for now as I don't see what attack this would prevent. It is other runtimes and the consensus layer that are enforcing this policy.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #6474 +/- ##
==========================================
- Coverage 64.79% 64.43% -0.36%
==========================================
Files 699 699
Lines 68206 68264 +58
==========================================
- Hits 44193 43988 -205
- Misses 18999 19205 +206
- Partials 5014 5071 +57 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| n.dataDir, | ||
| n.chainContext, | ||
| n.Identity, | ||
| willRegisterComputeRuntime, |
There was a problem hiding this comment.
Yes, this seems awkward. For example the common worker constructor is already doing config lookups so it seems fine to have them there.
Removing the use of global config and explicitly passing it instead is a different issue.
| /// The compute runtime quote policy. | ||
| #[cbor(optional)] | ||
| compute_policy: sgx::QuotePolicy, |
There was a problem hiding this comment.
I would avoid this extra verification for now as I don't see what attack this would prevent. It is other runtimes and the consensus layer that are enforcing this policy.
See if we can trigger real quote verification. This will still get rejected at local verification instead of consensus.
b795a2e to
c4fb335
Compare
Replaces #6471 closes #6387.