From 9ca4401846716f0cdd50f1a4b12e73347265688e Mon Sep 17 00:00:00 2001 From: Tingmao Wang Date: Wed, 18 Nov 2026 23:21:26 +0000 Subject: [PATCH] open_door.rego: Fix load_transparency_trust_list It is missing the allowed_ledgers output, which makes this allow all policy not actually work. verifyPolicyRules in the test code checks that each enforcement point is present in the allow all policy. Since the load_transparency_trust_list rule depends on input.ledgers, we pass in a fake input. The same logic can be applied later if we have more enforcement points with the output being unavoidably dependent on input. Signed-off-by: Tingmao Wang --- pkg/securitypolicy/open_door.rego | 2 +- pkg/securitypolicy/rego_utils_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/securitypolicy/open_door.rego b/pkg/securitypolicy/open_door.rego index 7a786b912b..6353689836 100644 --- a/pkg/securitypolicy/open_door.rego +++ b/pkg/securitypolicy/open_door.rego @@ -29,5 +29,5 @@ mapped_directory_mount := {"allowed": true} mapped_directory_unmount := {"allowed": true} unmount_cims := {"allowed": true} log_provider := {"allowed": true} -load_transparency_trust_list := {"allowed": true} +load_transparency_trust_list := {"allowed": true, "allowed_ledgers": input.ledgers} host_network := {"allowed": true} diff --git a/pkg/securitypolicy/rego_utils_test.go b/pkg/securitypolicy/rego_utils_test.go index 7727ee481a..457b086ff3 100644 --- a/pkg/securitypolicy/rego_utils_test.go +++ b/pkg/securitypolicy/rego_utils_test.go @@ -125,8 +125,16 @@ func Test_RegoTemplates(t *testing.T) { } func verifyPolicyRules(apiVersion string, enforcementPoints map[string]interface{}, policyCode string) error { + // Some policy rules in the allow all policy, like + // load_transparency_trust_list, depends on input data. We create some + // fake input here so that these rules don't disappear. + input := map[string]interface{}{ + "ledgers": []string{}, + } + query := rego.New( rego.Query("data.policy"), + rego.Input(input), rego.Module("policy.rego", policyCode), rego.Module("framework.rego", FrameworkCode), )