This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: k8s-132-oci-helm-digest-provenance-guardrail

Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification

Enforces strict immutable SHA256 digest resolution and cryptographic Cosign provenance verification for all OCI-based Helm chart artifacts deployed via GitOps controllers and native admission controllers in Kubernetes 1.32. Prevents tag-mutation vulnerabilities, supply-chain tampering, and non-deterministic reconciliations by requiring content-addressable identifiers and signed Sigstore attestations prior to admission.

Prohibited Anti-Pattern: Deploying OCI Helm Charts via Mutable Semver Tags Without SHA256 Digest Pinning or Cosign Verification

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification - Enforces strict immutable SHA256 digest resolution and cryptographic Cosign provenance verification for all OCI-based Helm chart artifacts deployed via GitOps controllers and native admission controllers in Kubernetes 1.32. Prevents tag-mutation vulnerabilities, supply-chain tampering, and non-deterministic reconciliations by requiring content-addressable identifiers and signed Sigstore attestations prior to admission.
globs: **/*.yaml, **/*.yml, deploy/**/*.yaml, k8s/**/*.yaml, infra/**/*.yaml, flux-system/**/*.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/k8s-132-oci-helm-digest-provenance-guardrail"
---

# Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Deploying OCI Helm Charts via Mutable Semver Tags Without SHA256 Digest Pinning or Cosign Verification

## System Constraints
You are a Principal Platform & Supply-Chain Security Architect enforcing Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance. Mandate that every Helm OCI artifact reference explicitly pins a content-addressable `@sha256:<hex>` digest, mandates Cosign/Sigstore attestation verification via Admission Policies (ValidatingAdmissionPolicy) or GitOps custom resources (e.g., Flux OCIRepository/HelmRelease), and unconditionally rejects mutable tags.

## Strict Guidelines
- Engineers MUST ALWAYS reference OCI Helm charts using immutable `@sha256:<64-hex>` digests in GitOps manifests and HelmRelease references.
- Engineers MUST NOT permit deployment of OCI artifacts using mutable semver tags (e.g., `:v1.2.3` or `:latest`) without pinning the content-addressable digest.
- GitOps manifests (e.g., FluxCD OCIRepository) MUST configure cryptographic verification using Cosign (keyless OIDC or public key secret) under `.spec.verify`.
- Kubernetes 1.32 ValidatingAdmissionPolicy or admission webhook rules MUST reject Helm chart Custom Resources (HelmRelease, OCIRepository) lacking verified digest annotations or explicit digest URIs.
- Pipelines MUST run `cosign verify` and fetch the exact image index digest before generating production environment deployment manifests.

## Bad vs Good Implementations
### FluxCD OCIRepository and HelmRelease with Strict OCI Digest and Cosign Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Referencing an OCI Helm artifact via a mutable tag ('tag: 2.4.1') opens the cluster to supply-chain attacks via image registry overwrites, man-in-the-middle tampering, and non-deterministic cluster reconciliation. It completely lacks SHA256 digest validation and Cosign cryptographic attestation.
```yaml
# Anti-Pattern: Relies on mutable semver tag without digest pinning or signature verification
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
  name: payment-service-chart
  namespace: flux-system
spec:
  interval: 10m
  url: oci://ghcr.io/org/charts/payment-service
  ref:
    tag: 2.4.1
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: payment-service
  namespace: production
spec:
  interval: 15m
  chartRef:
    kind: OCIRepository
    name: payment-service-chart
    namespace: flux-system
  values:
    replicaCount: 3
```

#### Production Standard (Correct)
> **Standard**: Pins the immutable content-addressable SHA256 digest under `.spec.ref.digest` and mandates Cosign signature verification via `.spec.verify.provider: cosign`. Guarantees zero tag mutation and ensures only verified, cryptographically signed artifacts can reconcile in production.
```yaml
# Compliant: Immutable content-addressable SHA256 digest with Cosign provenance verification
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
  name: payment-service-chart
  namespace: flux-system
spec:
  interval: 10m
  url: oci://ghcr.io/org/charts/payment-service
  ref:
    digest: sha256:d5c2e17730e71ab85c5dfc6f7de1b86d9bf89574ef206fa6b78ebce896561334
  verify:
    provider: cosign
    secretRef:
      name: cosign-pub-key
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: payment-service
  namespace: production
spec:
  interval: 15m
  chartRef:
    kind: OCIRepository
    name: payment-service-chart
    namespace: flux-system
  values:
    replicaCount: 3
```

### Kubernetes 1.32 Native ValidatingAdmissionPolicy Enforcing OCI Digest Syntax

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The policy merely validates that a URL exists, ignoring whether the repository relies on mutable tags or unverified upstream binaries.
```yaml
# Anti-Pattern: ValidatingAdmissionPolicy lacking digest checks on OCI repositories
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
  name: check-oci-repos
spec:
  failurePolicy: Fail
  matchConstraints:
    resourceRules:
      - apiGroups: ["source.toolkit.fluxcd.io"]
        apiVersions: ["v1beta2"]
        resources: ["ocirepositories"]
        operations: ["CREATE", "UPDATE"]
  validations:
    - expression: "has(object.spec.url)"
      message: "OCI URL must be provided."
```

#### Production Standard (Correct)
> **Standard**: Leverages Kubernetes 1.32 Common Expression Language (CEL) in ValidatingAdmissionPolicy to guarantee admission-time enforcement of strict SHA256 hex digests and mandatory Cosign verification.
```yaml
# Compliant: ValidatingAdmissionPolicy rejecting OCI repositories missing SHA256 digest or verification
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata:
  name: enforce-strict-oci-digest-provenance
spec:
  failurePolicy: Fail
  matchConstraints:
    resourceRules:
      - apiGroups: ["source.toolkit.fluxcd.io"]
        apiVersions: ["v1beta2"]
        resources: ["ocirepositories"]
        operations: ["CREATE", "UPDATE"]
  validations:
    - expression: "has(object.spec.ref) && has(object.spec.ref.digest) && object.spec.ref.digest.matches('^sha256:[a-f0-9]{64}$')"
      message: "OCI Helm chart artifacts must be pinned to an immutable SHA256 digest in .spec.ref.digest."
    - expression: "has(object.spec.verify) && object.spec.verify.provider == 'cosign'"
      message: "OCI Helm chart artifacts must specify a valid Cosign verification provider in .spec.verify."
```

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification

Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification defines an industrial-grade behavioral standard for devops engineering. Enforces strict immutable SHA256 digest resolution and cryptographic Cosign provenance verification for all OCI-based Helm chart artifacts deployed via GitOps controllers and native admission controllers in Kubernetes 1.32. Prevents tag-mutation vulnerabilities, supply-chain tampering, and non-deterministic reconciliations by requiring content-addressable identifiers and signed Sigstore attestations prior to admission. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.

Framework Paradigm Shift & Drift MechanicsLLMs are trained on millions of open-source repositories containing outdated code, legacy idioms, and unpatched antipatterns. When coding assistants generate implementations for this stack, they default to common statistical tokens: Deploying OCI Helm Charts via Mutable Semver Tags Without SHA256 Digest Pinning or Cosign Verification Without an explicit system instruction file, developers spend hours debugging silent failures.
Failure Modes & Production Blast Radius

Hazard Analysis: What Breaks Without This Rule

The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:

Failure ModeAI Symptom (The Anti-Pattern)SeverityProduction Impact & Remedy
AI Hallucination & Deprecation DriftDeploying OCI Helm Charts via Mutable Semver Tags Without SHA256 Digest Pinning or Cosign VerificationCritical
Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production.
Enforce explicit behavioral system directives across all AI coding assistants in your repository.
Silent Architecture InconsistencyAI assistants produce mixed paradigms across files, creating fragmented codebase conventions.Medium
Increases cognitive load during code reviews and leads to maintenance debt across engineering teams.
Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails.
Architectural Directives in Detail

Step-by-Step Production Directives

Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:

1

Engineers MUST ALWAYS reference OCI Helm charts using immutable `@sha256

Engineers MUST ALWAYS reference OCI Helm charts using immutable `@sha256:<64-hex>` digests in GitOps manifests and HelmRelease references.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
2

Engineers MUST NOT permit deployment of OCI artifacts using mutable semver tags (e.g., `

Engineers MUST NOT permit deployment of OCI artifacts using mutable semver tags (e.g., `:v1.2.3` or `:latest`) without pinning the content-addressable digest.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
3

GitOps manifests (e.g., FluxCD OCIRepository) MUST configure cryptographic verification using Cosign (keyless OIDC or public key secret) under `.spec.verify`.

GitOps manifests (e.g., FluxCD OCIRepository) MUST configure cryptographic verification using Cosign (keyless OIDC or public key secret) under `.spec.verify`.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
4

Kubernetes 1.32 ValidatingAdmissionPolicy or admission webhook rules MUST reject Helm chart Custom Resources (HelmRelease, OCIRepository) lacking verified digest annotations or explicit digest URIs.

Kubernetes 1.32 ValidatingAdmissionPolicy or admission webhook rules MUST reject Helm chart Custom Resources (HelmRelease, OCIRepository) lacking verified digest annotations or explicit digest URIs.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
5

Pipelines MUST run `cosign verify` and fetch the exact image index digest before generating production environment deployment manifests.

Pipelines MUST run `cosign verify` and fetch the exact image index digest before generating production environment deployment manifests.

Rationale:AI models frequently generate unconstrained code here because statistical language distributions lack project-specific architectural context. Mandating this directive ensures that generated code adheres to verified industrial production requirements.
Enforcement:Integrated into the Agent Pack rule file. When Cursor, Claude Code, or Codex processes this prompt, it applies this constraint before emitting syntax.
Technical Questions & Answers

Frequently Asked Technical Questions

Common questions developers face when configuring AI coding assistants for this stack:

Q:Why is Kubernetes 1.32 OCI-Artifact Helm Strict Digest Provenance & Cosign Verification critical for AI coding assistants?

Enforces strict immutable SHA256 digest resolution and cryptographic Cosign provenance verification for all OCI-based Helm chart artifacts deployed via GitOps controllers and native admission controllers in Kubernetes 1.32. Prevents tag-mutation vulnerabilities, supply-chain tampering, and non-deterministic reconciliations by requiring content-addressable identifiers and signed Sigstore attestations prior to admission. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.

Q:How does adopting this rule prevent AI hallucinations?

This rule explicitly declares what the AI must avoid (Deploying OCI Helm Charts via Mutable Semver Tags Without SHA256 Digest Pinning or Cosign Verification) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.

Q:Which AI coding environments are supported?

This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).

Q:Can I combine this rule with other technology stacks?

Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.

Open Specification · CC BY 4.0·Free for Personal, Team & Commercial In-Repo Use

Citation & Open Source Attribution Guidelines

This specification is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). You are completely free to adapt and share this rule in your workspace. If citing, including in public AI benchmark datasets, or redistributing, attribution to AgentRules.org is required.

1 Rule in Stack

Kubernetes