Codex

supply-chain-forensics

SBOM analysis, build pipeline forensics, and dependency verification covering package integrity, build reproducibility, and CI/CD pipeline tampering

104 stars

Best use case

supply-chain-forensics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

It is a strong fit for teams already working in Codex.

SBOM analysis, build pipeline forensics, and dependency verification covering package integrity, build reproducibility, and CI/CD pipeline tampering

Teams using supply-chain-forensics should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/supply-chain-forensics/SKILL.md --create-dirs "https://raw.githubusercontent.com/jmagly/aiwg/main/.agents/skills/supply-chain-forensics/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/supply-chain-forensics/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How supply-chain-forensics Compares

Feature / Agentsupply-chain-forensicsStandard Approach
Platform SupportCodexLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

SBOM analysis, build pipeline forensics, and dependency verification covering package integrity, build reproducibility, and CI/CD pipeline tampering

Which AI agents support this skill?

This skill is designed for Codex.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# supply-chain-forensics

Investigates software supply chain compromise across three vectors: dependency integrity (packages and libraries), build pipeline tampering (CI/CD systems and build scripts), and SBOM-based composition analysis. Maps findings to SLSA (Supply-chain Levels for Software Artifacts) and MITRE ATT&CK techniques for supply chain attacks.

## Triggers


Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):

- "SBOM" → Software Bill of Materials analysis
- "build pipeline audit" → supply chain security review
- "dependency confusion" → supply chain attack vector

## Purpose

Supply chain attacks compromise software before it reaches users — through malicious packages, tampered build scripts, or poisoned CI/CD pipelines. These attacks are difficult to detect because the delivered artifact may appear legitimate. This skill applies systematic verification of components and build processes to identify tampering.

## Behavior

When triggered, this skill:

1. **Identify project type and package ecosystem**:
   - Detect ecosystems from lock files and manifests: `package-lock.json`, `yarn.lock`, `Cargo.lock`, `Pipfile.lock`, `go.sum`, `Gemfile.lock`, `pom.xml`, `build.gradle`
   - Record all detected ecosystems for targeted analysis
   - Identify package manager in use: npm, pip, cargo, go mod, gem, maven, gradle

2. **SBOM generation and analysis**:
   - Generate SBOM if not present:
     - npm/Node: `npx @cyclonedx/cyclonedx-npm --output-file sbom.json`
     - Python: `cyclonedx-bom -r -o sbom.json`
     - Go: `cyclonedx-gomod mod -json -o sbom.json`
   - If SBOM already exists, validate schema compliance (CycloneDX or SPDX)
   - Count total components, direct vs transitive dependencies
   - Flag: components with no version pinning, components with no identified license, components with known CVEs (cross-reference against OSV.dev if network available)

3. **Dependency integrity verification**:
   - npm: compare `package-lock.json` `integrity` (sha512) fields against registry-published hashes
     ```bash
     npm audit --json 2>/dev/null | jq '.vulnerabilities | keys[]'
     ```
   - pip: verify hashes in `Pipfile.lock` against PyPI:
     ```bash
     pip hash --algorithm sha256 <package>.whl
     ```
   - Go: verify `go.sum` entries against module proxy checksums:
     ```bash
     go mod verify
     ```
   - Cargo: `cargo verify-project` and check `Cargo.lock` hash fields
   - Flag any dependency where the recorded hash does not match the current registry value (typosquatting or package substitution indicator)

4. **Typosquatting and dependency confusion detection**:
   - Check for packages with names similar to popular packages (Levenshtein distance <= 2)
   - Check for internal package names that also exist on public registries (dependency confusion vector)
   - Flag packages with very high version numbers (confusion attack often uses high semver to win resolution)
   - Flag packages published by single-user accounts with no prior history

5. **Build script analysis**:
   - Locate build scripts: `Makefile`, `build.sh`, `.github/workflows/`, `.gitlab-ci.yml`, `Jenkinsfile`, `azure-pipelines.yml`, `buildkite.yml`
   - Scan for: inline base64-encoded payloads, `curl | sh` patterns, outbound network calls during build
     ```bash
     grep -rE 'curl.*(sh|bash)|wget.*sh|base64.*decode|eval.*\$\(' .github/workflows/
     ```
   - Check for pinned action versions (SHA vs tag): unpinned tags can be silently replaced
   - Identify steps that write to artifact directories after the build verification step

6. **CI/CD pipeline tampering indicators**:
   - Compare current workflow files against git history: `git log --oneline -- .github/workflows/`
   - Identify workflow changes made by accounts other than core maintainers
   - Check for workflow files added in dependency branches or PRs from forks with write access
   - Review secrets usage: identify workflows that access secrets but are triggerable by external contributors
   - Flag `pull_request_target` triggers with checkout of untrusted code — common privilege escalation vector

7. **Build reproducibility check**:
   - Identify artifacts for which the build is declared reproducible
   - For npm packages: use `reprotest` or manual rebuild and hash comparison
   - Check for embedded timestamps, random salts, or non-deterministic ordering in build output
   - Compare artifact hash against published hash in package registry
   - Record: reproducibility claim, verification result, variance source if not reproducible

8. **SLSA level assessment**:
   - Level 1: Build process is scripted (automated, not manual)
   - Level 2: Build service generates provenance; source is version-controlled
   - Level 3: Build runs in an isolated environment; provenance is signed
   - Level 4: Reproducible builds; two-party review for all changes
   - Report achieved SLSA level and gaps to next level

9. **Write findings document**:
    - Save to `.aiwg/forensics/findings/supply-chain-forensics.md`
    - Sections: SBOM summary, integrity failures, typosquatting risks, build script anomalies, pipeline tampering indicators, SLSA assessment, remediation recommendations

## Usage Examples

### Example 1 — Full supply chain audit
```
supply chain forensics
```
Runs against the current working directory.

### Example 2 — SBOM analysis only
```
sbom analysis ./sbom.json
```

### Example 3 — Dependency audit for specific ecosystem
```
dependency audit --ecosystem npm
```

### Example 4 — CI/CD pipeline investigation
```
build pipeline investigation .github/workflows/
```

## Output Locations

- Findings: `.aiwg/forensics/findings/supply-chain-forensics.md`
- Generated SBOM: `.aiwg/forensics/evidence/sbom.json`
- Integrity report: `.aiwg/forensics/evidence/dependency-integrity.txt`

## Configuration

```yaml
supply_chain_forensics:
  sbom_format: cyclonedx
  sbom_version: "1.5"
  typosquatting_distance: 2
  check_osv: true
  check_reproducibility: true
  slsa_assessment: true
  pinned_action_check: true
  high_risk_patterns:
    - "curl.*|.*sh"
    - "wget.*sh"
    - "base64.*-d.*|.*sh"
    - "eval.*\\$\\("
    - "pull_request_target"
```

## References

- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/rules/research-before-decision.md — Identify package ecosystems and build pipeline from lock files before starting analysis
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/evidence-integrity.md — Do not run build scripts during investigation; analyze artifacts read-only to avoid triggering payloads
- @$AIWG_ROOT/agentic/code/addons/aiwg-utils/rules/human-authorization.md — Report integrity failures and tampering indicators; await human decision before blocking or removing dependencies
- @$AIWG_ROOT/agentic/code/frameworks/forensics-complete/rules/red-flag-escalation.md — Escalate immediately when dependency hash mismatches or CI/CD script injection is confirmed
- @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/rules/token-security.md — Supply chain audit checks for secrets in build pipelines; this rule defines what constitutes a violation

Related Skills

memory-forensics

104
from jmagly/aiwg

Volatility 3 memory forensics workflows covering acquisition with LiME and WinPmem, and structured analysis using Volatility 3 plugin reference

Codex

linux-forensics

104
from jmagly/aiwg

Generalized Linux incident response and forensic analysis covering Debian/Ubuntu, RHEL/CentOS/Rocky, and SUSE families

Codex

forensics-triage

104
from jmagly/aiwg

Quick triage investigation following RFC 3227 volatility order

Codex

forensics-timeline

104
from jmagly/aiwg

Build correlated event timeline from multiple sources

Codex

forensics-status

104
from jmagly/aiwg

Show investigation status dashboard

Codex

forensics-report

104
from jmagly/aiwg

Generate forensic investigation report

Codex

forensics-profile

104
from jmagly/aiwg

Build target system profile via SSH or cloud API enumeration

Codex

forensics-ioc

104
from jmagly/aiwg

Extract and enrich indicators of compromise

Codex

forensics-investigate

104
from jmagly/aiwg

Full multi-agent investigation workflow

Codex

forensics-hunt

104
from jmagly/aiwg

Threat hunt using Sigma rules against log sources

Codex

forensics-acquire

104
from jmagly/aiwg

Evidence acquisition with chain of custody and hash verification

Codex

container-forensics

104
from jmagly/aiwg

Docker, containerd/CRI-O, and Kubernetes forensic investigation covering container inventory (docker and crictl), privilege checks, image verification, layer analysis (dive), escape detection, eBPF runtime monitoring (Falco, Tetragon, Tracee), K8s RBAC audit, etcd security audit, and API server audit log analysis

Codex