-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alex Detesan
authored and
Alex Detesan
committed
Mar 22, 2024
1 parent
d16ba23
commit 6d44f9e
Showing
6 changed files
with
71 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,58 @@ | ||
package governance | ||
|
||
import data.security | ||
|
||
default allow = false | ||
|
||
pullrequest_attestations := | ||
[att | json.unmarshal(input[i].Attestation).predicateType == "https://liatr.io/attestations/github-pull-request/v1"; att := json.unmarshal(input[i].Attestation)] | ||
pullrequest_attestations := [att | json.unmarshal(input[i].Attestation).predicateType == "https://liatr.io/attestations/github-pull-request/v1"; att := json.unmarshal(input[i].Attestation)] | ||
|
||
trivy_attestations := | ||
[att | json.unmarshal(input[i].Attestation).predicateType == "https://cosign.sigstore.dev/attestation/vuln/v1"; att := json.unmarshal(input[i].Attestation)] | ||
trivy_attestations := [att | json.unmarshal(input[i].Attestation).predicateType == "https://cosign.sigstore.dev/attestation/vuln/v1"; att := json.unmarshal(input[i].Attestation)] | ||
|
||
sbom_attestations := | ||
[att | json.unmarshal(input[i].Attestation).predicateType == "https://spdx.dev/Document"; att := json.unmarshal(input[i].Attestation)] | ||
sbom_attestations := [att | json.unmarshal(input[i].Attestation).predicateType == "https://spdx.dev/Document"; att := json.unmarshal(input[i].Attestation)] | ||
|
||
provenance_attestations := | ||
[att | json.unmarshal(input[i].Attestation).predicateType == "https://slsa.dev/provenance/v0.2"; att := json.unmarshal(input[i].Attestation)] | ||
provenance_attestations := [att | json.unmarshal(input[i].Attestation).predicateType == "https://slsa.dev/provenance/v0.2"; att := json.unmarshal(input[i].Attestation)] | ||
|
||
allow { | ||
violations := pullrequest_violations | trivy_violations | sbom_violations | provenance_violations | ||
print(violations) | ||
count(violations) == 0 | ||
violations := ((pullrequest_violations | trivy_violations) | sbom_violations) | provenance_violations | ||
print(violations) | ||
count(violations) == 0 | ||
} | ||
|
||
provenance_violations[msg] { | ||
count(provenance_attestations) == 0 | ||
msg:= "no provenance attestation" | ||
count(provenance_attestations) == 0 | ||
msg := "no provenance attestation" | ||
} | ||
|
||
provenance_violations[msg] { | ||
some i | ||
attestation := provenance_attestations[i] | ||
not security.provenance.allow with input as attestation | ||
msg := "provenance violation found" | ||
some i | ||
attestation := provenance_attestations[i] | ||
not security.provenance.allow with input as attestation | ||
msg := "provenance violation found" | ||
} | ||
|
||
pullrequest_violations[msg] { | ||
count(pullrequest_attestations) == 0 | ||
msg := "no pull request attestation" | ||
count(pullrequest_attestations) == 0 | ||
msg := "no pull request attestation" | ||
} | ||
|
||
pullrequest_violations[msg] { | ||
not security.pullrequest.allow with input as pullrequest_attestations[0] | ||
msg := "pull request violations found" | ||
not security.pullrequest.allow with input as pullrequest_attestations[0] | ||
msg := "pull request violations found" | ||
} | ||
|
||
sbom_violations[msg] { | ||
count(sbom_attestations) == 0 | ||
msg:= "no sbom attestation" | ||
count(sbom_attestations) == 0 | ||
msg := "no sbom attestation" | ||
} | ||
|
||
trivy_violations[msg] { | ||
count(trivy_attestations) == 0 | ||
msg := "no trivy attestation" | ||
count(trivy_attestations) == 0 | ||
msg := "no trivy attestation" | ||
} | ||
|
||
trivy_violations[msg] { | ||
some i | ||
attestation := trivy_attestations[i] | ||
not security.trivy.allow with input as attestation | ||
msg := "trivy scan violation found" | ||
} | ||
some i | ||
attestation := trivy_attestations[i] | ||
not security.trivy.allow with input as attestation | ||
msg := "trivy scan violation found" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package governance | ||
|
||
signer_identities := [ | ||
{ | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subjectRegExp": `^https://github\.com/liatrio/gh-trusted-builds-workflows/\.github/workflows/build-and-push\.yaml@refs/tags/v\d+\.\d+\.\d+$`, | ||
}, | ||
{ | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subjectRegExp": `^https://github\.com/liatrio/gh-trusted-builds-workflows/\.github/workflows/scan-image\.yaml@refs/tags/v\d+\.\d+\.\d+$`, | ||
} | ||
{ | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subjectRegExp": `^https://github\.com/liatrio/gh-trusted-builds-workflows/\.github/workflows/build-and-push\.yaml@refs/tags/v\d+\.\d+\.\d+$`, | ||
}, | ||
{ | ||
"issuer": "https://token.actions.githubusercontent.com", | ||
"subjectRegExp": `^https://github\.com/liatrio/gh-trusted-builds-workflows/\.github/workflows/scan-image\.yaml@refs/tags/v\d+\.\d+\.\d+$`, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters