Skip to content

Commit cb91305

Browse files
authored
Merge pull request #303 from lmilleri/resource-policy
Update resource-policy
2 parents ee4471b + e6b07b3 commit cb91305

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

config/templates/resource-policy-restrictive.rego

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,39 @@ package policy
22
import rego.v1
33

44
default allow = false
5+
default hardware_failing = false
56

67
allow if {
7-
not any_not_affirming
88
count(input.submods) > 0
9+
not executable_failing
10+
not configuration_failing
11+
not hardware_failing
12+
}
913

14+
executable_failing if {
15+
some _, submod in input.submods
16+
executables := submod["ear.trustworthiness-vector"]["executables"]
17+
not in_affirming_range(executables)
1018
}
1119

12-
any_not_affirming if {
20+
configuration_failing if {
1321
some _, submod in input.submods
14-
submod["ear.status"] != "affirming"
22+
configuration := submod["ear.trustworthiness-vector"]["configuration"]
23+
not in_affirming_range(configuration)
24+
}
25+
26+
# Hardware trust claims are enforced by default. For TDX, no additional
27+
# RVPS values are needed. For SNP, you must provide hardware-specific
28+
# RVPS values (tcb_bootloader, tcb_microcode, tcb_snp, tcb_tee) from
29+
# your environment. If these values are not available, comment out
30+
# the following block.
31+
hardware_failing if {
32+
some _, submod in input.submods
33+
hardware := submod["ear.trustworthiness-vector"]["hardware"]
34+
not in_affirming_range(hardware)
35+
}
36+
37+
in_affirming_range(val) if {
38+
val >= 2
39+
val <= 31
1540
}

0 commit comments

Comments
 (0)