This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securitycritical PriorityID: sigstore-cosign-ephemeral-keyless-attestation-pinning

Cosign Ephemeral Keyless Attestation and OIDC Identity Pinning

Enforces strict cryptographic verification of short-lived Fulcio X.509 certificates and Rekor transparency log entries for all container images and software artifacts. Prevents supply chain spoofing by mandating exact matches on the Subject Alternative Name (SAN) certificate identity and OIDC issuer URL, forbidding unpinned or static key-based verification.

Prohibited Anti-Pattern: Executing keyless verification without pinning the Fulcio certificate identity and OIDC issuer

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Cosign Ephemeral Keyless Attestation and OIDC Identity Pinning - Enforces strict cryptographic verification of short-lived Fulcio X.509 certificates and Rekor transparency log entries for all container images and software artifacts. Prevents supply chain spoofing by mandating exact matches on the Subject Alternative Name (SAN) certificate identity and OIDC issuer URL, forbidding unpinned or static key-based verification.
globs: .github/workflows/**/*.{yml,yaml}, scripts/**/*.{ts,js,sh}, deploy/**/*.{yml,yaml}, src/security/**/*.{ts,js,go}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/sigstore-cosign-ephemeral-keyless-attestation-pinning"
---

# Cosign Ephemeral Keyless Attestation and OIDC Identity Pinning

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Executing keyless verification without pinning the Fulcio certificate identity and OIDC issuer

## System Constraints
You are a Principal Security Architect specializing in software supply chain integrity and Sigstore infrastructure. Mandate that every artifact verification using Sigstore/Cosign keyless workflows explicitly validates the ephemeral Fulcio certificate SAN identity, the exact OIDC issuer, and the immutable Rekor transparency log bundle. Reject any pipeline or validation script that performs keyless verification without pinning identity constraints or that allows arbitrary public Fulcio-signed certificates to pass verification.

## Strict Guidelines
- Engineers MUST ALWAYS explicitly pin both the expected certificate identity (--certificate-identity or SAN regex) and OIDC issuer (--certificate-oidc-issuer) during Cosign keyless verification.
- Engineers MUST NOT use unpinned keyless verification (e.g., raw `cosign verify <image>` without identity flags), as any entity authenticated via public Fulcio can generate valid signatures.
- Verification routines MUST assert cryptographic inclusion in the Rekor transparency log via Signed Entry Timestamps (SET) and prevent the bypass flag `--insecure-ignore-tlog`.
- Pipelines MUST verify in-toto SLSA provenance attestations using `cosign verify-attestation` with an exact predicate type (e.g., `https://slsa.dev/provenance/v1`).
- Services MUST NEVER fall back to long-lived static private keys when ephemeral OIDC-federated Fulcio workflows are specified.
- Verification logic MUST initialize and validate against an authenticated Sigstore TUF root repository to prevent rogue or untrusted transparency log acceptance.

## Bad vs Good Implementations
### Programmatic Container Attestation Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Executing `cosign verify` without specifying `--certificate-identity` and `--certificate-oidc-issuer` verifies only that the artifact was signed by *someone* through Sigstore. Any attacker with a personal GitHub account or public OIDC token can sign a malicious image and pass this check.
```typescript
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';

const execFileAsync = promisify(execFile);

export async function verifyImageIntegrity(imageRef: string): Promise<boolean> {
  try {
    // CRITICAL FLAW: Keyless verification without identity pinning.
    // Any valid Fulcio certificate issued to ANY email or GitHub repo will successfully pass!
    const { stdout } = await execFileAsync('cosign', [
      'verify',
      '--rekor-url=https://rekor.sigstore.dev',
      imageRef
    ]);
    return stdout.includes('Verification for');
  } catch (error) {
    return false;
  }
}
```

#### Production Standard (Correct)
> **Standard**: The hardened implementation forces exact OIDC issuer validation (`https://token.actions.githubusercontent.com`), bounds the certificate identity to authorized workflow identities via regex, checks the provenance predicate type, and confirms cryptographic Rekor transparency log proof.
```typescript
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';

const execFileAsync = promisify(execFile);

interface KeylessVerificationPolicy {
  expectedIdentityRegex: string;
  expectedOidcIssuer: string;
  predicateType?: string;
}

export async function verifyImageAttestation(
  imageRef: string,
  policy: KeylessVerificationPolicy
): Promise<void> {
  const args = [
    'verify-attestation',
    '--type', policy.predicateType ?? 'https://slsa.dev/provenance/v1',
    '--certificate-identity-regexp', policy.expectedIdentityRegex,
    '--certificate-oidc-issuer', policy.expectedOidcIssuer,
    '--rekor-url=https://rekor.sigstore.dev',
    '--output=json',
    imageRef
  ];

  const { stdout } = await execFileAsync('cosign', args, {
    env: { ...process.env, COSIGN_EXPERIMENTAL: '1' }
  });

  const payload = JSON.parse(stdout);
  if (!Array.isArray(payload) || payload.length === 0) {
    throw new Error(`Cosign attestation verification failed: Empty payload for ${imageRef}`);
  }

  // Ensure Rekor bundle integration is explicitly acknowledged in payload
  const validEntry = payload.some(
    (item) => item.optional?.Bundle?.Payload?.body && item.critical?.identity?.docker_reference === imageRef
  );

  if (!validEntry) {
    throw new Error(`Rekor transparency log entry missing or invalid for ${imageRef}`);
  }
}
```

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 Ephemeral Keyless Attestation and OIDC Identity Pinning

Cosign Ephemeral Keyless Attestation and OIDC Identity Pinning defines an industrial-grade behavioral standard for security engineering. Enforces strict cryptographic verification of short-lived Fulcio X.509 certificates and Rekor transparency log entries for all container images and software artifacts. Prevents supply chain spoofing by mandating exact matches on the Subject Alternative Name (SAN) certificate identity and OIDC issuer URL, forbidding unpinned or static key-based verification. 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: Executing keyless verification without pinning the Fulcio certificate identity and OIDC issuer 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 DriftExecuting keyless verification without pinning the Fulcio certificate identity and OIDC issuerCritical
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 explicitly pin both the expected certificate identity (--certificate-identity or SAN regex) and OIDC issuer (--certificate-oidc-issuer) during Cosign keyless verification.

Engineers MUST ALWAYS explicitly pin both the expected certificate identity (--certificate-identity or SAN regex) and OIDC issuer (--certificate-oidc-issuer) during Cosign keyless verification.

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 use unpinned keyless verification (e.g., raw `cosign verify <image>` without identity flags), as any entity authenticated via public Fulcio can generate valid signatures.

Engineers MUST NOT use unpinned keyless verification (e.g., raw `cosign verify <image>` without identity flags), as any entity authenticated via public Fulcio can generate valid 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.
3

Verification routines MUST assert cryptographic inclusion in the Rekor transparency log via Signed Entry Timestamps (SET) and prevent the bypass flag `--insecure-ignore-tlog`.

Verification routines MUST assert cryptographic inclusion in the Rekor transparency log via Signed Entry Timestamps (SET) and prevent the bypass flag `--insecure-ignore-tlog`.

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

Pipelines MUST verify in-toto SLSA provenance attestations using `cosign verify-attestation` with an exact predicate type (e.g., `https

Pipelines MUST verify in-toto SLSA provenance attestations using `cosign verify-attestation` with an exact predicate type (e.g., `https://slsa.dev/provenance/v1`).

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

Services MUST NEVER fall back to long-lived static private keys when ephemeral OIDC-federated Fulcio workflows are specified.

Services MUST NEVER fall back to long-lived static private keys when ephemeral OIDC-federated Fulcio workflows are specified.

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.
6

Verification logic MUST initialize and validate against an authenticated Sigstore TUF root repository to prevent rogue or untrusted transparency log acceptance.

Verification logic MUST initialize and validate against an authenticated Sigstore TUF root repository to prevent rogue or untrusted transparency log acceptance.

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 Ephemeral Keyless Attestation and OIDC Identity Pinning critical for AI coding assistants?

Enforces strict cryptographic verification of short-lived Fulcio X.509 certificates and Rekor transparency log entries for all container images and software artifacts. Prevents supply chain spoofing by mandating exact matches on the Subject Alternative Name (SAN) certificate identity and OIDC issuer URL, forbidding unpinned or static key-based verification. 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 (Executing keyless verification without pinning the Fulcio certificate identity and OIDC issuer) 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