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
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
Download the skill as a ZIP:
https://autogineer.com/agent-skills/trailofbits/supply-chain-risk-auditor/downloadUnzip 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
Confirm the target directory has manifests:
package.json,pyproject.toml,requirements*.txt, orgo.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, andpoetry.lockare not read — the report says so when they are present, and versions fall back to pins or the latest release.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.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.mdExpect a few minutes for ~50 dependencies — several HTTP requests per dependency, more with many Go modules, and slower without authenticated
gh. Ifcollect.pyexits non-zero, it is refusing to report — relay its message verbatim instead of retrying or working around it.Read
report.mdandfindings.json. The report is the deliverable; the JSON carries the datum behind every verdict when you need to cite one.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-scriptsis 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
"
ghcan 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
- ATTRIBUTION.mdAdded by AutoGineer969 B
- LICENSELicence file added by AutoGineer19.7 KiB
- SKILL.md6.8 KiB
- agents/openai.yaml252 B
- assets/trail-of-bits-mark.svg3.0 KiB
- scripts/collect.pyScript64.2 KiB
- scripts/model.pyScript17.2 KiB
- scripts/pyproject.toml683 B
- scripts/render.pyScript34.4 KiB
- scripts/sources.pyScript28.5 KiB
- scripts/test_collect.pyScript37.2 KiB
- scripts/test_model.pyScript7.7 KiB
- scripts/test_render.pyScript14.0 KiB
- scripts/test_sources.pyScript10.3 KiB
- scripts/uv.lock337 B
scripts/test_sources.py
"""Source-adapter tests: identifier parsing, the caching client, and OSV batching.
The redirect test is load-bearing per the collector's history: `jrburke/r.js` 301s to
`requirejs/r.js`, and an HTTP client that stopped at the 301 reported the repository
missing. Any replacement client must keep following redirects, so a local server proves
this one does.
"""
from __future__ import annotations
import json
import os
import threading
import time
from email.message import Message
from http.server import BaseHTTPRequestHandler, HTTPServer
from pathlib import Path
import pytest
import sources
from sources import (
Http,
NotFound,
RepoIdentifierError,
Unavailable,
_Response,
_security_policy,
github_repo,
looks_automated,
normalize_repo,
osv_advisories,
)
# --------------------------------------------------------------- repo identifiers
@pytest.mark.parametrize(
("raw", "expected"),
[
("git+https://github.com/a/b.git", "github.com/a/b"),
("[email protected]:a/b.git", "github.com/a/b"),
("ssh://[email protected]/a/b", "github.com/a/b"),
("a/b", "github.com/a/b"),
("github:a/b", "github.com/a/b"),
("gitlab:a/b", "gitlab.com/a/b"),
("https://github.com/psf/requests/blob/main/README.md", "github.com/psf/requests"),
("https://www.GitHub.com/a/b/", "github.com/a/b"),
("https://example.com/foo", "example.com/foo"),
],
)
def test_normalize_repo(raw: str, expected: str):
assert normalize_repo(raw) == expected
def test_non_github_repo_is_an_identifier_error_not_an_api_failure(tmp_path: Path):
http = Http(tmp_path, offline=True)
with pytest.raises(RepoIdentifierError):
github_repo(http, "https://sr.ht/~someone/project", None)
def test_bot_heuristic_is_conservative():
for account in ("dependabot", "renovate", "github-actions", "release-bot", "ci"):
assert looks_automated(account), account
for account in ("alice", "robotics-lab", "botanist"):
assert not looks_automated(account), account
# ------------------------------------------------------------------- OSV batching
class RecordingHttp:
def __init__(self, responses: list[dict]):
self.responses = list(responses)
self.payloads: list[dict] = []
def post_json(self, url: str, payload: dict) -> dict:
self.payloads.append(payload)
return self.responses.pop(0)
def test_osv_results_are_positional_so_same_name_twice_works():
http = RecordingHttp([{"results": [{"vulns": [{"id": "GHSA-1"}]}, {}]}])
ids = osv_advisories(http, [("npm", "inner", "3.0.0"), ("npm", "inner", "3.1.0")])
assert ids == [["GHSA-1"], []]
def test_osv_result_count_mismatch_is_refused():
http = RecordingHttp([{"results": [{}]}])
with pytest.raises(Unavailable, match="positional"):
osv_advisories(http, [("npm", "a", "1"), ("npm", "b", "2")])
def test_osv_batches_chunk_at_500():
http = RecordingHttp([{"results": [{}] * 500}, {"results": [{}]}])
queries = [("npm", f"pkg-{i}", "1.0.0") for i in range(501)]
assert len(osv_advisories(http, queries)) == 501
assert [len(p["queries"]) for p in http.payloads] == [500, 1]
# ----------------------------------------------------------------- caching client
def seed(http: Http, method: str, url: str, payload: object, body: str = "") -> Path:
path = http._path(method, url, body)
if payload is None:
http._write_cache(path, {}, 404)
else:
http._write_cache(path, payload, 200)
return path
def test_offline_serves_seeded_entries(tmp_path: Path):
http = Http(tmp_path, offline=True)
seed(http, "GET", "https://example.com/x", {"ok": 1})
assert http.get_json("https://example.com/x") == {"ok": 1}
assert http.stats["hits"] == 1
def test_cached_404_stays_not_found(tmp_path: Path):
http = Http(tmp_path, offline=True)
seed(http, "GET", "https://example.com/gone", None)
with pytest.raises(NotFound):
http.get_json("https://example.com/gone")
def test_offline_miss_is_unavailable_not_a_verdict(tmp_path: Path):
http = Http(tmp_path, offline=True)
with pytest.raises(Unavailable, match="offline"):
http.get_json("https://example.com/never-fetched")
def test_truncated_cache_entry_is_dropped(tmp_path: Path):
http = Http(tmp_path, offline=True)
path = seed(http, "GET", "https://example.com/x", {"ok": 1})
path.write_text('{"__meta": {"fetched_at"')
with pytest.raises(Unavailable):
http.get_json("https://example.com/x")
assert not path.exists()
def test_non_utf8_cache_entry_is_dropped(tmp_path: Path):
"""Undecodable cache bytes are corruption, not a permanent client crash."""
http = Http(tmp_path, offline=True)
path = seed(http, "GET", "https://example.com/x", {"ok": 1})
path.write_bytes(b"\xff")
with pytest.raises(Unavailable):
http.get_json("https://example.com/x")
assert http.stats["errors"] == 1
assert not path.exists()
def test_cache_owner_is_verified_on_posix(tmp_path: Path):
"""The usual case: ownership checks out, so there is no caveat to report."""
http = Http(tmp_path, offline=True)
assert http.cache_owner_caveat is None
def test_foreign_cache_owner_still_aborts(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
"""The control this caveat exists to protect must keep biting on POSIX.
A cache another user can write turns a compromised package into a clean
"no advisories" verdict, so a foreign owner has to stop the run outright.
"""
monkeypatch.setattr(sources.os, "getuid", lambda: os.stat(tmp_path).st_uid + 1)
with pytest.raises(SystemExit, match="owned by another user"):
Http(tmp_path, offline=True)
def test_missing_getuid_reports_a_caveat_instead_of_crashing(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
"""Windows has no os.getuid, and st_uid is always 0 there (issue #273).
The client must construct rather than raise AttributeError, and must hand back a
caveat naming what went unchecked — dropping the control silently would let the
report claim a verified cache it never verified.
"""
monkeypatch.delattr(sources.os, "getuid", raising=True)
http = Http(tmp_path, offline=True)
assert http.cache_owner_caveat is not None
assert "not verified" in http.cache_owner_caveat
assert str(tmp_path) in http.cache_owner_caveat
# Still usable: the caveat is a report line, not a degraded client.
seed(http, "GET", "https://example.com/x", {"ok": 1})
assert http.get_json("https://example.com/x") == {"ok": 1}
def test_auth_marker_partitions_the_cache(tmp_path: Path):
anon = Http(tmp_path, offline=True, auth_marker="anon")
seed(anon, "GET", "https://api.github.com/repos/a/b", None)
authed = Http(tmp_path, offline=True, auth_marker="gh")
# The anonymous 404 must not be served to the authenticated run.
with pytest.raises(Unavailable) as excinfo:
authed.get_json("https://api.github.com/repos/a/b")
assert not isinstance(excinfo.value, NotFound)
def test_stale_entries_refetch_when_online(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
http = Http(tmp_path, offline=False)
path = seed(http, "GET", "https://example.com/x", {"old": True})
stored = json.loads(path.read_text())
stored["__meta"]["fetched_at"] = time.time() - sources.CACHE_MAX_AGE_SECONDS - 60
path.write_text(json.dumps(stored))
monkeypatch.setattr(http, "_send", lambda *a: {"fresh": True})
assert http.get_json("https://example.com/x") == {"fresh": True}
assert http.stats["stale"] == 1
def test_rate_limit_retries_once_then_gives_up(tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
limited = Message()
limited["x-ratelimit-remaining"] = "0"
responses = [
_Response(403, "", limited),
_Response(200, '{"ok": 1}'),
]
http = Http(tmp_path, offline=False)
monkeypatch.setattr(http, "_open", lambda *a: responses.pop(0))
monkeypatch.setattr(sources.time, "sleep", lambda s: None)
assert http.get_json("https://api.github.com/repos/a/b") == {"ok": 1}
responses.extend([_Response(429, ""), _Response(429, "")])
with pytest.raises(Unavailable, match="rate limited"):
http.get_json("https://api.github.com/repos/a/b2")
# ------------------------------------------------------- redirects (load-bearing)
class _RedirectingHandler(BaseHTTPRequestHandler):
def do_GET(self): # noqa: N802 - BaseHTTPRequestHandler's required casing
if self.path == "/old":
self.send_response(301)
self.send_header("Location", "/new")
self.end_headers()
else:
body = json.dumps({"moved": True}).encode()
self.send_response(200)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *args): # silence per-request stderr noise
pass
def test_client_follows_redirects(tmp_path: Path):
server = HTTPServer(("127.0.0.1", 0), _RedirectingHandler)
thread = threading.Thread(target=server.serve_forever, daemon=True)
thread.start()
try:
http = Http(tmp_path, offline=False)
url = f"http://127.0.0.1:{server.server_port}/old"
assert http.get_json(url) == {"moved": True}
finally:
server.shutdown()
thread.join(timeout=5)
# ----------------------------------------------------------------- security policy
class PolicyHttp:
"""Duck-typed client that answers SECURITY.md probes from a script."""
def __init__(self, outcomes: list[object]):
self.outcomes = list(outcomes)
def get_json(self, url: str, headers: dict | None = None) -> dict:
outcome = self.outcomes.pop(0)
if isinstance(outcome, Exception):
raise outcome
return outcome
def test_policy_found_at_the_first_candidate():
assert _security_policy(PolicyHttp([{}]), "acme/repo", {}) is True
def test_policy_absent_only_when_every_probe_is_a_404():
http = PolicyHttp([NotFound("404")] * 5)
assert _security_policy(http, "acme/repo", {}) is False
def test_policy_unknown_when_any_probe_fails_for_other_reasons():
http = PolicyHttp([NotFound("404"), Unavailable("rate limited")] + [NotFound("404")] * 3)
assert _security_policy(http, "acme/repo", {}) is None
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