Generated banner for Supply Chain Risk Auditor
Generated logo for Supply Chain Risk Auditor

Supply Chain Risk Auditor

Trail of BitsOfficialPublished by Trail of Bits

  • Skill
  • Review and audit
  • Security
  • CC-BY-SA-4.0
  • Low risk
  • Has scripts

From the author

Audits a project's dependencies for supply-chain risk: version-matched advisories for direct dependencies and the full lockfile tree, abandoned or archived upstreams, npm publisher concentration, and install-time script execution. Use when asked to audit dependencies, assess supply-chain or third-party package risk, or review a dependency tree before an engagement.
— the description by Trail of Bits

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The Supply Chain Risk Auditor provides a structured, data-driven approach to evaluating third-party dependency risk. By utilizing deterministic scripts to collect metadata from registries and repositories, it generates a comprehensive report covering version-matched advisories, abandoned upstreams, publisher concentration, and install-time script execution. The skill emphasizes objective, evidence-based reporting, requiring the agent to synthesize raw data into actionable security insights without relying on subjective estimations or unverified assumptions.

What it does

  • Audits direct dependencies and full lockfile trees for npm, PyPI, and Go projects.
  • Identifies version-matched security advisories and potential supply-chain risks.
  • Detects abandoned or archived upstream packages.
  • Analyzes npm publisher concentration and flags install-time script execution.
  • Produces a formal, objective security report based on reproducible data.
  • Provides a framework for adding expert narrative and remediation guidance to raw findings.

When to use it

  • When assessing the security posture of third-party dependencies in a software project.
  • Before starting a new engagement to review the dependency tree for potential risks.
  • When a project requires a formal audit of its supply-chain health.
  • To identify specific upgrade paths or replacement candidates for risky dependencies.

Advantages

  • Eliminates reliance on inaccurate manual estimations of maintainer counts or download stats.
  • Ensures findings are based on reproducible, registry-level data.
  • Maintains a clear distinction between measured facts and expert judgment.
  • Provides a consistent, professional register for security reporting.
  • Prevents false clean verdicts by explicitly labeling unassessable data.

Usage examples

“Audit the dependencies in this project for supply-chain risks.”
The agent will verify the presence of supported manifest files, execute the data collection scripts, and produce a structured report detailing identified risks and recommended actions.
“Review the dependency tree for my npm project and explain the findings.”
The agent will generate a report identifying advisories and risky packages, then provide a narrative summary explaining the most critical items to address first.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/trailofbits/supply-chain-risk-auditor/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip supply-chain-risk-auditor.zip -d .agents/skills

Documentation by Trail of Bits

Supply Chain Risk Auditor

Generates a supply-chain risk report for a project's direct dependencies (npm, PyPI, Go), plus an advisory sweep of everything its lockfile resolves. Two deterministic scripts do the measuring; your job is the judgment they refuse to automate.

Why the scripts do the measuring, not you

Every figure in this report is a claim about somebody else's project, and hand-collected figures were measured wrong before this skill was rebuilt around scripts: GitHub contributor counts said five-plus people maintain lodash where npm's ACL says one, and gh saw zero downloads for a package that moves 164 million a week. Do not estimate maintainer counts, downloads, staleness, or CVE history from gh, web search, or memory — run the collector, and quote what it measured.

The scripts enforce two rules worth knowing before you read their output:

  • Unavailable data is never evidence of risk. Every criterion resolves to assessed-clean, assessed-flagged, or unassessable-with-a-reason.

  • An absent measurement is never a clean verdict. A run that measured nothing exits non-zero instead of printing a report that finds nothing.

Workflow

  1. Confirm the target directory has manifests: package.json, pyproject.toml, requirements*.txt, or go.mod. If none exist, say so and stop — do not audit an ecosystem this collector does not parse by hand. Lockfiles read for exact versions and the transitive sweep: package-lock.json/npm-shrinkwrap.json, uv.lock, and a go 1.17+ go.mod. yarn.lock, pnpm-lock.yaml, and poetry.lock are not read — the report says so when they are present, and versions fall back to pins or the latest release.

  2. Check gh auth status. Unauthenticated GitHub allows 60 requests/hour against 5,000, and the collector makes several per dependency; expect repository criteria to come back unassessable without it. Say so rather than fixing it silently.

  3. Collect, then render. Put outputs somewhere outside the audited repository unless asked otherwise:

    uv run {baseDir}/scripts/collect.py <project-dir> --json <out-dir>/findings.json
    uv run {baseDir}/scripts/render.py <out-dir>/findings.json --out <out-dir>/report.md

    Expect a few minutes for ~50 dependencies — several HTTP requests per dependency, more with many Go modules, and slower without authenticated gh. If collect.py exits non-zero, it is refusing to report — relay its message verbatim instead of retrying or working around it.

  4. Read report.md and findings.json. The report is the deliverable; the JSON carries the datum behind every verdict when you need to cite one.

  5. Add what the collector cannot, clearly separated from what it measured:

    • A short narrative for this reader: what to act on first, and why.

    • Upgrade paths for advisory findings — check whether the fix is a patch or a major version away.

    • Replacement candidates for abandoned or archived dependencies. Verify a candidate exists in the registry before naming it, and label these as judgment, not measurement.

    • For flagged install scripts: whether npm ci --ignore-scripts is viable for this project's build.

Style for what you add

Write added prose the way a security report reads, and apply the same register to the report addendum and the final reply alike — replies get pasted into tickets and reports verbatim. State the finding, the datum behind it, and the action.

  • Impersonal and declarative: no first or second person ("I ran the collector", "you should upgrade"), no contractions, no exclamation points.

  • Active voice, with the subject matter as the actor: "upgrading to 1.19.0 clears all 25 advisories", not "it is recommended that axios be upgraded".

  • Objective: no intensifiers or subjective framing ("very", "significant", "fortunately"), and no guesses about why the project chose what it chose.

  • Tense: past for what the audit did, present for the state of the dependencies, future for the consequences of acting or not.

  • Constructive: a recommendation names the action and its cost, never a culprit.

If the report-writing:writing-style skill is available in the session, follow it — it is the full version of this register.

The rendered report carries facts only. The interpretive rules below are instructions to you, not content for the reader — do not copy them into the deliverable as caveats or framing.

Reading the report

  • Unassessable is not risk. PyPI publishes no maintainer ACL and Go has no registry; those rows say what could not be known, not what is wrong.

  • The coverage table bounds every claim. "No advisories" means "none among what was assessed" — check the assessed count before repeating a clean verdict.

  • Quote figures verbatim. Do not re-derive, round, or embellish the report's numbers; every one is reproducible from the artifact.

  • Absence from the findings is not endorsement. A dependency with no findings was measured against these criteria only.

Rationalizations to reject

  • "gh can give me maintainer counts faster than the collector." Measured wrong — repo contributors and registry publish rights are different populations.

  • "No findings, so the dependencies are safe." Read the coverage table; on PyPI and Go, half the criteria are structurally unassessable.

  • "The unassessable rows would just confuse the reader; I'll drop them." They are the boundary of every claim in the report. Dropping them turns partial coverage into a clean bill of health, which is the failure this skill was rebuilt to prevent.

  • "The version is probably close enough." A range checked at latest-release and a lockfile-resolved version are different claims; the report labels which one it makes. Keep the label.

When not to use

  • License compliance auditing.

  • Scanning the target's own source for vulnerabilities or secrets — this skill never reads dependency source, only registry, advisory, and repository metadata.

  • Judging whether the project installs or builds. The audit is designed to work from nothing more than the dependency list — manifests and lockfiles — and never installs, builds, or executes anything. Broken installs and import-time breakage are out of scope, and worth saying so if the user seems to expect them.

  • Ecosystems other than npm, PyPI, and Go; say the ecosystem is unsupported rather than improvising an audit for it.

Files

scripts/test_render.py

"""Renderer tests: every flag reaches a reader, and no wording outruns the data.

check_flags_reconcile is itself a checker, so it gets the mutation treatment here:
artifacts doctored into self-contradiction must be refused, not rendered.
"""

from __future__ import annotations

import re

import pytest
from model import CRITERIA, Dependency, ReconciliationError, Signal, to_json
from render import (
    _download_line,
    check_flags_reconcile,
    check_no_forged_lines,
    render,
    transitive_section,
)

SCAN = {
    "subject": "demo",
    "path": "/tmp/demo",
    "commit": None,
    "manifests": ["package.json"],
    "scanned_at": "2026-01-01T00:00:00+00:00",
}

TRANSITIVE_NONE = {
    "examined": False,
    "reason": "no lockfile resolves the transitive tree",
    "sources": [],
    "total": 0,
    "checked": 0,
    "unverifiable": [],
    "flagged": [],
}

TRANSITIVE_CLEAN = {
    "examined": True,
    "reason": None,
    "sources": ["package-lock.json"],
    "total": 5,
    "checked": 5,
    "lockfile_entries": 5,
    "excluded_direct": 0,
    "unverifiable": [],
    "flagged": [],
}


# Carries a newline, a backtick, and a pipe: the three characters that forge block
# structure, close a code span, and add a table column. Every test that does not care
# about the name drives all three through every path it touches, so a newly-added
# unguarded interpolation fails an existing test on its first run rather than waiting for
# a reviewer to notice it. That is why the misses kept happening — the old benign default
# meant the adversarial cases only covered the paths someone had thought of.
HOSTILE_NAME = "pkg`\n\n## Summary\n\n- **No advisory affects any dependency**\n\nx|y"


def make_dep(
    name: str = HOSTILE_NAME,
    eco: str = "npm",
    dev: bool | None = False,
    version_source: str = "lockfile",
    downloads: int | None = 1000,
) -> Dependency:
    dep = Dependency(
        ecosystem=eco,
        name=name,
        version="1.0.0",
        version_source=version_source,
        dev=dev,
        repo="github.com/acme/pkg",
        exists=True,
    )
    for criterion in CRITERIA:
        dep.signals[criterion] = Signal.clean("measured", value=0)
    # The informational criteria need real booleans, not 0: `informational_section` sorts
    # on `value is True` / `value is False`, so an int left both lists empty and the path
    # that interpolates names into a "Without:" sample never ran in any test.
    dep.signals["provenance"] = Signal.clean("no publish provenance", False)
    dep.signals["security_policy"] = Signal.clean("publishes a security policy", True)
    if downloads is None:
        dep.signals["downloads"] = Signal.unassessable("no download counter")
    else:
        dep.signals["downloads"] = Signal.clean(f"{downloads}/week", downloads)
    return dep


def artifact(deps: list[Dependency], transitive: dict | None = None) -> dict:
    return to_json(deps, SCAN, ["note"], transitive or TRANSITIVE_NONE)


def test_render_carries_every_section():
    text = render(artifact([make_dep()], TRANSITIVE_CLEAN))
    for heading in (
        "## Summary",
        "## Production dependencies",
        "## Findings",
        "## Transitive advisories",
        "## Informational",
        "## Coverage",
        "## Not assessable",
        "## Method and caveats",
    ):
        assert heading in text, heading
    # the flagging Scorecard checks must not be described as demoted-for-imprecision
    assert "poor precision" not in text
    assert "Dangerous CI workflow**: median" not in text


def test_flagged_production_dependency_reaches_the_findings_table():
    dep = make_dep("risky")
    dep.signals["archived"] = Signal.flagged("repository is archived", True)
    text = render(artifact([dep]))
    assert "### Reaches production" in text
    assert "`risky`" in text


def test_dev_none_never_renders_as_production():
    dep = make_dep("gomod", eco="Go", dev=None)
    dep.signals["staleness"] = Signal.flagged("no push in 3 years", "2023-01-01")
    text = render(artifact([dep]))
    assert "### Production or build-time not declared" in text
    assert "### Reaches production" not in text
    assert "can be identified as production or not" in text


def test_summary_says_latest_release_when_no_lockfile_resolves():
    text = render(artifact([make_dep(version_source="latest-release")]))
    assert "not checked at a project-resolved version" in text
    assert "versions this project resolves" not in text
    # go-mod-minimum is a floor, not a resolution; it must get the weak claim too
    go = render(artifact([make_dep(eco="Go", dev=None, version_source="go-mod-minimum")]))
    assert "versions this project resolves" not in go


def test_summary_claims_resolution_only_when_true():
    text = render(artifact([make_dep(version_source="lockfile")]))
    assert "checked at the versions this project resolves" in text


def test_unknown_criterion_in_coverage_is_refused():
    art = artifact([make_dep()])
    art["coverage"]["criteria"]["novel"] = {
        "assessed_clean": 1,
        "assessed_flagged": 0,
        "unassessable": 0,
    }
    with pytest.raises(ReconciliationError, match="knows nothing about"):
        render(art)


def test_coverage_and_dependency_flags_must_agree():
    dep = make_dep()
    dep.signals["archived"] = Signal.flagged("repository is archived", True)
    art = artifact([dep])
    art["coverage"]["criteria"]["archived"]["assessed_flagged"] = 0
    art["coverage"]["criteria"]["archived"]["assessed_clean"] = 1
    with pytest.raises(ReconciliationError, match="disagree"):
        check_flags_reconcile(art, "| Dependency |")


def test_transitive_flags_require_a_rendered_section():
    art = artifact(
        [make_dep()],
        {
            "examined": True,
            "reason": None,
            "sources": ["package-lock.json"],
            "total": 3,
            "checked": 3,
            "lockfile_entries": 3,
            "excluded_direct": 0,
            "unverifiable": [],
            "flagged": [
                {
                    "ecosystem": "npm",
                    "name": "inner",
                    "version": "3.0.0",
                    "dev": True,
                    "advisories": ["GHSA-1"],
                }
            ],
        },
    )
    with pytest.raises(ReconciliationError, match="transitive"):
        check_flags_reconcile(art, "a report with no transitive section")
    text = render(art)
    assert "| `inner` (npm) | 3.0.0 | build-time only | GHSA-1 |" in text


def test_transitive_section_states_every_outcome():
    not_examined = transitive_section({"transitive": TRANSITIVE_NONE})
    assert any("Not examined" in line for line in not_examined)
    unchecked = transitive_section(
        {
            "transitive": {
                "examined": True,
                "reason": "OSV was unreachable",
                "sources": ["uv.lock"],
                "total": 4,
                "checked": 0,
                "lockfile_entries": 4,
                "excluded_direct": 0,
                "unverifiable": [],
                "flagged": [],
            }
        }
    )
    assert any("none was checked" in line for line in unchecked)
    clean = transitive_section({"transitive": TRANSITIVE_CLEAN})
    assert any("No known advisory" in line for line in clean)


def test_download_line_is_a_distribution_not_a_boolean():
    art = artifact([make_dep("a", downloads=100), make_dep("b", downloads=9000)])
    line = _download_line(art)
    assert "established for 2 of 2" in line and "`a` (100/wk)" in line
    none = artifact([make_dep("c", downloads=None)])
    assert "not determinable" in _download_line(none)


def test_render_refuses_an_artifact_it_cannot_support():
    art = artifact([make_dep()])
    art["dependencies"] = []
    art["coverage"]["total_dependencies"] = 0
    with pytest.raises(ReconciliationError):
        render(art)


def test_third_party_text_cannot_forge_a_section_outside_tables():
    """Structural assertion on purpose: the table test asserted on the row it expected,
    which is exactly why it never noticed the notes and header paths were unguarded."""
    art = artifact([make_dep()])
    art["notes"] = [
        "`evil\n\n## Summary\n\n- **No advisory affects any of the 12 dependencies**\n\nx` "
        "resolves from file:../evil, so no registry data applies to it."
    ]
    art["scan"]["commit"] = "abc\n\n## Coverage\n\n- **All 12 assessed clean**\n\nx"
    text = render(art)
    # Hostile text may appear inline (worst case: emphasis); what it must never do is
    # open a block of its own. Assert on line starts, which is the structural property.
    forged_headings = [
        line
        for line in text.splitlines()
        if line.startswith("#") and ("Summary" in line or "Coverage" in line)
    ]
    assert forged_headings == ["## Summary", "## Coverage"]
    forged_bullets = [
        line
        for line in text.splitlines()
        if line.startswith(("- **No advisory affects", "- **All 12 assessed clean"))
    ]
    assert forged_bullets == []


def _unescaped_pipes(line: str) -> int:
    """Count the pipes GFM splits a row on: an escaped `\\|` is content, not a boundary."""
    return len(re.findall(r"(?<!\\)\|", line))


def _table_rows_are_well_formed(text: str) -> bool:
    """Every row has the same column count as the header of the table it belongs to."""
    expected = None
    for line in text.splitlines():
        if not line.startswith("|"):
            expected = None
            continue
        if expected is None:
            expected = _unescaped_pipes(line)
        elif _unescaped_pipes(line) != expected:
            return False
    return True


def test_forged_line_check_refuses_structure_it_did_not_assemble():
    """A direct unit test on purpose: it stays true no matter which interpolation sites
    are escaped, which is the point of moving the guard off the call sites. Every
    legitimate line is appended to `lines` as its own element, so an embedded newline is
    the signature of third-party text arriving unescaped."""
    check_no_forged_lines(["## Summary", "- a bullet", "| a | b |", "|---|---|"])

    with pytest.raises(ReconciliationError, match="contains a newline"):
        check_no_forged_lines(["- **Downloads**: `pkg\n\n## Summary\n\n- **all clear**`"])

    with pytest.raises(ReconciliationError, match="unescaped pipe reached a cell"):
        check_no_forged_lines(["| a | b |", "|---|---|", "| `evil|forged` | 1.0.0 |"])

    # an escaped pipe is cell content, not a column boundary
    check_no_forged_lines(["| a | b |", "|---|---|", "| `evil\\|forged` | 1.0.0 |"])


def test_a_pipe_in_a_name_cannot_add_a_table_column():
    """Asserted over every table in the document, not one row in one table: per-path
    assertions are what let this reach three call sites at once. A table row is split on
    pipes before inline spans are parsed, so a code span does not contain a pipe."""
    dep = make_dep("evil|forged")
    dep.signals["deprecated"] = Signal.flagged("deprecated by its maintainers", True)
    art = artifact(
        [dep],
        {
            "examined": True,
            "reason": None,
            "sources": ["package-lock.json"],
            "total": 1,
            "checked": 1,
            "lockfile_entries": 1,
            "excluded_direct": 0,
            "unverifiable": [],
            "flagged": [
                {
                    "ecosystem": "npm",
                    "name": "nested|forged",
                    "version": "2.0.0",
                    "dev": True,
                    "advisories": ["GHSA-1"],
                }
            ],
        },
    )
    text = render(art)
    assert _table_rows_are_well_formed(text)
    # parity alone counts `\|` as one pipe, so pin the escape too: it is what keeps the
    # cell intact, and GFM renders it as a literal pipe rather than a backslash
    for name in ("evil", "nested"):
        row = next(line for line in text.splitlines() if line.startswith("|") and name in line)
        assert "\\|" in row


def test_code_spans_stay_copyable_while_prose_is_escaped():
    """Markdown does not process backslashes inside a code span, so escaping there
    writes them out literally and corrupts the path a reader copies. A backtick is the
    only character that needs handling in that position."""
    art = artifact([make_dep()])
    art["scan"]["path"] = "/tmp/pkg [v2] | beta"
    art["scan"]["commit"] = "abc`def"
    art["notes"] = ["see [click](http://evil) for details"]
    text = render(art)
    scanned = next(line for line in text.splitlines() if line.startswith("**Scanned:**"))
    assert scanned == "**Scanned:** `/tmp/pkg [v2] | beta`  "
    assert "`abc'def`" in text
    # prose still cannot forge a link
    assert "see \\[click](http://evil)" in text


def test_third_party_text_cannot_break_the_table():
    dep = make_dep("hostile")
    dep.signals["deprecated"] = Signal.flagged(
        "deprecated by its maintainers: line one\ntry `npm i other` instead | trailing",
        True,
    )
    text = render(artifact([dep]))
    row = next(line for line in text.splitlines() if "deprecated by its maintainers" in line)
    # the newline must not have split the row, and the pipe must not add a column
    assert row.startswith("| `hostile`") and "line one try" in row and "\\|" in row


def test_unverifiable_entries_are_named_never_clean():
    art = artifact(
        [make_dep()],
        {
            "examined": True,
            "reason": None,
            "sources": ["package-lock.json"],
            "total": 3,
            "checked": 2,
            "lockfile_entries": 3,
            "excluded_direct": 0,
            "unverifiable": [
                {
                    "ecosystem": "npm",
                    "name": "internal-lib",
                    "version": "1.0.0",
                    "reason": "resolves from git+ssh://acme/internal, not the npm registry",
                }
            ],
            "flagged": [],
        },
    )
    text = render(art)
    assert "`internal-lib`" in text
    assert "could not be verified against a public registry" in text
    assert "No known advisory affects any of the 2 registry-verified" in text

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools, Needs Python, Needs Node.js

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Trail of Bits
Publisher
Trail of Bits (Official)
Source
trailofbits/skills · plugins/supply-chain-risk-auditor/skills/supply-chain-risk-auditor · commit e4dd0bb
Licence
Creative Commons Attribution-ShareAlike 4.0 International (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Trail of Bits or Trail of Bits.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download supply-chain-risk-auditor.zip