Skip to content

Commit d217ddf

Browse files
committed
e2e: Ensure compute policy rejects registation (POC)
See if we can trigger real quote verification. This will still get rejected at local verification instead of consensus.
1 parent d1fda40 commit d217ddf

3 files changed

Lines changed: 62 additions & 2 deletions

File tree

.buildkite/code.pipeline.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,12 @@ steps:
262262
--scenario e2e/runtime/rofl
263263
--scenario e2e/runtime/trust-root/.+
264264
--scenario e2e/runtime/keymanager-.+
265+
--scenario e2e/runtime/compute-policy
266+
--scenario e2e/runtime/compute-policy-rejects
265267
env:
266268
# Unsafe flags needed as the trust-root test rebuilds the enclave with embedded trust root data.
267-
OASIS_UNSAFE_SKIP_AVR_VERIFY: "1"
269+
# OASIS_UNSAFE_SKIP_AVR_VERIFY: "1"
270+
OASIS_UNSAFE_LAX_AVR_VERIFY: "1"
268271
OASIS_UNSAFE_ALLOW_DEBUG_ENCLAVES: "1"
269272
OASIS_E2E_COVERAGE: enable
270273
TEST_BASE_DIR: /tmp
@@ -358,7 +361,6 @@ steps:
358361
- .buildkite/scripts/download_e2e_test_artifacts_mocksgx.sh
359362
- .buildkite/scripts/test_e2e.sh --timeout 20m
360363
--scenario e2e/runtime/runtime-encryption
361-
--scenario e2e/runtime/compute-policy
362364

363365
env:
364366
OASIS_TEE_HARDWARE: intel-sgx
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package runtime
2+
3+
import (
4+
"context"
5+
6+
"github.com/oasisprotocol/oasis-core/go/common/sgx/pcs"
7+
"github.com/oasisprotocol/oasis-core/go/common/sgx/quote"
8+
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/env"
9+
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/oasis"
10+
"github.com/oasisprotocol/oasis-core/go/oasis-test-runner/scenario"
11+
)
12+
13+
// ComputePolicy is the compute runtime quote policy e2e test scenario.
14+
// It tests compute runtime quote policy is applied for compute/observer nodes,
15+
// by setting impossible compute policy to satisfy and ensuring registration fails.
16+
var ComputePolicyRejects scenario.Scenario = newComputePolicyRejectsImpl()
17+
18+
type computePolicyImplRejects struct {
19+
Scenario
20+
}
21+
22+
func newComputePolicyRejectsImpl() scenario.Scenario {
23+
return &computePolicyImplRejects{
24+
Scenario: *NewScenario("compute-policy-rejects", NewTestClient().WithScenario(SimpleScenario)),
25+
}
26+
}
27+
28+
func (sc *computePolicyImplRejects) Clone() scenario.Scenario {
29+
return &computePolicyImplRejects{
30+
Scenario: *sc.Scenario.Clone().(*Scenario),
31+
}
32+
}
33+
34+
func (sc *computePolicyImplRejects) Fixture() (*oasis.NetworkFixture, error) {
35+
f, err := sc.Scenario.Fixture()
36+
if err != nil {
37+
return nil, err
38+
}
39+
40+
f.Runtimes[1].ComputePolicy = &quote.Policy{
41+
PCS: &pcs.QuotePolicy{
42+
TCBValidityPeriod: 90,
43+
MinTCBEvaluationDataNumber: 12,
44+
FMSPCWhitelist: []string{"invalidFMSCP"},
45+
},
46+
}
47+
48+
return f, nil
49+
}
50+
51+
func (sc *computePolicyImplRejects) Run(ctx context.Context, childEnv *env.Env) error {
52+
if err := sc.StartNetworkAndTestClient(ctx, childEnv); err != nil {
53+
return err
54+
}
55+
56+
return sc.WaitTestClientAndCheckLogs()
57+
}

go/oasis-test-runner/scenario/e2e/runtime/scenario.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,7 @@ func RegisterScenarios() error {
421421
TxSourceMultiShortSGX,
422422
// SGXConstraints tests.
423423
ComputePolicy,
424+
ComputePolicyRejects,
424425
} {
425426
if err := cmd.RegisterNondefault(s); err != nil {
426427
return err

0 commit comments

Comments
 (0)