Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add subjectRegExp param, make organization required if not set #38

Merged
merged 8 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ jobs:
- name: Install trust-policies
run: |
helm install trust-policies charts/trust-policies \
--set policy.enabled=true
--set policy.enabled=true \
--set policy.organization=github
4 changes: 2 additions & 2 deletions charts/trust-policies/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ sources:
type: application

name: trust-policies
version: "v0.3.0"
appVersion: "v0.3.0"
version: "v0.4.0"
appVersion: "v0.4.0"

maintainers:
- name: codysoyland
Expand Down
10 changes: 10 additions & 0 deletions charts/trust-policies/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{/*
Generate subjectRegExp value
*/}}
{{- define "clusterimagepolicy.subjectRegExp" -}}
{{- if .Values.policy.subjectRegExp -}}
subjectRegExp: {{ .Values.policy.subjectRegExp }}
{{- else -}}
subjectRegExp: https://github.com/{{ .Values.policy.organization | required "One of policy.organization/policy.subjectRegExp is required" }}/{{ .Values.policy.repository }}/\.github/workflows/.*
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
url: https://fulcio.githubapp.com
identities:
- issuer: https://token.actions.githubusercontent.com
subjectRegExp: https://github.com/{{ .Values.policy.organization }}/{{ .Values.policy.repo }}/\.github/workflows/.*
{{- include "clusterimagepolicy.subjectRegExp" . | nindent 8 }}
rfc3161timestamp:
trustRootRef: github
signatureFormat: bundle
Expand All @@ -26,7 +26,7 @@ spec:
keyless:
identities:
- issuer: https://token.actions.githubusercontent.com
subjectRegExp: https://github.com/{{ .Values.policy.organization }}/{{ .Values.policy.repo }}/\.github/workflows/.*
{{- include "clusterimagepolicy.subjectRegExp" . | nindent 8 }}
ctlog:
url: https://rekor.sigstore.dev
signatureFormat: bundle
Expand Down
24 changes: 16 additions & 8 deletions charts/trust-policies/values.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# A default policy can be created by setting policy.enabled to true.
policy:
# organization is a regex that matches the organization name in the certificate identity
organization: '.*'
# repo is a regex that matches the repository name in the certificate identity
repo: '.*'
# enabled is a flag to enable the default policy
enabled: false
# predicateType is the type of predicate to expect in the default policy
# To verify an attestation, we must validate the identity of the workflow that signed it, which is stored in the attestation's certificate's subject alternative name.
# To validate the signer workflow's identity, you can set the subjectRegExp value, or set the organization and the repository values below.
#
# policy.organization is used to validate the signer workflow's identity. An attestation is valid if it was generated inside a repository owned by this organization.
# Required if policy.enabled is true and policy.subjectRegExp has not been set.
organization:
# policy.repository is used to validate the signer workflow's identity. An attestation is valid if it was generated inside this specific repository.
# Must be used in combination with the policy.organization value.
repository: '.*'
# policy.subjectRegExp is a regex used to validate the signer workflow's identity. Use this if your attestations are generated with a reusable workflow.
# Required if policy.enabled is true and policy.organization has not been set.
subjectRegExp:
# policy.predicateType defines the type of predicate that the default policy expects
predicateType: https://slsa.dev/provenance/v1
# Identify which signing authorities should be trusted as part of the policy
# policy.enabled enables the default policy
enabled: false
# policy.trust identifies which signing authorities should be trusted as part of the policy
trust:
# trust the GitHub signing authority
github: true
Expand Down