apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
  name: tasks-keyless
spec:
  validationFailureAction: enforce
  webhookTimeoutSeconds: 30
  rules:
  - name: verify-images
    match:
      any:
      - resources:
          kinds:
          - tekton.dev/v1beta1/Task
    preconditions:
    - key: "{{request.operation}}"
      operator: NotEquals
      value: DELETE
    imageExtractors:
      Task:
        - path: /spec/steps/*/image
    verifyImages:
    - imageReferences:
      - "ghcr.io/*"
      attestors:
      - count: 1
        entries:
        - keyless:
            issuer: "https://token.actions.githubusercontent.com"
            subject: "https://github.com/*"
            rekor:
              url: https://rekor.sigstore.dev
      required: true
