Skip to content

Commit 905c1d4

Browse files
authored
fix: example policies (#2321)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent faedaea commit 905c1d4

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

docs/examples/policies/chainloop-commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
msg := "missing commit in attestation material"
5858
}
5959
60-
has_commit {
60+
has_commit if {
6161
some sub in input.subject
6262
sub.name == "git.head"
6363
sub.digest.sha1

docs/examples/policies/chainloop-qa.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ spec:
6161
msg:= "Container image is not approved"
6262
}
6363
64-
is_approved {
64+
is_approved if {
65+
input.predicate.annotations.approval == "true"
6566
some material in input.predicate.materials
6667
material.annotations["chainloop.material.type"] == "CONTAINER_IMAGE"
67-
68-
input.predicate.annotations.approval == "true"
6968
}

docs/examples/policies/policy-template.rego

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ skipped := false if valid_input
3030
########################################
3131

3232
# Validates if the input is valid and can be understood by this policy (3)
33-
valid_input if {
34-
# insert code here
35-
}
33+
valid_input := true
34+
35+
# insert code here
3636

3737
# If the input is valid, check for any policy violation here (4)
3838
violations contains msg if {
39-
valid_input
40-
# insert code here
39+
valid_input
4140
}
41+
42+
# insert code here

docs/examples/policies/sarif-errors.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
msg := "There are errors in the SARIF report"
5959
}
6060
61-
has_errors {
61+
has_errors if {
6262
some run in input.runs
6363
some result in run.results
6464
result.level == "error"

docs/examples/policies/trivy-vulns.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ spec:
5959
msg := "CVE report has vulnerabilities with severity MEDIUM or HIGH"
6060
}
6161
62-
has_vulnerabilities {
62+
has_vulnerabilities if {
6363
severities := ["HIGH", "MEDIUM"]
6464
some result in input.Results
6565
some vuln in result.Vulnerabilities

0 commit comments

Comments
 (0)