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

Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation

Mandates keyless, hardware-rooted workload identity signing via Sigstore (Fulcio CA and Rekor transparency log) for all build provenance attestations generated inside ephemeral CI/CD runners. Strictly forbids static long-lived signing keys and mutable tag references, ensuring every published artifact carries tamper-evident SLSA provenance cryptographically bound to an immutable content digest.

Prohibited Anti-Pattern: Static Secret Keys and Mutable Tag Attestation in CI/CD Runners

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation - Mandates keyless, hardware-rooted workload identity signing via Sigstore (Fulcio CA and Rekor transparency log) for all build provenance attestations generated inside ephemeral CI/CD runners. Strictly forbids static long-lived signing keys and mutable tag references, ensuring every published artifact carries tamper-evident SLSA provenance cryptographically bound to an immutable content digest.
globs: .github/workflows/**/*.{yml,yaml}, scripts/release/**/*.{ts,js,mjs,sh}, build/**/*.{ts,js,mjs}, pipelines/**/*.{ts,js,yml,yaml}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/cosign-ephemeral-slsa-provenance-attestation"
---

# Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Static Secret Keys and Mutable Tag Attestation in CI/CD Runners

## System Constraints
You are a Principal Security Architect enforcing the Sigstore Cosign Ephemeral Runner SLSA Provenance Attestation Guardrail. You mandate keyless OIDC identity signing via Fulcio and Rekor, strict SLSA provenance generation within ephemeral runner isolation, and absolute reliance on immutable content digests instead of mutable registry tags.

## Strict Guidelines
- Pipelines MUST ALWAYS use ephemeral OIDC tokens (via Sigstore Fulcio) for keyless signing rather than long-lived private keys stored in CI runner secrets.
- Engineers MUST ALWAYS bind attestations and signatures to immutable container digests (e.g., `image@sha256:...`) and NEVER to mutable tags (e.g., `image:v1.0.0`).
- Attestation workflows MUST publish cryptographic proof of signing directly to the Rekor transparency log (`--rekor-entry`) to guarantee non-repudiation.
- Provenance payloads MUST conform to standardized SLSA specifications (v0.2 or v1.0) using in-toto envelope formats generated within the ephemeral boundary.
- Workload execution environments MUST restrict OIDC issuer permissions (`id-token: write`) strictly to the isolated attestation step, minimizing token exposure.
- Build scripts MUST verify identity certificates against expected repository claims (SAN owner, repository workflow ref) before promoting artifacts.

## Bad vs Good Implementations
### Cosign In-Toto Provenance Signing Orchestration

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The bad example signs a mutable tag (`:versionTag`), which allows tag hijacking or race-condition replacements. It relies on a long-lived private key loaded into environment variables (`COSIGN_PRIVATE_KEY`), violating keyless ephemeral workload identity and lacking transparency log non-repudiation.
```typescript
import { execSync } from 'node:child_process';

interface ReleaseConfig {
  imageRepository: string;
  versionTag: string;
  predicatePath: string;
}

export function attestBuild(config: ReleaseConfig): void {
  // ANTI-PATTERN: Targets mutable tag instead of immutable digest
  const target = `${config.imageRepository}:${config.versionTag}`;

  // ANTI-PATTERN: Uses ambient static private key from runner secrets with password
  // Lacks Rekor transparency log verification and relies on long-lived credentials
  execSync(
    `cosign attest \
      --key env://COSIGN_PRIVATE_KEY \
      --type slsaprovenance \
      --predicate ${config.predicatePath} \
      ${target}`,
    {
      env: {
        ...process.env,
        COSIGN_PASSWORD: process.env.COSIGN_PASSWORD,
      },
      stdio: 'inherit',
    }
  );
}
```

#### Production Standard (Correct)
> **Standard**: The compliant code enforces strict targeting of an immutable digest (`@sha256:`), validates predicate presence, and performs keyless signing via ephemeral OIDC federation (`--yes`, Fulcio, and Rekor inclusion). No static private keys or persistent secrets are exposed.
```typescript
import { execSync } from 'node:child_process';
import { createHash } from 'node:crypto';
import { readFileSync } from 'node:fs';

interface AttestationConfig {
  imageRepository: string;
  imageDigest: string; // Must be sha256:... format
  predicatePath: string;
  oidcIssuer: string;
}

export function attestBuildProvenance(config: AttestationConfig): void {
  if (!config.imageDigest.startsWith('sha256:')) {
    throw new Error('Refusing to attest: Target must be an immutable sha256 digest reference');
  }

  // Validate predicate integrity prior to envelope attachment
  const predicateContent = readFileSync(config.predicatePath, 'utf8');
  const predicateHash = createHash('sha256').update(predicateContent).digest('hex');
  if (!predicateHash) {
    throw new Error('Failed to compute SLSA predicate hash');
  }

  const target = `${config.imageRepository}@${config.imageDigest}`;

  // SECURE: Enforces keyless OIDC identity via Fulcio and records to Rekor transparency log
  // Runs in ephemeral runner context where id-token is provided by the workload environment
  execSync(
    `cosign attest \
      --yes \
      --type slsaprovenance \
      --predicate "${config.predicatePath}" \
      --identity-provider github \
      --rekor-entry \
      "${target}"`,
    {
      env: {
        ...process.env,
        COSIGN_EXPERIMENTAL: '1',
      },
      stdio: 'pipe',
    }
  );
}
```

Recommended MCP Servers (mcp-serverlist.com)

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

Recommended Agent Skills (askills.dev)

Ready-to-use executable skill functions tailored to this stack.

Architectural Specification & Invariant Rationale

Architectural Invariant Design: Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation

Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation defines an industrial-grade behavioral standard for security engineering. Mandates keyless, hardware-rooted workload identity signing via Sigstore (Fulcio CA and Rekor transparency log) for all build provenance attestations generated inside ephemeral CI/CD runners. Strictly forbids static long-lived signing keys and mutable tag references, ensuring every published artifact carries tamper-evident SLSA provenance cryptographically bound to an immutable content digest. 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: Static Secret Keys and Mutable Tag Attestation in CI/CD Runners 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 DriftStatic Secret Keys and Mutable Tag Attestation in CI/CD RunnersCritical
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

Pipelines MUST ALWAYS use ephemeral OIDC tokens (via Sigstore Fulcio) for keyless signing rather than long-lived private keys stored in CI runner secrets.

Pipelines MUST ALWAYS use ephemeral OIDC tokens (via Sigstore Fulcio) for keyless signing rather than long-lived private keys stored in CI runner secrets.

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 bind attestations and signatures to immutable container digests (e.g., `image@sha256

Engineers MUST ALWAYS bind attestations and signatures to immutable container digests (e.g., `image@sha256:...`) and NEVER to mutable tags (e.g., `image:v1.0.0`).

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

Attestation workflows MUST publish cryptographic proof of signing directly to the Rekor transparency log (`--rekor-entry`) to guarantee non-repudiation.

Attestation workflows MUST publish cryptographic proof of signing directly to the Rekor transparency log (`--rekor-entry`) to guarantee non-repudiation.

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

Provenance payloads MUST conform to standardized SLSA specifications (v0.2 or v1.0) using in-toto envelope formats generated within the ephemeral boundary.

Provenance payloads MUST conform to standardized SLSA specifications (v0.2 or v1.0) using in-toto envelope formats generated within the ephemeral boundary.

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

Workload execution environments MUST restrict OIDC issuer permissions (`id-token

Workload execution environments MUST restrict OIDC issuer permissions (`id-token: write`) strictly to the isolated attestation step, minimizing token exposure.

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

Build scripts MUST verify identity certificates against expected repository claims (SAN owner, repository workflow ref) before promoting artifacts.

Build scripts MUST verify identity certificates against expected repository claims (SAN owner, repository workflow ref) before promoting artifacts.

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 Sigstore Cosign Ephemeral Workload Identity SLSA Provenance Attestation critical for AI coding assistants?

Mandates keyless, hardware-rooted workload identity signing via Sigstore (Fulcio CA and Rekor transparency log) for all build provenance attestations generated inside ephemeral CI/CD runners. Strictly forbids static long-lived signing keys and mutable tag references, ensuring every published artifact carries tamper-evident SLSA provenance cryptographically bound to an immutable content digest. 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 (Static Secret Keys and Mutable Tag Attestation in CI/CD Runners) 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

Sigstore