cargo-deny / cargo-audit Failures - Advisories & Licenses in CI
cargo audit or cargo deny flagged something in your dependency graph - a security advisory (RUSTSEC), a banned or duplicate crate, or a license outside your allow-list - and failed the build as a supply-chain gate.
What this error means
A cargo audit or cargo deny check step exits non-zero, listing the offending crate plus the advisory ID, license, or ban rule. The code compiles fine; the gate is rejecting a dependency, not a build error.
error[vulnerability]: Vulnerable to a denial of service via crafted input
┌─ /home/runner/work/app/Cargo.lock:142
│
142 │ time 0.1.45 registry+https://github.com/rust-lang/crates.io-index
│ ^^^^^^^^^^^ RUSTSEC-2020-0071
= solution: Upgrade to >=0.2.23
error: advisories check failedDiagnose it: toolchain, features, or a stale target dir?
Cargo failures that only appear in CI are usually a different toolchain channel, a different feature set resolved by the dependency graph, or a target directory restored from a cache built with different flags.
rustc --version --verbose
cargo --version
cat rust-toolchain.toml 2>/dev/null
# which features actually got enabled across the graph?
cargo tree -e features | head -40
# rule out a poisoned cache before anything else
cargo clean && cargo build --lockedCommon causes
A dependency has a published advisory
A crate in the graph matches a RUSTSEC advisory (vulnerability or unmaintained). cargo audit/cargo deny advisories fails until it’s upgraded or explicitly ignored.
A license, ban, or duplicate rule tripped
cargo-deny also enforces license allow-lists, banned crates, and duplicate-version rules from deny.toml. A dependency outside those policies fails the corresponding check.
How to fix it
Upgrade or replace the flagged crate
The advisory usually names a fixed version - bump to it, or swap to a maintained alternative.
cargo update -p time --precise 0.3.36
# re-run the gate
cargo audit
cargo deny check advisories bans licensesAnnotate an accepted finding in deny.toml
When a fix isn’t yet available, record a reviewed exception so the gate stays meaningful rather than disabled.
# deny.toml
[advisories]
ignore = ["RUSTSEC-2020-0071"] # tracked: no upstream fix yet
[licenses]
allow = ["MIT", "Apache-2.0", "BSD-3-Clause"]How to prevent it
- Run
cargo audit/cargo denyin CI so advisories surface on every PR. - Keep a reviewed
deny.tomlfor licenses, bans, and time-boxed advisory ignores. - Upgrade flagged crates promptly instead of accumulating ignores.