Email me

Explainer · 5 min read

Filed under Rust

cargo audit vs cargo deny: which one should gate your CI?

Short answer

Both tools read the same RustSec advisory database. cargo audit does one thing: it fails when your Cargo.lock holds a crate with a known vulnerability (and warns on unmaintained or yanked ones). cargo deny runs that same check and adds three more: license allow-lists, banned or duplicate crates, and which registries and git sources are allowed. One-command vulnerability gate: cargo audit. Whole dependency policy in one file: cargo deny.

Card: cargo audit vs cargo deny. cargo audit: one job, RustSec advisories. cargo deny: advisories plus licenses, bans and sources. Same database underneath: RustSec advisory-db. Command: cargo deny check advisories.
Same advisory database, different scope. Card by Tensorust.

Part of the article tokio-tar has no TARmageddon fix. Its downloads rose 58% anyway. This page answers one question from it in depth.

On this page · 8 sections
  1. Key facts
  2. cargo audit: the smoke alarm
  3. cargo deny: the policy file
  4. Which one to run
  5. Common misconceptions
  6. What to do now
  7. FAQ
  8. Sources

TL;DR: The choice matters less than running either one. tokio-tar has had an unfixed advisory (RUSTSEC-2025-0111) for a year, and crates.io still served it 46,618 times a day in October 2026, up from 29,543 in August. Of the 28 crates whose latest release requires it, 9 shipped in 2026. Every one of those builds would have failed a single cargo deny check advisories or cargo audit step.

Rust's reputation for safety ends at the borrow checker. A logic bug in an abandoned tar parser compiles fine, passes tests and ships. The only thing between a public advisory and your release binary is a CI step someone chose to add. Here is what each option actually checks.

Key facts

What cargo audit cargo deny
Maintainer RustSec project Embark Studios
Install cargo install cargo-audit cargo install --locked cargo-deny
Advisory data RustSec advisory-db RustSec advisory-db
Checks advisories advisories, licenses, bans, sources
Config audit.toml (optional) deny.toml (cargo deny init)
CI action rustsec/audit-check EmbarkStudios/cargo-deny-action
tokio-tar downloads/day, Oct 2026 46,618 crates.io

Table: both tools check RustSec vulnerabilities and unmaintained or yanked crates. Only cargo deny checks license allow-lists, banned or duplicate crates and allowed registries. Only cargo audit scans a built binary. Config files audit.toml and deny.toml. What each tool checks, from each project's README and docs. Table by Tensorust, Oct 28 2026.

cargo audit: the smoke alarm

cargo audit reads your Cargo.lock, fetches the RustSec database and prints every match with its RUSTSEC ID, the affected crate and version, and the fixed versions if any exist. Exit code 1 on a vulnerability, so CI fails. Unmaintained and yanked crates show as warnings unless you pass --deny warnings.

Strengths: zero config, one line in CI, and it reads lockfiles of projects you do not own. It also has cargo audit bin, which scans a compiled binary built with cargo auditable, so you can check what is actually deployed, not just what is in the repo. Full walkthrough: our cargo audit guide.

cargo deny: the policy file

cargo deny init writes a deny.toml with four sections, and cargo deny check runs all of them:

  • advisories: the RustSec check, with an ignore list for IDs you have reviewed.
  • licenses: an allow-list (MIT, Apache-2.0 and so on). A crate under a license you did not allow fails the build. This is the check legal teams ask for.
  • bans: forbid specific crates (say, openssl when you standardized on rustls) and flag duplicate versions of the same crate, which bloat compile times.
  • sources: only allow crates.io, or your private registry, and named git repos. A dependency quietly pointing at a random fork fails.

Run just the security part with cargo deny check advisories. The policy lives in the repo, reviewed like code.

Which one to run

  • Solo crate or small app, you want a vulnerability gate today: cargo audit. One step, done.
  • Company codebase, anything shipped to customers, or more than a few contributors: cargo deny. License and source rules catch problems an advisory database never will.
  • Both is fine. They do not conflict. Some teams run cargo deny check on every pull request and cargo audit on a nightly schedule, because new advisories get published against code that did not change.

That last point is the one people miss. A green build last month says nothing about today. tokio-tar did not change between July 2023 and October 2025; the advisory did. Only a scheduled run catches that.

Bars: tokio-tar average daily downloads were 29,542 in August 2026, 32,519 in September and 46,618 in October. Builds still fetching a crate with no fix. crates.io, pulled Oct 28 2026.

Common misconceptions

Myth

"cargo deny has a better vulnerability database."

The recordIt does not. Both read the same RustSec advisory-db. The difference is scope, not data.

Myth

"If cargo audit passes, my dependencies are safe."

The recordIt means no published advisory matches your lockfile today. Unreported bugs and advisories published tomorrow are not covered, which is why the scheduled run matters.

Myth

"A failing audit means I am stuck until upstream fixes it."

The recordNo. Find the parent with cargo tree -i, then upgrade, disable a feature, swap to a fork or patch. For tokio-tar the fix is a maintained fork, astral-tokio-tar.

Myth

"Ignoring an advisory is cheating."

The recordNot if you record why. A RUSTSEC ID in a dev-only tool that never touches untrusted input can be a fair ignore. Put the reason in the config so the next reviewer sees it.

What to do now

Add one of these to CI today:

cargo audit                    # vulnerability gate, no config
cargo deny init && cargo deny check   # full policy

Schedule it nightly as well as on pull requests. Then check whether you are already carrying tokio-tar with the 28-dependent list, see the same pattern in the zip crate breakdown, or paste a lockfile into the Cargo.lock checker. If a flagged crate breaks your build when you swap it, our paid Rust fix handles it within 24 hours or a full refund.

FAQ

What is the difference between cargo audit and cargo deny?

cargo audit (from the RustSec project) checks Cargo.lock against the RustSec advisory database for vulnerable, unmaintained and yanked crates. cargo deny (from Embark Studios) runs the same advisory check plus license, banned-crate and source checks, configured in deny.toml.

Do cargo audit and cargo deny use the same database?

Yes. Both read the RustSec advisory-db on GitHub, so a RUSTSEC ID flagged by one is flagged by the other.

Should I use cargo audit or cargo deny in CI?

If you only need a vulnerability gate, cargo audit is one command with no config. If you also care about licenses, duplicate or banned crates, or where crates come from, use cargo deny and run cargo deny check in CI.

Can cargo deny replace cargo audit?

For CI gating, yes: cargo deny check advisories covers the same advisories. cargo audit still has extras, like scanning a compiled binary built with cargo auditable (cargo audit bin).

How do I ignore an advisory in cargo deny?

Add the RUSTSEC ID to the ignore list under [advisories] in deny.toml, ideally with a reason. In cargo audit, use audit.toml or the --ignore flag.

Sources

All checked October 28, 2026.

Next question

Every number on this page links to its source and was checked on Oct 28, 2026. Spot an error or a newer figure? Email matt@tensorust.com and it gets fixed. Related: Check a Cargo.lock against RustSec in your browser.

Read next

Back to The Manual →   All articles →

Get the next one by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Up next

The article this answer comes fromtokio-tar has no TARmageddon fix. Its downloads rose 58% anywaytokio-tar has no fix for TARmageddon, yet Rust builds pulled it 46,618 times a day in October, up 58%. 9 crates still adopted it in 2026, one yesterday.Read it next →

Art: Nicholas Roerich, Depsang Plains (1925-26). Public domain, via Wikimedia Commons.

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Did this answer your question?

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ

Disagree, or have a number to add? Discuss this on The Floor →

What are people saying about this? Read and post on The Floor →