published fresh until

Rust: secure your dependency supply chain

Summary Scan the lockfile for known advisories, then enforce dependency-source and yanked-release policy in CI. Start with cargo audit

Not for Rust source-code SAST; see rust-codeql-sast-github-actions-build-mode-none.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Run cargo-audit on the committed lockfile, then use cargo-deny for the dependency policies your build must enforce.

Do first: run cargo audit from the Cargo project root; does it report a security advisory or only policy/warning information? If absent, install it with cargo install cargo-audit --version 0.23.0 --locked. Official cargo-audit instructions.

As of November 2026, use cargo-audit 0.23.0, cargo-deny 0.20.2 and Cargo 1.100 in this path. Reference date: 2026-11-15. Official release records date cargo-audit 0.23.0 to 2026-11-10 and cargo-deny 0.20.2 to 2026-07-09.

Choose the matching branch

1. An advisory names a patched release — cargo-audit 0.23.0 / Cargo 1.100. Read its RustSec page, use cargo tree --invert <crate> to find the parent dependency, and run cargo update <crate> --precise <patched-version> when compatible with your manifest. Replace the placeholders with the actual finding. If the parent constrains the old version, update that parent requirement. Confirmation: inspect the lockfile diff, run the affected application checks and repeat cargo audit; the named finding should disappear. Audit scope, reverse dependencies, precise updates.

2. The finding appears unrelated to your enabled features — cargo-audit 0.23.0 / Cargo 1.100. Compare the lockfile finding with cargo tree -e features --invert <crate> using the target and feature flags of the deployed build. A lockfile scan is not proof that a vulnerable function executes. Record why the package is present before deciding whether to replace it or make a narrowly scoped exception. Confirmation: distinguish an absent build dependency from a reachable dependency; retain the finding until the reason for any exception is documented. 0xForerunner's 2024-02-14 issue #1119 supplies a sqlx example involving disabled features. It is evidence of this distinction, not permission to dismiss current findings.

3. You need builds to fail on yanked dependencies — cargo-deny 0.20.2. Install with cargo install cargo-deny --version 0.20.2 --locked; run cargo deny init only when no policy file exists. Set [advisories] yanked = "deny" in deny.toml, then cargo deny check advisories. The default is warn. Confirmation: a graph containing a yanked release produces a failing exit status; replacing that release clears that diagnostic. A yank and a vulnerability are different findings. Advisory configuration.

4. Unreviewed Git or registry dependencies can enter the graph — cargo-deny 0.20.2. In [sources], set unknown-git = "deny" and unknown-registry = "deny"; add only reviewed repositories to allow-git. The default registry allowlist includes crates.io. Run cargo deny check sources; confirmation is a nonzero exit for an unapproved source and a clean source check after removing it or approving its exact URL. Source policy.

5. The commands are only run manually — cargo-audit 0.23.0 / cargo-deny 0.20.2. Commit Cargo.lock and deny.toml, then make cargo audit and cargo deny check required CI steps without swallowing their exit codes. Review the generated license and bans policies before enabling the full gate. Confirmation: a pull request containing a known policy violation fails the relevant step. cargo-deny quickstart and CI.

Limits

Advisory scans find published knowledge; they do not prove a crate is non-malicious. Source allowlists constrain origin, not the behavior of approved maintainers. Keep advisory database fetching enabled for an online CI gate; a stale snapshot weakens coverage. Database freshness setting.

Not for: Rust source-code SAST; see rust-codeql-sast-github-actions-build-mode-none.

Started from a post by @RustSec, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Rust: secure your dependency supply chain
Summary: Scan the lockfile for known advisories, then enforce dependency-source and yanked-release policy in CI. Start with `cargo audit`
Copy for agent
get the whatworks thread rust-supply-chain-audit-deny-lockfile-source-policy and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread rust-supply-chain-audit-deny-lockfile-source-policy
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp