Skip to content

Commit e34dbee

Browse files
authoredJul 3, 2024··
Merge pull request #45 from github/image-glob-support
Add ability to pass glob patterns to match image, and add "exempt" policy
2 parents bace4ee + cdb96af commit e34dbee

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Next, install the GitHub `TrustRoot` and our default `ClusterImagePolicy`:
4040
helm install trust-policies --atomic \
4141
--namespace artifact-attestations \
4242
oci://ghcr.io/github/artifact-attestations-helm-charts/trust-policies \
43-
--version v0.4.0 \
43+
--version v0.5.0 \
4444
--set policy.enabled=true \
4545
--set policy.organization=MY-ORGANIZATION
4646
```

‎charts/trust-policies/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ sources:
88
type: application
99

1010
name: trust-policies
11-
version: "v0.4.0"
12-
appVersion: "v0.4.0"
11+
version: "v0.5.0"
12+
appVersion: "v0.5.0"
1313

1414
maintainers:
1515
- name: codysoyland

‎charts/trust-policies/templates/_helpers.tpl

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ Generate subjectRegExp value
33
*/}}
44
{{- define "clusterimagepolicy.subjectRegExp" -}}
55
{{- if .Values.policy.subjectRegExp -}}
6-
subjectRegExp: {{ .Values.policy.subjectRegExp }}
6+
subjectRegExp: "{{ .Values.policy.subjectRegExp }}"
77
{{- else -}}
88
subjectRegExp: https://github.com/{{ .Values.policy.organization | required "One of policy.organization/policy.subjectRegExp is required" }}/{{ .Values.policy.repository }}/\.github/workflows/.*
99
{{- end -}}
1010
{{- end -}}
11+
{{- define "clusterimagepolicy.images" -}}
12+
{{- range .Values.policy.images -}}
13+
- glob: "{{ . }}"
14+
{{ end -}}
15+
{{- end -}}
16+
{{- define "clusterimagepolicy.exemptImages" -}}
17+
{{- range .Values.policy.exemptImages -}}
18+
- glob: "{{ . }}"
19+
{{ end -}}
20+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{ if and .Values.policy.enabled .Values.policy.exemptImages }}
2+
apiVersion: policy.sigstore.dev/v1alpha1
3+
kind: ClusterImagePolicy
4+
metadata:
5+
name: github-exempt-policy
6+
spec:
7+
images: {{ include "clusterimagepolicy.exemptImages" . | nindent 4 }}
8+
authorities:
9+
- static:
10+
action: pass
11+
{{- end }}

‎charts/trust-policies/templates/clusterimagepolicy-github.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ kind: ClusterImagePolicy
44
metadata:
55
name: github-policy
66
spec:
7-
images:
8-
- glob: "**"
7+
images: {{ include "clusterimagepolicy.images" . | nindent 4 }}
98
authorities:
109
{{ if .Values.policy.trust.github }}
1110
- name: github

‎charts/trust-policies/values.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ policy:
1414
subjectRegExp:
1515
# policy.predicateType defines the type of predicate that the default policy expects
1616
predicateType: https://slsa.dev/provenance/v1
17+
# images is a list of image glob patterns that the policy applies to
18+
images:
19+
- "**"
20+
# exemptImages is a list of image glob patterns that will be allowed to run without verification
21+
exemptImages: []
1722
# policy.enabled enables the default policy
1823
enabled: false
1924
# policy.trust identifies which signing authorities should be trusted as part of the policy

0 commit comments

Comments
 (0)
Please sign in to comment.