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