forked from kyverno/kyverno
-
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.
fix: allow multiple keys in verifyImages.attestations.attestors.entri…
…es (kyverno#8880) * fix: allow multiple keys in verifyImages.attestations.attestors.entries Signed-off-by: Vishal Choudhary <[email protected]> * fix: tests Signed-off-by: Vishal Choudhary <[email protected]> --------- Signed-off-by: Vishal Choudhary <[email protected]>
- Loading branch information
1 parent
566db3a
commit a0afda4
Showing
13 changed files
with
204 additions
and
11 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
11 changes: 11 additions & 0 deletions
11
...ifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/README.md
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Description | ||
|
||
Verify image attestations with the given predicateType and attestors. The rule has multiple attestors with an invalid attestor | ||
|
||
## Expected Behavior | ||
|
||
The rule has two attestors, first attestor is invalid, second attestor is valid. Since count is set to 1, the pod creation should pass. | ||
|
||
## Reference Issue(s) | ||
|
||
https://github.com/kyverno/kyverno/issues/8842 |
21 changes: 21 additions & 0 deletions
21
...rifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/chainsaw-test.yaml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: keyless-attestation-invalid-attestor | ||
spec: | ||
timeouts: | ||
delete: 2m | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: policy.yaml | ||
- assert: | ||
file: policy-assert.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: pod.yaml | ||
- assert: | ||
file: pod-assert.yaml |
5 changes: 5 additions & 0 deletions
5
.../verifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/pod-assert.yaml
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: zulu | ||
namespace: default |
9 changes: 9 additions & 0 deletions
9
...hainsaw/verifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/pod.yaml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: zulu | ||
namespace: default | ||
spec: | ||
containers: | ||
- image: ghcr.io/chipzoller/zulu:v0.0.14 | ||
name: zulu |
7 changes: 7 additions & 0 deletions
7
...rifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/policy-assert.yaml
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-invalid-attestors-in-attestations | ||
annotations: | ||
pod-policies.kyverno.io/autogen-controllers: none |
40 changes: 40 additions & 0 deletions
40
...nsaw/verifyImages/clusterpolicy/standard/keyless-attestation-invalid-attestor/policy.yaml
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-invalid-attestors-in-attestations | ||
annotations: | ||
pod-policies.kyverno.io/autogen-controllers: none | ||
spec: | ||
validationFailureAction: Enforce | ||
webhookTimeoutSeconds: 30 | ||
background: false | ||
rules: | ||
- name: check-invalid-attestation-attestor | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
verifyImages: | ||
- imageReferences: | ||
- "ghcr.io/chipzoller/zulu*" | ||
attestations: | ||
- type: https://slsa.dev/provenance/v0.2 | ||
attestors: | ||
- count: 1 | ||
entries: | ||
- keyless: | ||
subject: "invalid subject" | ||
issuer: "https://token.actions.githubusercontent.com" | ||
rekor: | ||
url: https://rekor.sigstore.dev | ||
ctlog: | ||
ignoreSCT: true | ||
- keyless: | ||
subject: "https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/heads/main" | ||
issuer: "https://token.actions.githubusercontent.com" | ||
rekor: | ||
url: https://rekor.sigstore.dev | ||
ctlog: | ||
ignoreSCT: true |
11 changes: 11 additions & 0 deletions
11
...aw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/README.md
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Description | ||
|
||
Verify image signature with the given predicateType and attestors. The rule has multiple attestors with an invalid attestor | ||
|
||
## Expected Behavior | ||
|
||
The rule has two attestors, first attestor is invalid, second attestor is valid. Since count is set to 1, the pod creation should pass. | ||
|
||
## Reference Issue(s) | ||
|
||
https://github.com/kyverno/kyverno/issues/8842 |
21 changes: 21 additions & 0 deletions
21
...saw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/chainsaw-test.yaml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: keyless-image-invalid-attestor | ||
spec: | ||
timeouts: | ||
delete: 2m | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: policy.yaml | ||
- assert: | ||
file: policy-assert.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: pod.yaml | ||
- assert: | ||
file: pod-assert.yaml |
5 changes: 5 additions & 0 deletions
5
...ainsaw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/pod-assert.yaml
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: zulu | ||
namespace: default |
9 changes: 9 additions & 0 deletions
9
...ance/chainsaw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/pod.yaml
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: zulu | ||
namespace: default | ||
spec: | ||
containers: | ||
- image: ghcr.io/chipzoller/zulu:v0.0.14 | ||
name: zulu |
7 changes: 7 additions & 0 deletions
7
...saw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/policy-assert.yaml
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-invalid-attestors | ||
annotations: | ||
pod-policies.kyverno.io/autogen-controllers: none |
38 changes: 38 additions & 0 deletions
38
...e/chainsaw/verifyImages/clusterpolicy/standard/keyless-image-invalid-attestor/policy.yaml
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: check-invalid-attestors | ||
annotations: | ||
pod-policies.kyverno.io/autogen-controllers: none | ||
spec: | ||
validationFailureAction: Enforce | ||
webhookTimeoutSeconds: 30 | ||
background: false | ||
rules: | ||
- name: check-invalid-attestors | ||
match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
verifyImages: | ||
- imageReferences: | ||
- "ghcr.io/chipzoller/zulu:*" | ||
attestors: | ||
- count: 1 | ||
entries: | ||
- keyless: | ||
subject: "invalid subject" | ||
issuer: "https://token.actions.githubusercontent.com" | ||
rekor: | ||
url: https://rekor.sigstore.dev | ||
ctlog: | ||
ignoreSCT: true | ||
- keyless: | ||
subject: "https://github.com/chipzoller/zulu/.github/workflows/slsa-generic-keyless.yaml@refs/tags/v*" | ||
issuer: "https://token.actions.githubusercontent.com" | ||
rekor: | ||
url: https://rekor.sigstore.dev | ||
ctlog: | ||
ignoreSCT: true |