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

Sigstore Cosign Keyless Artifact Attestation and SLSA Level 3 Invariants

Enforces immutable cryptographic provenance and SLSA Level 3 build attestation verification for all OCI container images prior to deployment. Prohibits deployment via mutable image tags and mandates verification of keyless Fulcio certificates and Rekor transparency log entries against trusted OIDC identity bounds.

Prohibited Anti-Pattern: Deploying Unverified OCI Images or Trusting Mutable Tags Without Rekor and Fulcio Attestation

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Sigstore Cosign Keyless Artifact Attestation and SLSA Level 3 Invariants - Enforces immutable cryptographic provenance and SLSA Level 3 build attestation verification for all OCI container images prior to deployment. Prohibits deployment via mutable image tags and mandates verification of keyless Fulcio certificates and Rekor transparency log entries against trusted OIDC identity bounds.
globs: .github/workflows/**/*.{yml,yaml}, scripts/**/*.{ts,js,sh}, deploy/**/*.{ts,js,json,yaml,yml}, src/deployment/**/*.{ts,js}
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/sigstore-cosign-slsa3-attestation-invariants"
---

# Sigstore Cosign Keyless Artifact Attestation and SLSA Level 3 Invariants

> **Severity**: CRITICAL | **Category**: security
> **Anti-Pattern Warning**: Deploying Unverified OCI Images or Trusting Mutable Tags Without Rekor and Fulcio Attestation

## System Constraints
You are a Principal Security Architect enforcing Sigstore Cosign keyless attestation and SLSA Level 3 supply-chain invariants. Mandate that every artifact deployed into production is referenced exclusively by an immutable sha256 digest and cryptographically verified against Rekor transparency log records and Fulcio OIDC certificate identities. Reject any workflow, script, or deployment manifest that relies on mutable tags, unverified keyless signatures, or omitted build provenance checks.

## Strict Guidelines
- Engineers MUST ALWAYS reference OCI container images by their cryptographic SHA256 digest (`image@sha256:...`) and NEVER by mutable tags (`:latest`, `:v1.0.0`) in deployment pipelines.
- Engineers MUST ALWAYS verify both the container signature and the in-toto SLSA provenance attestation (`cosign verify-attestation --type slsaprovenance`) before deploying to any production cluster.
- Pipelines MUST verify the Fulcio certificate SAN identity (`--certificate-identity`) and issuer (`--certificate-oidc-issuer`) against exact expected repository workflows, preventing unauthorized builds from arbitrary CI accounts.
- Engineers MUST NOT allow bypass flags such as `--insecure-ignore-tlog` or `--insecure-ignore-sct` in production verification gates.
- Deployment scripts MUST fail closed: any failure to resolve Rekor log proofs, missing attestation bundles, or signature mismatches must immediately terminate the deployment sequence.

## Bad vs Good Implementations
### Production Deployment Gate: Strict Sigstore Keyless & SLSA Provenance Verification

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: The deployment relies on a mutable tag (e.g., :latest or semver), lacks image digest pinning, and completely omits Sigstore verification. Attackers compromising the registry or executing a man-in-the-middle attack can replace the image tag with malicious binaries without detection.
```typescript
import { execSync } from 'node:child_process';

interface DeploymentParams {
  imageRepository: string;
  tag: string;
}

export async function deployToProduction({ imageRepository, tag }: DeploymentParams): Promise<void> {
  const fullImageRef = `${imageRepository}:${tag}`;
  
  // CRITICAL SECURITY FLAW: Deploying mutable tag without verifying
  // Fulcio OIDC identity, Rekor transparency log, or SLSA provenance
  console.log(`Deploying unverified container: ${fullImageRef}`);
  execSync(`kubectl set image deployment/core-service app=${fullImageRef}`, { stdio: 'inherit' });
}
```

#### Production Standard (Correct)
> **Standard**: Validates the cryptographic sha256 digest structure, verifies keyless Fulcio certificate OIDC identity and Rekor transparency log entry, verifies SLSA Level 3 provenance attestation, and deploys using the immutable digest reference, guaranteeing artifact integrity and origin.
```typescript
import { execFileSync } from 'node:child_process';

interface VerifiedDeploymentParams {
  imageRepository: string;
  sha256Digest: string;
  expectedOidcIssuer: string;
  expectedCertIdentity: string;
}

export async function deployVerifiedImage({
  imageRepository,
  sha256Digest,
  expectedOidcIssuer,
  expectedCertIdentity
}: VerifiedDeploymentParams): Promise<void> {
  // Invariant 1: Ensure immutable digest format (sha256:64-hex)
  const digestRegex = /^sha256:[a-f0-9]{64}$/;
  if (!digestRegex.test(sha256Digest)) {
    throw new Error(`Security Exception: Invalid immutable digest format: ${sha256Digest}`);
  }

  const immutableImageRef = `${imageRepository}@${sha256Digest}`;

  // Invariant 2: Verify Fulcio identity and Rekor transparency log for keyless signature
  execFileSync('cosign', [
    'verify',
    `--certificate-identity=${expectedCertIdentity}`,
    `--certificate-oidc-issuer=${expectedOidcIssuer}`,
    immutableImageRef
  ], { stdio: 'pipe' });

  // Invariant 3: Verify SLSA Level 3 Provenance attestation via Sigstore in-toto bundle
  execFileSync('cosign', [
    'verify-attestation',
    '--type=slsaprovenance',
    `--certificate-identity=${expectedCertIdentity}`,
    `--certificate-oidc-issuer=${expectedOidcIssuer}`,
    immutableImageRef
  ], { stdio: 'pipe' });

  // Invariant 4: Deploy strictly using the verified immutable digest
  execFileSync('kubectl', [
    'set',
    'image',
    'deployment/core-service',
    `app=${immutableImageRef}`
  ], { stdio: 'inherit' });
}
```

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 Keyless Artifact Attestation and SLSA Level 3 Invariants

Sigstore Cosign Keyless Artifact Attestation and SLSA Level 3 Invariants defines an industrial-grade behavioral standard for security engineering. Enforces immutable cryptographic provenance and SLSA Level 3 build attestation verification for all OCI container images prior to deployment. Prohibits deployment via mutable image tags and mandates verification of keyless Fulcio certificates and Rekor transparency log entries against trusted OIDC identity bounds. 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 Unverified OCI Images or Trusting Mutable Tags Without Rekor and Fulcio Attestation 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 Unverified OCI Images or Trusting Mutable Tags Without Rekor and Fulcio AttestationCritical
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 container images by their cryptographic SHA256 digest (`image@sha256

Engineers MUST ALWAYS reference OCI container images by their cryptographic SHA256 digest (`image@sha256:...`) and NEVER by mutable tags (`:latest`, `:v1.0.0`) in deployment pipelines.

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 verify both the container signature and the in-toto SLSA provenance attestation (`cosign verify-attestation --type slsaprovenance`) before deploying to any production cluster.

Engineers MUST ALWAYS verify both the container signature and the in-toto SLSA provenance attestation (`cosign verify-attestation --type slsaprovenance`) before deploying to any production cluster.

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

Pipelines MUST verify the Fulcio certificate SAN identity (`--certificate-identity`) and issuer (`--certificate-oidc-issuer`) against exact expected repository workflows, preventing unauthorized builds from arbitrary CI accounts.

Pipelines MUST verify the Fulcio certificate SAN identity (`--certificate-identity`) and issuer (`--certificate-oidc-issuer`) against exact expected repository workflows, preventing unauthorized builds from arbitrary CI accounts.

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

Engineers MUST NOT allow bypass flags such as `--insecure-ignore-tlog` or `--insecure-ignore-sct` in production verification gates.

Engineers MUST NOT allow bypass flags such as `--insecure-ignore-tlog` or `--insecure-ignore-sct` in production verification gates.

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

Deployment scripts MUST fail closed

Deployment scripts MUST fail closed: any failure to resolve Rekor log proofs, missing attestation bundles, or signature mismatches must immediately terminate the deployment sequence.

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 Keyless Artifact Attestation and SLSA Level 3 Invariants critical for AI coding assistants?

Enforces immutable cryptographic provenance and SLSA Level 3 build attestation verification for all OCI container images prior to deployment. Prohibits deployment via mutable image tags and mandates verification of keyless Fulcio certificates and Rekor transparency log entries against trusted OIDC identity bounds. 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 Unverified OCI Images or Trusting Mutable Tags Without Rekor and Fulcio Attestation) 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