Audit Dependencies with cargo-audit and cargo-deny
Beginner8 minTrending
Scan Rust dependencies for security vulnerabilities, license violations, and supply chain risks.
Prerequisites
- -Rust toolchain installed
- -A Cargo project with dependencies
Steps
1
Install cargo-audit
Install the security audit tool that checks against the RustSec advisory database.
$ cargo install cargo-audit
2
Run a vulnerability scan
Check all dependencies for known security vulnerabilities.
$ cargo audit
Run this in CI to catch new vulnerabilities as the advisory database is updated daily.
3
Install and configure cargo-deny
Set up cargo-deny for comprehensive dependency policy enforcement.
$ cargo install cargo-deny && cargo deny init
4
Check licenses and advisories
Run cargo-deny to check for license compliance and security advisories.
$ cargo deny check advisories && cargo deny check licenses
5
Check for duplicate and banned dependencies
Detect duplicate crate versions and enforce banned crate rules.
$ cargo deny check bans && cargo deny check sources
Duplicate dependencies increase binary size. Use 'cargo deny check bans' to find them.
Full Script
FAQ
Discussion
Loading comments...