This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
devopscritical PriorityID: slsa-l4-hermetic-keyless-signature-guardrail

SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant

Enforces strict SLSA Build Level 3/4 compliance by mandating network-isolated, hermetic compilation pipelines and non-forgeable provenance. Replaces persistent build-agent credentials and static signing keys with OIDC-federated ephemeral Fulcio certificates, Rekor transparency log attestations, and cryptographic container digest immutability.

Prohibited Anti-Pattern: Non-Hermetic Runtime Ingestion with Static Long-Lived Cryptographic Signing Keys

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant - Enforces strict SLSA Build Level 3/4 compliance by mandating network-isolated, hermetic compilation pipelines and non-forgeable provenance. Replaces persistent build-agent credentials and static signing keys with OIDC-federated ephemeral Fulcio certificates, Rekor transparency log attestations, and cryptographic container digest immutability.
globs: .github/workflows/**/*.{yml,yaml}, build/Dockerfile*, deploy/**/*.{yml,yaml}, Tiltfile, skaffold.yaml
alwaysApply: true
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/slsa-l4-hermetic-keyless-signature-guardrail"
---

# SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant

> **Severity**: CRITICAL | **Category**: devops
> **Anti-Pattern Warning**: Non-Hermetic Runtime Ingestion with Static Long-Lived Cryptographic Signing Keys

## System Constraints
You are a Principal Security Architect enforcing SLSA Level 4 build hermeticity and Sigstore keyless attestation invariants. You must prevent dynamic external dependency fetching during compilation, prohibit long-lived static private keys in CI environments, and ensure all build artifacts are cryptographically signed using OIDC identity tokens, Fulcio-issued short-lived certificates, and verifiable Rekor transparency log entries.

## Strict Guidelines
- Engineers MUST ALWAYS isolate compile stages using hermetic build containers with external network egress disabled (e.g., BuildKit network=none or Nix sandbox).
- Engineers MUST ALWAYS sign build artifacts and container images using Cosign keyless mode backed by ambient OIDC identity tokens and Fulcio certificates.
- Engineers MUST ALWAYS verify cryptographic digests against Rekor public transparency log entries before image promotion or deployment.
- Engineers MUST NOT introduce long-lived GPG/RSA signing keys, AWS IAM static secrets, or static GitHub deployment secrets for artifact signing.
- Build definitions MUST lock all intermediate dependencies using cryptographic content hashes (SHA-256 digests), completely disallowing floating tags, unpinned git revisions, or dynamic remote URLs.
- Admission controllers and deployment pipelines MUST reject any image or binary that lacks in-toto SLSA provenance signed by verified OIDC issuer identities.

## Bad vs Good Implementations
### GitHub Actions Build and Signing Pipeline

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Fetches dependencies during an unconstrained network build, uses mutable tags (:latest), relies on compromised-prone static long-lived private keys stored in CI secrets, and fails to register entries in an append-only transparency log.
```yaml
# Non-hermetic build with floating tags and static signing keys
name: Build & Sign
on: [push]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: |
          docker build -t registry.corp.internal/app:latest .
          docker push registry.corp.internal/app:latest
      - name: Sign Image with Static Key
        env:
          COSIGN_PRIVATE_KEY: ${{ secrets.STATIC_COSIGN_KEY }}
          COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
        run: |
          cosign sign --key env://COSIGN_PRIVATE_KEY registry.corp.internal/app:latest
```

#### Production Standard (Correct)
> **Standard**: Leverages ambient OIDC federation (id-token: write), enforces network-isolated compilation (--network=none), uses immutable SHA-256 digests, and generates keyless signatures via Fulcio and Rekor.
```yaml
# Hermetic container build with keyless Sigstore attestation and SLSA provenance
name: Build & Sign
on:
  push:
    branches: [main]
permissions:
  contents: read
  id-token: write
  packages: write
jobs:
  build-and-sign:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
      - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
      - name: Build Artifact Hermetically
        uses: docker/build-push-action@4a13e500e05cf64e7086fac7a77e68e0a133405c # v5.1.0
        with:
          context: .
          push: true
          tags: ghcr.io/org/app@sha256:d8123bf01a3cfb5f6a9782559b15d97ec15d8d21b7987a932d4314c1eb3dfc58
          provenance: mode=max
          sbom: true
          extra-args: --network=none
      - uses: sigstore/cosign-installer@9614fae9e5c5eddabb09f90a270fcb487c9f7149 # v3.3.0
      - name: Keyless Sign with Fulcio & Rekor
        run: |
          cosign sign --yes \
            --identity-provider=github \
            ghcr.io/org/app@sha256:d8123bf01a3cfb5f6a9782559b15d97ec15d8d21b7987a932d4314c1eb3dfc58
```

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: SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant

SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant defines an industrial-grade behavioral standard for devops engineering. Enforces strict SLSA Build Level 3/4 compliance by mandating network-isolated, hermetic compilation pipelines and non-forgeable provenance. Replaces persistent build-agent credentials and static signing keys with OIDC-federated ephemeral Fulcio certificates, Rekor transparency log attestations, and cryptographic container digest immutability. 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: Non-Hermetic Runtime Ingestion with Static Long-Lived Cryptographic Signing Keys 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 DriftNon-Hermetic Runtime Ingestion with Static Long-Lived Cryptographic Signing KeysCritical
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 isolate compile stages using hermetic build containers with external network egress disabled (e.g., BuildKit network=none or Nix sandbox).

Engineers MUST ALWAYS isolate compile stages using hermetic build containers with external network egress disabled (e.g., BuildKit network=none or Nix sandbox).

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 sign build artifacts and container images using Cosign keyless mode backed by ambient OIDC identity tokens and Fulcio certificates.

Engineers MUST ALWAYS sign build artifacts and container images using Cosign keyless mode backed by ambient OIDC identity tokens and Fulcio certificates.

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 ALWAYS verify cryptographic digests against Rekor public transparency log entries before image promotion or deployment.

Engineers MUST ALWAYS verify cryptographic digests against Rekor public transparency log entries before image promotion or deployment.

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 introduce long-lived GPG/RSA signing keys, AWS IAM static secrets, or static GitHub deployment secrets for artifact signing.

Engineers MUST NOT introduce long-lived GPG/RSA signing keys, AWS IAM static secrets, or static GitHub deployment secrets for artifact signing.

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

Build definitions MUST lock all intermediate dependencies using cryptographic content hashes (SHA-256 digests), completely disallowing floating tags, unpinned git revisions, or dynamic remote URLs.

Build definitions MUST lock all intermediate dependencies using cryptographic content hashes (SHA-256 digests), completely disallowing floating tags, unpinned git revisions, or dynamic remote URLs.

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

Admission controllers and deployment pipelines MUST reject any image or binary that lacks in-toto SLSA provenance signed by verified OIDC issuer identities.

Admission controllers and deployment pipelines MUST reject any image or binary that lacks in-toto SLSA provenance signed by verified OIDC issuer identities.

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 SLSA Level 4 Hermetic Build and Keyless Ephemeral Signature Invariant critical for AI coding assistants?

Enforces strict SLSA Build Level 3/4 compliance by mandating network-isolated, hermetic compilation pipelines and non-forgeable provenance. Replaces persistent build-agent credentials and static signing keys with OIDC-federated ephemeral Fulcio certificates, Rekor transparency log attestations, and cryptographic container digest immutability. 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 (Non-Hermetic Runtime Ingestion with Static Long-Lived Cryptographic Signing Keys) 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

SLSA