← cargo-audit Triage

How to triage cargo audit findings without ignoring real risk

cargo audit checks every crate in your Cargo.lock against the RustSec advisory database and prints them in lockfile order, with no sense of which ones your code touches. On a workspace with a few hundred transitive crates that is a list nobody can act on in one sitting, and it also mixes real vulnerabilities with unmaintained, unsound and yanked warnings. Sorting it by whether your code uses the crate turns it into a short first pass.

The three buckets this tool uses

A sensible order

  1. Run cargo audit --json in the workspace you ship, then feed it and your source to the triage.
  2. Upgrade the used crates first, using the patched ranges cargo audit lists. When a crate has several advisories, pick a version that clears all of them. Unmaintained and yanked warnings have no patch: plan a replacement or an update instead.
  3. Use --fail-on-imported in CI so a newly vulnerable package your code imports blocks the merge while unreferenced noise does not.
  4. For not-referenced packages, find the parent with cargo tree -i <crate>. If the parent is something you use, treat the finding as reachable.
  5. Batch the test-only upgrades into your normal dependency-update cadence. Do not defer one that runs in CI with deploy secrets.

What this ranking cannot tell you

It reads use and path expressions as text. It cannot see macros that expand to a crate path, a crate re-exported under another name, a renamed dependency (package = "..." in Cargo.toml), feature-gated code, or whether the vulnerable function is ever called. It also cannot see the dependency graph, so a crate your code reaches only through another crate is labelled not-referenced. Not used lowers the urgency; it is not a certificate of safety, and this is not a security audit.