This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: cosign-rekor-ephemeral-oidc-admission-invariants

Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail

Mandates strict zero-trust container admission verification using Cosign 2.4 keyless OIDC signatures verified against Rekor transparency log proofs. Requires immutable digest pinning (sha256), explicit certificate identity (Subject Alternative Name) and issuer constraints, and cryptographically verified in-toto SLSA provenance attestations prior to workload scheduling.

Prohibited Anti-Pattern: Admitting Mutable Tags with Bypassed Rekor Verification or Unconstrained OIDC Certificate Identities

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail - Mandates strict zero-trust container admission verification using Cosign 2.4 keyless OIDC signatures verified against Rekor transparency log proofs. Requires immutable digest pinning (sha256), explicit certificate identity (Subject Alternative Name) and issuer constraints, and cryptographically verified in-toto SLSA provenance attestations prior to workload scheduling.
globs: policies/**/*.yaml, k8s/**/*.{yaml,yml}, src/admission/**/*.{ts,js,go}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cosign-rekor-ephemeral-oidc-admission-invariants"
---

# Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Admitting Mutable Tags with Bypassed Rekor Verification or Unconstrained OIDC Certificate Identities

## System Constraints
You are a Principal Security Architect enforcing Cosign 2.4 and Rekor ephemeral OIDC artifact attestation standards across container pipelines and Kubernetes admission webhooks. Mandate zero-trust keyless verification, immutable sha256 digests, Rekor log inclusion proofs, and exact OIDC issuer/subject identity matching.

## Strict Guidelines
- Engineers MUST ALWAYS resolve container images to immutable SHA256 digests (`image@sha256:...`) before signature or attestation verification; mutable tags MUST be rejected immediately.
- Engineers MUST ALWAYS validate the ephemeral X.509 certificate's SAN (Subject Alternative Name) and OIDC Issuer against an explicit, non-wildcard identity policy (e.g., verifying both `issuer` equals `https://token.actions.githubusercontent.com` and `subject` matches the repository workflow).
- Engineers MUST NEVER set `--insecure-ignore-tlog=true` or bypass Rekor transparency log inclusion and integrated timestamp verification during keyless validation.
- Admission policies MUST enforce cryptographic verification of in-toto SLSA provenance attestations (`type: slsaprovenance`) alongside standard container image signatures.
- Admission verification services MUST fail closed (Deny by default) upon network timeouts, Rekor communication failures, or untrusted Root-of-Trust (Fulcio/Rekor TUF metadata) drift.

## Bad vs Good Implementations
### TypeScript Admission Controller Verification Engine

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Accepts mutable image tags, bypasses Rekor transparency log checks with `--insecure-ignore-tlog=true`, and does not validate the Fulcio OIDC certificate subject or issuer, allowing any valid keyless certificate from any GitHub/Google repository to satisfy the gate.
```typescript
import { execSync } from 'child_process';

export async function verifyImage(imageRef: string): Promise<boolean> {
  try {
    // BAD: Accepts mutable tags, ignores Rekor transparency log,
    // and omits OIDC identity (SAN/Issuer) verification constraints.
    execSync(`cosign verify --insecure-ignore-tlog=true ${imageRef}`);
    return true;
  } catch {
    return false;
  }
}
```

#### Production Standard (Correct)
> **Standard**: Enforces immutable sha256 digest validation, mandates inclusion verification on the Rekor transparency log (failing closed on failure), and strictly restricts the OIDC Issuer and Subject Alternative Name regex to the verified source repository workflow.
```typescript
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';

const execFileAsync = promisify(execFile);

interface VerificationConfig {
  expectedDigestPattern: RegExp;
  oidcIssuer: string;
  certIdentityRegex: string;
}

const CONFIG: VerificationConfig = {
  expectedDigestPattern: /^([a-z0-9.-]+\/)?[a-z0-9._-]+@[a-f0-9]{64}$/i,
  oidcIssuer: 'https://token.actions.githubusercontent.com',
  certIdentityRegex: '^https://github.com/my-org/my-repo/\.github/workflows/deploy\.yml@refs/heads/main$'
};

export async function verifyContainerAdmission(imageWithDigest: string): Promise<void> {
  // 1. Enforce immutable digest pinning
  if (!CONFIG.expectedDigestPattern.test(imageWithDigest)) {
    throw new Error(`Rejected: Image must be referenced by immutable sha256 digest: ${imageWithDigest}`);
  }

  // 2. Enforce keyless verification with Rekor transparency proof and strict SAN/Issuer validation
  const args = [
    'verify',
    '--certificate-oidc-issuer', CONFIG.oidcIssuer,
    '--certificate-identity-regexp', CONFIG.certIdentityRegex,
    '--rekor-url', 'https://rekor.sigstore.dev',
    '--output', 'json',
    imageWithDigest
  ];

  try {
    const { stdout } = await execFileAsync('cosign', args, { timeout: 10000 });
    const verificationPayload = JSON.parse(stdout);
    
    if (!Array.isArray(verificationPayload) || verificationPayload.length === 0) {
      throw new Error('Cosign returned empty verification payload');
    }
  } catch (error) {
    throw new Error(`Admission Denied: Cosign verification failed: ${(error as Error).message}`);
  }
}
```

Recommended MCP Servers (mcp-serverlist.com)

Equip agent with system tools to verify code for this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail

Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail defines an industrial-grade behavioral standard for security engineering. Mandates strict zero-trust container admission verification using Cosign 2.4 keyless OIDC signatures verified against Rekor transparency log proofs. Requires immutable digest pinning (sha256), explicit certificate identity (Subject Alternative Name) and issuer constraints, and cryptographically verified in-toto SLSA provenance attestations prior to workload scheduling. 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: Admitting Mutable Tags with Bypassed Rekor Verification or Unconstrained OIDC Certificate Identities 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 DriftAdmitting Mutable Tags with Bypassed Rekor Verification or Unconstrained OIDC Certificate IdentitiesCritical
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 resolve container images to immutable SHA256 digests (`image@sha256

Engineers MUST ALWAYS resolve container images to immutable SHA256 digests (`image@sha256:...`) before signature or attestation verification; mutable tags MUST be rejected immediately.

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 ALWAYS validate the ephemeral X.509 certificate's SAN (Subject Alternative Name) and OIDC Issuer against an explicit, non-wildcard identity policy (e.g., verifying both `issuer` equals `https

Engineers MUST ALWAYS validate the ephemeral X.509 certificate's SAN (Subject Alternative Name) and OIDC Issuer against an explicit, non-wildcard identity policy (e.g., verifying both `issuer` equals `https://token.actions.githubusercontent.com` and `subject` matches the repository workflow).

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

Engineers MUST NEVER set `--insecure-ignore-tlog=true` or bypass Rekor transparency log inclusion and integrated timestamp verification during keyless validation.

Engineers MUST NEVER set `--insecure-ignore-tlog=true` or bypass Rekor transparency log inclusion and integrated timestamp verification during keyless validation.

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

Admission policies MUST enforce cryptographic verification of in-toto SLSA provenance attestations (`type

Admission policies MUST enforce cryptographic verification of in-toto SLSA provenance attestations (`type: slsaprovenance`) alongside standard container image signatures.

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

Admission verification services MUST fail closed (Deny by default) upon network timeouts, Rekor communication failures, or untrusted Root-of-Trust (Fulcio/Rekor TUF metadata) drift.

Admission verification services MUST fail closed (Deny by default) upon network timeouts, Rekor communication failures, or untrusted Root-of-Trust (Fulcio/Rekor TUF metadata) drift.

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 Cosign 2.4 Rekor Ephemeral OIDC Attestation Admission Guardrail critical for AI coding assistants?

Mandates strict zero-trust container admission verification using Cosign 2.4 keyless OIDC signatures verified against Rekor transparency log proofs. Requires immutable digest pinning (sha256), explicit certificate identity (Subject Alternative Name) and issuer constraints, and cryptographically verified in-toto SLSA provenance attestations prior to workload scheduling. 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 (Admitting Mutable Tags with Bypassed Rekor Verification or Unconstrained OIDC Certificate Identities) 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

Cosign