HeadlinesBriefing favicon HeadlinesBriefing.com

cargo-geiger adds Rust unsafe code audit to Cargo

Hacker News •
×

The Rust community now has a dedicated cargo plugin that audits unsafe Rust across a crate and its entire dependency tree. Hosted on GitHub, cargo‑geiger scans Cargo.toml files, aggregates unsafe blocks, and outputs a concise report that helps auditors gauge the exposure of a project to low‑level operations.

Installation offers two paths: pull a system OpenSSL library and run `cargo install --locked cargo-geiger`, or bundle a vendored OpenSSL with `--features vendored-openssl`. Pre‑built binaries are also published on the repository’s releases page. Users invoke the tool from the crate root with `cargo geiger`, receiving a breakdown of unsafe usage by dependency.

The output is intended as statistical input for broader audits, not a binary safety verdict; projects may still require unsafe blocks for performance or FFI reasons. Cargo‑geiger also ships three libraries—cargo‑geiger, cargo‑geiger-serde, and geiger—for integration into custom tooling. Its name references a Geiger counter, underscoring that unsafe code, like radiation, must be measured and contained.

Teams often pipe the JSON report into `cargo-crev` or custom CI checks, turning raw counts into trend metrics. Because the library API is marked unversioned and unstable, downstream projects should pin a specific commit. Open issues track feature requests and bugs, ensuring the tool evolves alongside Rust’s unsafe‑code guidelines.