But crates should be feared! It is code executed on your machine we are talking about! I agree that a community-rating tool such as cargo-crev is more than welcome to help in that matter (I didn’t know of it, I thank you for the reference).
But it does not solve the issue at hand: the exotic / unrated crate that just appeared. I am sorry to say so, but this kind of crates is more fearsome if it uses unsafe than if it does not. In the same way a C program is more fearsome than Python script. Both can be harmful, of course! But it is far more likely for the former.
Regarding cargo-crev vs labelling unsafe-usages, I ask: why not both: if a crate had a “uses-unsafe” label, then using a tool like cargo-crev would be a good way to override the initial mistrust.
I even imagine the following labelling system:
enum SafetyLabel {
CommunityReviewed {
safety_rating: f32,
},
NotEnoughReviews {
does_it_use_unsafe: bool,
}
}
So, if a crate got enough ratings, that would be the badge shown, with the associated average grade or something like that; else, it would get a badge stating whether unsafe was used. Then, the creator of an unsafe-using crate, to promote and get those positive reviews, would add explicit justification of the unsafe usage and why he thinks the usage is sound.
Because currently, this is sadly not always the case. In the current situation, people can hide the fact unsafe is used, which, in turn, leads to security-aware people to mistrust all the exotic crates by default, without any kind of hierarchy among them whatsoever.