6 ms·
Rust has a culture where people don't use `unsafe` unless absolutely necessary. That is generally good enough in my experience. If you want to go further, you
by throwup 4y ago
Rust has a culture where people don't use `unsafe` unless absolutely necessary. That is generally good enough in my experience.
If you want to go further, you can disable unsafe in a crate by adding #[forbid(unsafe)].
And if you need more control than that, there's probably tooling out there that will help depending on what exactly you need.
https://github.com/rustsec/rustsec/tree/main/cargo-audit https://github.com/rustsec/rustsec/tree/main/cargo-audit
https://github.com/rust-secure-code/cargo-geiger https://github.com/rust-secure-code/cargo-geiger
https://github.com/crev-dev/cargo-crev https://github.com/crev-dev/cargo-crev
- mk89 4y ago> If you want to go further, you can disable unsafe in a crate by adding #[forbid(unsafe)]. Cool, so it's possible to exclude dependencies which include unsafe stuff! That's awesome. See, this is the kind of stuff I was looking for. From the perspective of a team writing new Rust code: 1) Don't allow unsafe (you can have an easy code search for this) 2) Forbid unsafe cargos Finally: how do you catch unsafe in the standard library?
- jdorfman 4y ago> 1) Don't allow unsafe (you can have an easy code search for this) 2) Forbid unsafe cargos This can be accomplished with cargo vet (https://mozilla.github.io/cargo-vet/how-it-works.html?highlight=sourcegraph#auditing-workflow https://mozilla.github.io/cargo-vet/how-it-works.html?highli...)