What it does
dev-security wraps two best-in-class Rust security tools and emits
results as a dev-report::Report:
cargo-auditscans the dependency tree against the RustSec advisory database for known CVEs.cargo-denyenforces policy: allowed/banned licenses, allowed/banned crates, allowed/banned sources, multiple-version detection.
Findings from both tools come back through one typed AuditResult,
ready to drive an AI agent or a CI gate without parsing free-form
output.
Quick start
[]
= "0.9"
One-time tool install:
Drive it from code:
use ;
let run = new.scope;
let result = run.execute?;
let report = result.into_report;
if report.failed
# Ok::
Scopes
| Scope | What it runs |
|---|---|
AuditScope::Vulnerabilities |
cargo audit only (RustSec advisory DB). |
AuditScope::Policy |
cargo deny check only (licenses, banned crates). |
AuditScope::All |
Both. |
Severity mapping
| Source | dev-report::Severity |
|---|---|
cargo-audit critical |
Critical |
cargo-audit high |
Error |
cargo-audit medium |
Warning |
cargo-audit low / none / missing |
Info / Warning |
cargo-audit warnings (unmaintained etc.) |
Warning |
cargo-deny error |
Error |
cargo-deny warning |
Warning |
cargo-deny help / note |
Info |
Allow-list + severity threshold
Suppress known false positives by advisory ID, and / or set a
severity floor so noisy Info findings stop showing up in CI:
use ;
use Severity;
let run = new
.scope
.allow
.allow_all
.severity_threshold; // drop Info findings
let _result = run.execute?;
# Ok::
Allow-list entries match against the id field of each Finding —
advisory IDs for cargo-audit findings (RUSTSEC-2024-NNNN) and
diagnostic codes for cargo-deny findings (e.g. L001).
Producer integration
AuditProducer plugs the audit into a multi-producer pipeline driven
by dev-tools:
use ;
use Producer;
let producer = new;
let report = producer.produce;
println!;
Subprocess failures map to a single failing CheckResult named
security::audit with Severity::Critical — the pipeline keeps
running.
Wire format
Finding, FindingSource, and AuditResult are all
serde-derived. JSON output uses snake_case field names and omits
optional fields when they are None:
Examples
| File | What it shows |
|---|---|
examples/basic.rs |
Full audit (All scope); prints the JSON report. |
examples/audit_only.rs |
Vulnerabilities scope only. |
examples/policy_only.rs |
Policy scope only. |
examples/producer.rs |
AuditProducer wired into a pipeline (gated by DEV_SECURITY_EXAMPLE_RUN). |
Requirements
Both cargo-audit and
cargo-deny must be installed:
The crate detects absence of either tool and surfaces
AuditError::AuditToolNotInstalled /
AuditError::DenyToolNotInstalled rather than panicking.
Runtime dependency footprint: dev-report, serde, serde_json.
Migration from 0.1.0
Finding gained four new fields: affected_version, url,
description, and source. If you constructed Finding literals in
0.1.0, add the new fields:
# use ;
# use Severity;
let _f = Finding ;
The constructor surface (AuditRun::new, AuditScope variants,
AuditResult::into_report) is unchanged.
The dev-* collection
dev-security ships independently and is also re-exported by the
dev-tools umbrella crate as
the security feature. Sister crates cover the other verification
dimensions:
dev-report— report schema everything emitsdev-fixtures— deterministic test fixturesdev-bench— performance and regression detectiondev-async— async runtime verificationdev-stress— stress and soak workloadsdev-chaos— fault injection and recovery testingdev-coverage— code coverage with regression gatesdev-deps— unused / outdated dep detectiondev-ci— GitHub Actions workflow generatordev-fuzz— fuzz testing workflowdev-flaky— flaky-test detectiondev-mutate— mutation testing
Status
v0.9.x is the pre-1.0 stabilization line. The API is feature-complete
for vulnerability scanning, policy enforcement, allow-listing, and
severity gating. Production use is fine; 1.0 will pin the public API
and the wire format.
Minimum supported Rust version
1.85 — pinned in Cargo.toml via rust-version and verified by
the MSRV job in CI.
License
Apache-2.0. See LICENSE.