cargo-supply-chain-audit
Audit Rust/Cargo crates for supply-chain exposure: crates.io metadata + checksum verification against Cargo.lock, .crate tarball hash and .cargo_vcs_info.json…
от jmagly★ 233 звезды на GitHub
Установить cargo-supply-chain-audit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
cargo-supply-chain-audit
Use this skill when reviewing a Rust / Cargo project or a specific
crates.io crate for supply-chain exposure: compromised crate maintainer
risk, malicious build.rs or proc-macro execution at build time, dependency
or checksum tampering, or a yank/release anomaly. This is the Cargo/Rust
counterpart to npm-supply-chain-audit — reach for it whenever the artifact
under review is a crate, not an npm package.
Triggers
- "cargo crate supply chain audit"
- "crates.io supply chain"
- "rust dependency audit"
- "malicious crate" / "compromised crate"
- "cargo audit" / "cargo deny" / "cargo vet"
- "build.rs review" / "proc-macro supply chain"
- "Cargo.lock checksum verification"
- ".crate tarball provenance"
Audit sequence
1. Dependency + checksum verification (against Cargo.lock)
Cargo.lock pins each dependency to a version and a registry checksum.
Verify the lockfile is present, committed, and internally consistent:
# Lockfile must exist and be committed (binaries always; libraries when pinning matters)
test -f Cargo.lock || echo "MISSING Cargo.lock — no checksum pinning"
# Re-verify every dependency against its recorded checksum without building
cargo verify-project
cargo fetch --locked # fails if Cargo.lock would change (drift / tampering)
# Inspect the pinned source + checksum for a specific crate
grep -A3 'name = "<crate>"' Cargo.lock
Escalate:
Cargo.lockmissing or not committed for a binary/deployable.cargo fetch --lockedreports the lockfile would change (unpinned drift).- A dependency
sourceis a git URL orpathoverride instead ofregistry+https://github.com/rust-lang/crates.io-index— git/path deps bypass the registry checksum + yank machinery (the Cargo analog of npm'sgit+/file:exotic sources).
2. .crate tarball hash + provenance (.cargo_vcs_info.json)
A published .crate is a gzipped tarball. Verify its hash matches what
Cargo.lock / crates.io records, and inspect the embedded VCS provenance:
# Download the exact published artifact
curl -sSL -o <crate>-<ver>.crate \
"https://crates.io/api/v1/crates/<crate>/<ver>/download"
# SHA-256 must match the checksum recorded in Cargo.lock for this version
sha256sum <crate>-<ver>.crate
# Inspect commit provenance baked in at publish time
tar -xzf <crate>-<ver>.crate
cat <crate>-<ver>/.cargo_vcs_info.json # { "git": { "sha1": "<commit>" }, "path_in_vcs": "" }
Escalate:
.crateSHA-256 does not match theCargo.lockchecksum (artifact tampering).- Missing or mismatched
.cargo_vcs_info.json— the published source can't be tied back to a repository commit. - The recorded
sha1does not exist in the upstream repo, or the repo tag for this version was force-moved.
3. Previous-vs-patched source diff
For a version bump (especially a patch release of a transitive dependency), diff the actual published sources — not just the repo — because crates.io publishes a snapshot that can differ from the tagged commit:
# Extract both versions' .crate sources and diff
tar -xzf <crate>-<old>.crate && tar -xzf <crate>-<new>.crate
diff -ru <crate>-<old>/ <crate>-<new>/ | less
# Focus on the high-risk surfaces first
diff -ru <crate>-<old>/build.rs <crate>-<new>/build.rs 2>/dev/null
diff -ru <crate>-<old>/Cargo.toml <crate>-<new>/Cargo.toml
Escalate any diff that adds: network calls, process spawns, filesystem writes
outside OUT_DIR, new build.rs, new proc-macro crates, base64/hex blobs, or
obfuscated string assembly.
4. Cargo.toml dependency + build-script review
build.rs and procedural macros execute arbitrary code at build time —
the Cargo analog of npm lifecycle scripts and the primary install-time
execution vector:
# Does the crate run a build script or ship proc-macros?
grep -nE '^build\s*=|\[build-dependencies\]|proc-macro\s*=\s*true' Cargo.toml
find . -name build.rs -not -path './target/*'
# Read every build.rs in the dependency tree, not just the top crate
cargo tree -e build,normal --prefix depth | grep -i build
Escalate:
- A
build.rsthat does anything beyond codegen / linking intoOUT_DIR(network, exec, writing outsideOUT_DIR, reading secrets/env beyond documentedCARGO_*/OUT_DIR). - New
[build-dependencies]orproc-macro = truecrates introduced in a patch release. - Feature unification pulling an unexpected crate into the build.
5. Trust-policy tooling: cargo audit / cargo deny / cargo vet
# Known-vulnerability scan against RustSec advisory DB
cargo audit # fails on advisories; `cargo audit fix` for patches
# Policy gate: licenses, bans, advisories, exotic sources, duplicate versions
cargo deny check # bans, advisories, licenses, sources
# Supply-chain trust: require human/org review of each crate+version
cargo vet # fails on un-vetted crates; `cargo v
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cargo-supply-chain-audit?
Audit Rust/Cargo crates for supply-chain exposure: crates.io metadata + checksum verification against Cargo.lock, .crate tarball hash and .cargo_vcs_info.json provenance, previous-vs-patched .crate source diff, Cargo.toml dependency + build-script review, cargo audit / cargo deny / cargo vet trust policy, and publisher / trusted-publishing / yank / release-anomaly checks.
Как установить скилл cargo-supply-chain-audit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cargo-supply-chain-audit запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…