| Crates.io | rust_secure_dependency_audit |
| lib.rs | rust_secure_dependency_audit |
| version | 0.2.1 |
| created_at | 2025-11-23 12:45:43.805548+00 |
| updated_at | 2025-12-08 10:50:12.497315+00 |
| description | A comprehensive tool for auditing Rust project dependencies: health scoring, license analysis, maintenance risk, and footprint estimation |
| homepage | https://github.com/emorilebo/rust_secure_dependency_audit |
| repository | https://github.com/emorilebo/rust_secure_dependency_audit |
| max_upload_size | |
| id | 1946484 |
| size | 202,193 |
A comprehensive tool for auditing Rust project dependencies, providing insights into health, maintenance status, license compliance, and supply-chain risks.
Modern software projects depend on dozens or hundreds of external crates. While Rust's ecosystem is generally well-maintained, dependencies can become:
This tool helps you identify and mitigate these risks by analyzing:
cargo install rust_secure_dependency_audit
Add to your Cargo.toml:
[dependencies]
rust_secure_dependency_audit = "0.1"
Scan your project:
secure-audit scan
Generate a JSON report:
secure-audit report --format json --output audit.json
Check with thresholds (for CI):
secure-audit check --min-health-score 60 --fail-on-copyleft
Scan with failure threshold:
secure-audit scan --fail-threshold 70
Ignore specific dependencies:
secure-audit scan --ignore build-script-deps --ignore dev-only-tool
use rust_secure_dependency_audit::{audit_project, AuditConfig, HealthStatus};
use std::path::Path;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AuditConfig::default();
let report = audit_project(Path::new("."), &config).await?;
for dep in report.dependencies {
match dep.status {
HealthStatus::Risky => {
eprintln!("⚠️ {} v{}: score {}", dep.name, dep.version, dep.health_score);
}
_ => {}
}
}
Ok(())
}
Each dependency receives a health score (0-100) based on weighted factors:
Recency (40%): Days since last publish/commit
Maintenance (30%): Repository activity
Community (20%): Contributors and engagement
Stability (10%): Version history
Security (15%): Security practices
SECURITY.md (+20 points)Scores are then categorized:
Licenses are categorized into:
You can configure:
Calculates a footprint risk score (0.0-1.0) based on:
Useful for embedded, mobile, or WASM projects where binary size matters.
Create a config file (e.g., audit-config.toml):
[scoring_weights]
recency = 0.50
maintenance = 0.30
community = 0.15
community = 0.15
stability = 0.10
security = 0.15
[staleness_thresholds]
stale_days = 180 # 6 months
risky_days = 365 # 1 year
min_maintainers = 2
[license_policy]
allowed_licenses = ["MIT", "Apache-2.0", "BSD-3-Clause"]
forbidden_licenses = ["AGPL-3.0"]
warn_on_copyleft = true
warn_on_unknown = true
[footprint_thresholds]
max_transitive_deps = 50
max_footprint_risk = 0.7
[network]
timeout_secs = 30
max_retries = 3
max_retries = 3
request_delay_ms = 100
enable_openssf = true
Use it:
secure-audit scan --config audit-config.toml
GITHUB_TOKEN: GitHub personal access token (for higher API rate limits)GITLAB_TOKEN: GitLab personal access token--project-path <PATH>: Path to Rust project (default: current directory)--config <FILE>: Custom TOML configuration file--ignore <CRATE>: Ignore specific dependencies (repeatable)--verbose: Enable verbose loggingscanRun full audit and display summary.
Options:
--fail-threshold <SCORE>: Exit with error if any dependency scores below threshold--detailed: Show detailed information for each dependencyreportGenerate detailed audit report.
Options:
--format <FORMAT>: Output format (json or markdown)--output <FILE>: Write to file (default: stdout)checkCheck dependencies against thresholds (for CI).
Options:
--min-health-score <SCORE>: Minimum acceptable score (default: 60)--fail-on-copyleft: Fail on copyleft licenses--fail-on-unknown-license: Fail on unknown/missing licensesCheck the examples/ directory:
basic_usage.rs: Simple audit with default configcustom_config.rs: Custom configuration and filteringRun examples:
cargo run --example basic_usage
cargo run --example custom_config
Recommendation: Set GITHUB_TOKEN environment variable to increase limits.
--ignore to skip problematic dependenciescargo-auditThis tool focuses on maintenance risk, not known security vulnerabilities. Use in combination with:
cargo-audit: CVE scanningcargo-deny: License and advisory checksContributions are welcome! Areas for improvement:
Please open an issue or pull request on GitHub.
Licensed under either of:
at your option.
Built with:
cargo_metadata: Cargo project parsingreqwest: HTTP clientclap: CLI frameworktokio: Async runtime