Why would you need a static analyzer for a language that promotes itself as safe out of the box.
Prusti: Static Analyzer for Rust
31–40 of 93 posts
Re: Prusti: Static Analyzer for Rust
#32I don't understand how this could work from looking at the readme. It says: > verifies absence of integer overflows and panics by proving that statements such as unreachable!() and panic!() are unreachable But integer overflows in release builds don't panic! and aren't unreachable!. Additionally, clippy already checks this for you if you enable an optional lint. So if it detects any panic! Then that's amazing. But if…
You are overthinking things. Those are just usee to mark places in the control flow it tries to proove are unreachable. The meaning of those constructs is irrelevant.
This is a static analyzer so I would expect it can trace calls to a panic handler (which both panic! and unreachable! use). I might be overthinking things, but it looks to me like this may be able to detect panic! calls even in, say, stdlib
Re: Prusti: Static Analyzer for Rust
#33There also appear to be equivalents of this tool in Python ("Nagini" https://www.pm.inf.ethz.ch/research/nagini.html) and Go ("Gobra" https://www.pm.inf.ethz.ch/research/gobra.html).
I'll definitely be checking out Nagini for my work!
Re: Prusti: Static Analyzer for Rust
#34I don't understand how this could work from looking at the readme. It says: > verifies absence of integer overflows and panics by proving that statements such as unreachable!() and panic!() are unreachable But integer overflows in release builds don't panic! and aren't unreachable!. Additionally, clippy already checks this for you if you enable an optional lint. So if it detects any panic! Then that's amazing. But if…
I think the docs also support this reading, overflow detection and panic detection are listed as separate features [1].
But it is poorly worded, and the readme could certainly be improved.
1: https://viperproject.github.io/prusti-dev/user-guide/verify/...
Re: Prusti: Static Analyzer for Rust
#35What are people's experiences with static analyzers at companies? Many people I have spoken with have either never heard of them, or expressed no interest. Usually those same people use dynamic languages like Ruby or Python.
The other key static analyzer question is "how easy is it to run and does that happen early in the development cycle?". A static analysis pass built right into the compiler and generating warnings every time you compile has the most chance of having its reports paid attention to. Something that runs at CI time is more annoying. Something that runs only on trunk a week or more behind the leading edge of development and which just lists its reported issues on a webpage somewhere is in grave danger of being outright ignored, or only read by one or two enthusiasts who are forever fixing up other peoples' code...
Re: Prusti: Static Analyzer for Rust
#36I have a notion of purity as well :P
I think the applications of this sort of thing are pretty limitless. Maybe rust has `unsafe` but with further verification extensions to the language we can really push confidence in a working, safe product.
Re: Prusti: Static Analyzer for Rust
#37I don't understand how this could work from looking at the readme. It says: > verifies absence of integer overflows and panics by proving that statements such as unreachable!() and panic!() are unreachable But integer overflows in release builds don't panic! and aren't unreachable!. Additionally, clippy already checks this for you if you enable an optional lint. So if it detects any panic! Then that's amazing. But if…
Re: Prusti: Static Analyzer for Rust
#38That looks incredibly useful. Proving the absence of panics and overflows is already great, and with the annotations you can guarantee properties you'd normally write property tests for, like in this example from the docs: impl List { #[ensures(self.len() == old(self.len()) + 1)] pub fn push(&mut self, elem: i32) { // TODO } }
Re: Prusti: Static Analyzer for Rust
#39Earlier quoted context omitted.
It is safe for the 70% of security flaws found out in languages like C and C++. The remaining 30% still need to be tracked down.
I wonder where you got those numbers from.
And from Google[1]: "memory safety bugs continue to be a top contributor of stability issues, and consistently represent ~70% of Android’s high severity security vulnerabilities."
[0] https://msrc-blog.microsoft.com/2019/07/22/why-rust-for-safe...
[1] https://security.googleblog.com/2021/04/rust-in-android-plat...
Re: Prusti: Static Analyzer for Rust
#40What are people's experiences with static analyzers at companies? Many people I have spoken with have either never heard of them, or expressed no interest. Usually those same people use dynamic languages like Ruby or Python.