This specification is maintained by the AgentRules Working Group. Have enhancements or want to claim maintainership?Submit Specification →
securityhigh PriorityID: supply-chain-sbom-security

Software Supply Chain Security & Dependency Pinning Standard

Modern supply chain hardening against malicious package injection and typosquatting. Mandates strict dependency pinning (no wildcard ranges), reproducible lockfiles, CI automated vulnerability scanning, and CycloneDX SBOM generation.

Prohibited Anti-Pattern: AI leaves open wildcard ranges in package.json/pyproject.toml and ignores supply chain verification in CI.

Export Ready-to-Drop Configuration

Select format below to copy code or download file directly.

---
description: Software Supply Chain Security & Dependency Pinning Standard - Modern supply chain hardening against malicious package injection and typosquatting. Mandates strict dependency pinning (no wildcard ranges), reproducible lockfiles, CI automated vulnerability scanning, and CycloneDX SBOM generation.
globs: package.json, pnpm-lock.yaml, requirements.txt, .github/workflows/*.yaml
alwaysApply: false
verified_by: "agentrules.org"
license: "CC-BY-4.0"
source: "https://agentrules.org/rules/supply-chain-sbom-security"
---

# Software Supply Chain Security & Dependency Pinning Standard

> **Severity**: HIGH | **Category**: security
> **Anti-Pattern Warning**: AI leaves open wildcard ranges in package.json/pyproject.toml and ignores supply chain verification in CI.

## System Constraints
You are a software supply chain security architect. Never suggest loose wildcard version ranges (^, ~, *) in package manifests. Always enforce exact version pinning, require cryptographic lockfiles, configure automated audit gates in CI, and generate CycloneDX/SPDX Software Bill of Materials (SBOM).

## Strict Guidelines
- Enforce strict version pinning in production dependencies; avoid open ranges (^ and ~) for critical runtime packages.
- Always commit lockfiles (pnpm-lock.yaml, package-lock.json, poetry.lock) to version control and run `pnpm install --frozen-lockfile` in CI.
- Add automated vulnerability scanning gates in GitHub Actions (`pnpm audit --audit-level=high` or Trivy).
- Generate automated CycloneDX or SPDX Software Bill of Materials (SBOM) during release packaging.

## Bad vs Good Implementations
### CI Supply Chain Audit & SBOM Generation vs Unverified Dependency Builds

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: npm install without --frozen-lockfile installs updated minor/patch versions, exposing the build to zero-day supply chain malware.
```yaml
# ANTI-PATTERN: Running unpinned npm install in CI
steps:
  - uses: actions/checkout@v4
  # CRITICAL FLAW: npm install mutates lockfile and accepts compromised upstream minor versions!
  - run: npm install
  - run: npm run build
```

#### Production Standard (Correct)
> **Standard**: Guarantees reproducible byte-identical builds, prevents installation of compromised minor versions, and generates standard SBOM compliance artifacts.
```yaml
# PRODUCTION STANDARD: Frozen Lockfile, Audit Gate & SBOM Pipeline
name: Supply Chain Hardening
on: [push, pull_request]

jobs:
  security-audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v3
        with:
          version: 9

      # 1. Deterministic install using exact frozen lockfile
      - run: pnpm install --frozen-lockfile

      # 2. Block build on High/Critical known CVE vulnerabilities
      - name: Vulnerability Audit
        run: pnpm audit --audit-level=high

      # 3. Generate CycloneDX Software Bill of Materials (SBOM)
      - name: Generate CycloneDX SBOM
        run: npx @cyclonedx/cyclonedx-npm --output-file bom.json

      - name: Upload SBOM Artifact
        uses: actions/upload-artifact@v4
        with:
          name: software-bill-of-materials
          path: bom.json
```

### Exact Dependency Pinning in package.json

#### Bad Antipattern (AI Common Hallucination)
> **Why it fails**: Wildcards install untested upstream releases without peer review.
```json
// ANTI-PATTERN: Open caret and tilde ranges
{
  "dependencies": {
    "next": "^15.0.0",
    "react": "*"
  }
}
```

#### Production Standard (Correct)
> **Standard**: Exact pinning prevents surprise breaking changes or poisoned patch releases from crashing production.
```json
// PRODUCTION STANDARD: Exact pinned versions
{
  "dependencies": {
    "next": "15.0.3",
    "react": "19.0.0"
  }
}
```

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: Software Supply Chain Security & Dependency Pinning Standard

Software Supply Chain Security & Dependency Pinning Standard defines an industrial-grade behavioral standard for security engineering. Modern supply chain hardening against malicious package injection and typosquatting. Mandates strict dependency pinning (no wildcard ranges), reproducible lockfiles, CI automated vulnerability scanning, and CycloneDX SBOM generation. 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: AI leaves open wildcard ranges in package.json/pyproject.toml and ignores supply chain verification in CI. 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 DriftAI leaves open wildcard ranges in package.json/pyproject.toml and ignores supply chain verification in CI.High
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

Enforce strict version pinning in production dependencies

Enforce strict version pinning in production dependencies; avoid open ranges (^ and ~) for critical runtime packages.

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

Always commit lockfiles (pnpm-lock.yaml, package-lock.json, poetry.lock) to version control and run `pnpm install --frozen-lockfile` in CI.

Always commit lockfiles (pnpm-lock.yaml, package-lock.json, poetry.lock) to version control and run `pnpm install --frozen-lockfile` in CI.

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

Add automated vulnerability scanning gates in GitHub Actions (`pnpm audit --audit-level=high` or Trivy).

Add automated vulnerability scanning gates in GitHub Actions (`pnpm audit --audit-level=high` or Trivy).

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

Generate automated CycloneDX or SPDX Software Bill of Materials (SBOM) during release packaging.

Generate automated CycloneDX or SPDX Software Bill of Materials (SBOM) during release packaging.

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 Software Supply Chain Security & Dependency Pinning Standard critical for AI coding assistants?

Modern supply chain hardening against malicious package injection and typosquatting. Mandates strict dependency pinning (no wildcard ranges), reproducible lockfiles, CI automated vulnerability scanning, and CycloneDX SBOM generation. 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 (AI leaves open wildcard ranges in package.json/pyproject.toml and ignores supply chain verification in CI.) 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

Software