Skip to content

Commit ad9d2a2

Browse files
committed
feat: add skip field to policy group attachments
Add support for explicitly disabling specific policies within a policy group by specifying their metadata names in a skip list. This allows users to selectively exclude policies from evaluation without modifying the policy group itself. Changes: - Add skip field to PolicyGroupAttachment protobuf message - Implement getPolicyName() helper to extract policy names from attachments - Filter skipped policies in both material and attestation evaluation paths - Add validateSkipList() to warn about non-existent policy names - Add comprehensive test coverage for skip functionality Example usage: ```yaml policyGroups: - ref: file://groups/sbom-quality.yaml with: bannedLicenses: AGPL-3.0 skip: - sbom-present - license-check ``` Policies are matched by metadata.name. Unknown policy names in the skip list generate warnings but allow execution to continue. Closes #2557 Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
1 parent 7e7e77d commit ad9d2a2

8 files changed

Lines changed: 403 additions & 76 deletions

File tree

app/cli/pkg/action/testdata/contract_v2.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ spec:
3333
attestation:
3434
- ref: file://attestation-policy.yaml
3535
policyGroups:
36-
- ref: file://testdata/policy_group.yaml
36+
- ref: file://testdata/policy_group.yaml
37+
with:
38+
user_name: "test-user"
39+
skip:
40+
- policy-to-skip

app/controlplane/api/gen/frontend/workflowcontract/v1/crafting_schema.ts

Lines changed: 20 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/workflowcontract.v1.PolicyGroupAttachment.jsonschema.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/gen/jsonschema/workflowcontract.v1.PolicyGroupAttachment.schema.json

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/workflowcontract/v1/crafting_schema.pb.go

Lines changed: 79 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/workflowcontract/v1/crafting_schema.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ message PolicyGroupAttachment {
344344
string ref = 1 [(buf.validate.field).string.min_len = 1];
345345
// group arguments
346346
map<string, string> with = 2;
347+
// policy names to skip (matched against metadata.name)
348+
repeated string skip = 3;
347349
}
348350

349351
// Represents a group or policies

0 commit comments

Comments
 (0)