← Back to Pull requests

docs: add tested Kyverno policies for mirror signatures and provenance #3517

Closed
unknown closed this pull request without merging on Oct 30, 2026 23:58 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 22:19 UTC
Author

Summary

Adds tested Kyverno policies to the supply chain verification guide for two checks: admitting only images the integrator signed after mirroring them into a private registry, and verifying AICR's own release provenance. It also shows how to combine them, and updates the provenance demo to match.

Motivation / Context

#3467 proposed a signature gate for bundle deploys. The suggested first step there was tested admission policies for customer-signed images in a private registry, with explicit coverage and exemptions, registry authentication, positive and negative tests, and the exact signature format. #1537 asked for a validated Kyverno example for AICR's GitHub attestations, which Kyverno v1.18.1 had failed to verify.

Fixes: #1537
Related: #3467

Type of Change

  • Documentation update
  • Component(s) Affected

  • Docs/examples (docs/, examples/)

  • Other: demos/provenance.md and its slides
  • Implementation Notes

  • Your key on mirrored images: a new section, "Enforcing Your Signatures on Mirrored Images".

  • - It has two ImageValidatingPolicy objects. One covers Pods, and with them the Deployments, Jobs and CronJobs Kyverno generates rules for. The other covers kubectl debug; folding that subresource into the first policy would switch those generated rules off.
    - Every image in every container list must carry your signature, wherever it is served from. The policies exempt kube-system and kyverno. Kyverno's default Helm filters also skip kube-public and kube-node-lease; the guide shows the chart setting that brings them in.
    - Image volumes (spec.volumes[].image, on by default from Kubernetes v1.35) aren't covered by those checks, so a third policy, a ValidatingPolicy, denies them.
    - Pods that predate the policies are checked at their next update, even a label change. An unsigned image is denied, and a signed tag is pinned to its digest, which restarts the container. The guide recommends rolling workloads after applying the policies.
    - The guide asks for a TLS registry. On Kyverno v1.19.2, an ImageValidatingPolicy did not find Sigstore-bundle signatures on a plain-HTTP registry addressed by hostname.
    - Kyverno gets the mirror's CA through global.caCertificates, so the reports controller's background scans can read signatures too.
    - The policies check the registry each Pod's image reference names, so workload references must name the mirror. Redirecting pulls in containerd isn't enough.
  • AICR's provenance: the "Kyverno" subsection.

  • - The "not verified" note is replaced by two ImageValidatingPolicy objects; the second covers kubectl debug, like the mirror policies.
    - They match only the images attest-images.yaml attests. They pin that workflow with subjectRegExp, and the calling repository with githubWorkflowRepository: NVIDIA/aicr. The workflow is reusable, so any repository can call it and get a matching subject.
    - There's no ClusterPolicy form. Its Sigstore-bundle path checks only the issuer and subject, so it can't require the repository.
    - Both -debug policies turn off background evaluation, so they report Ready.
    - A reference with no tag is checked: Kyverno adds :latest before it matches. Release-candidate tags match the pattern too, and the guide shows how to trust final releases only.
    - The Policy Controller example's subject pattern now ends in refs/tags/v.$, like the Kyverno policies. It can't require the repository, and the guide, the demo and the slides now say so.
    - Every cosign verify-attestation command that trusts attest-images.yaml, in the guide, the demo, its script and the slides, pins the repository with --certificate-github-workflow-repository NVIDIA/aicr.
    - In testing, an exact subject: with a
    gave the same no matching signatures found that #1537 recorded on v1.18.1. v1.18.1 itself was not re-tested.
  • AICR's own Pods. The mirror policies deny the readiness-gate Jobs, which the AICR Operator always enables, and validator Pods that use fixed images. Those images can't be pointed at a mirror yet. The guide gives examples and explains why no namespace exemption allows them.

  • Both together. Copy AICR images with their attestations using oras cp -r, sign the copy, then point both keyless ImageValidatingPolicy objects at the mirror: new globs, including the default validator path without nvidia/, and credentials. Keyless verification also needs Sigstore's TUF repository, or an internal mirror of it. Both checks apply only to references the keyless globs match: a spelling they miss, such as registry.example.com:443/…, gets only the mirror policies' signature check.

  • Outages. A registry outage denies every matched Pod, even under failurePolicy: Ignore. Kyverno scaled to zero deletes its webhooks, so nothing is checked. The guide covers both, with recommendations.
  • Testing

    make check-docs-filenames check-docs-mdx check-docs-mdx-parse check-docs-links check-docs-yaml check-docs-shell
    make lint
    make -k qualify
    

    The docs checks and make lint pass on the final branch. make -k qualify ran on the first commit; the later commits change only docs and demos. It passed everything except test-shell and api-diff. Those fail locally only because my installed apidiff is older than the pin (exit 17, version mismatch), and that made make skip the Go unit tests, which depend on test-shell. No Go or shell test reads the changed files.

    All cluster runs used kind (Kubernetes v1.37.0) with Kyverno v1.19.2 and cosign v3.1.4. Every YAML block this PR adds is byte-identical to the file the runs applied, except that the runs put a real key in place of the mirror policies' public-key placeholder and applied the mirror-registry glob fragment inside both keyless policies.

  • Your key, 65 cases, on a TLS registry with a private CA and basic auth, plus zot for the referrers API:

  • - signed, unsigned and other-key images, in both signature formats;
    - init and ephemeral containers, Pod updates and kubectl debug;
    - Deployments, Jobs and CronJobs;
    - exemptions and multi-arch;
    - moved tags, key rotation and Audit mode;
    - registry and Kyverno outages.

    56 matched their expected result and 7 were recorded without one. The other 2 were my wrong expectations about Kyverno scaled to zero, which the guide now documents.

    The guide's own fence and commands were run as written, with only the key substituted. The signed image was admitted and pinned; unsigned and other-key images were denied with the guide's message.

  • AICR's provenance and both together, 33 cases, all passing, online against AICR v1.1.2 on ghcr.io:

  • - The keyless policies admitted aicr by tag and by digest, aicrd, a validator and aicr-gate, and denied v0.16.0, which on-tag.yaml signed.
    - In a Pod mixing an AICR image with another image, only the AICR image was checked.
    - In the mirror:
    - attested and signed images were admitted;
    - an image without the attestation was denied by the keyless policy;
    - an unsigned copy was denied by the mirror policy;
    - a signed component image was admitted.
  • Review fixes, 29 cases, all passing:

  • - the keyless policies, as written, against Pods, Deployments and kubectl debug;
    - the combined cases again, plus the default air-gap validator path and kubectl debug on a running, mirror-signed Pod;
    - the gate, busybox:1.37 and CUDA 13 images AICR's own Pods use, denied as documented.

    The guide's signing and test commands were re-run as written after the MIRROR_DIGEST change.

  • Second review pass, 23 cases, 21 on kind and 2 rendering the Kyverno chart with helm template: 20 passing, 3 recorded as measurements.

  • - The image-volume policy, as written:
    - Pods with an image volume were denied, whether its image was signed or not.
    - Pods without one were admitted.
    - Deployments (created or edited), Jobs, CronJobs and StatefulSets with one were denied.
    - Kyverno's default filters:
    - A Pod with an image volume was admitted in kube-public and kube-node-lease, and denied in default.
    - helm template shows that config.resourceFiltersExcludeNamespaces drops both filters.
    - A label update on running Pods that predate the policies: the unsigned one was denied, and the signed one was pinned and restarted.
    - The keyless policies admitted ghcr.io:443/nvidia/aicr:v0.16.0 and denied ghcr.io/nvidia/aicr:v0.16.0.
  • Second review, 46 cases: 37 passing and 9 recorded as measurements. 30 ran on kind, 10 with Policy Controller's offline tester and 6 with cosign:

  • - The keyless policies as written, now requiring NVIDIA/aicr: v1.1.2 admitted and pinned, v0.16.0 denied, in Pods, Deployments and kubectl debug. With another repository required, v1.1.2 was denied in all three.
    - All four policies report Ready, and both -debug policies still deny.
    - The combined mirror cases again, with the new policies.
    - A reference with no tag is normalized to :latest and checked, on ghcr.io and in the mirror.
    - Policy Controller's tester, v0.15.1 and v0.13.1, on the aligned example: v1.1.2 verified and v0.16.0 denied on identity. A CUE policy block requiring another repository, or a field its input lacks, still admitted v1.1.2: the block sees only each attestation's digest, id and predicate type.
    - cosign verify-attestation with the repository pinned: the SBOM and VEX attestations of aicr and aicrd at v1.1.2 verify, and fail with another repository named.
    - Background scans: with the CA on the admission controller only, the mirror images' PolicyReport results were x509 errors. With global.caCertificates, all 12 results were pass or fail. An earlier run of this check read results Kyverno had kept from before the change; clearing its ephemeral reports fixed that.
  • Third review, 4 cases, with cosign: the demo script's two cosign verify-attestation commands, run as written against v1.1.2. The SBOM and VEX attestations verify with NVIDIA/aicr and fail with another repository. The rest of that round changes wording only; the YAML blocks are unchanged.

  • Not covered: listed at the end of the new section.
  • Risk Assessment

  • Low — Documentation only; no code.
  • Rollout notes: N/A

    Checklist

  • Tests pass locally (make test with -race) — N/A, docs only

  • Linter passes (make lint)

  • I did not skip/disable tests to make CI green

  • I added/updated tests for new functionality — N/A

  • I updated docs if user-facing behavior changed

  • Changes follow existing patterns in the codebase

  • Commits are signed off and cryptographically signed (git commit -s -S)
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: yuanchen8911 Review duration: 1538m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3517"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%
    Repository