Hello there!
I’m David Semakula, the creator of pallet-verifier - a tool for detecting common security vulnerabilities and insecure patterns in FRAME pallets using static program analysis techniques like data-flow analysis, abstract interpretation and symbolic execution.
I’ll be using this thread to share regular updates about new feature releases for the project (you can also use this project board for a high-level overview of currently planned features).
But first, some background/history and a re-introduction.
NOTE: You can skip ahead to the first update post if you’ve already read the introductory blog post (and/or the accompanying forum post).
Background
pallet-verifier
was created in response to an RFP (Request for Proposal) from the Web3 Foundation and received initial funding from the Web3 Foundation’s technical Grants Program.
Overview
At the highest level, pallet-verifier
is a custom Rust compiler (rustc) driver which uses MIRAI as a backend for abstract interpretation (and in the future, also as a tag and taint analysis engine). It’s also distributed as a custom cargo sub-command (i.e. cargo verify-pallet
), to facilitate a seamless and familiar developer experience.
One key architectural property of pallet-verifier
is that unlike linting tools which simply detect problematic syntactic patterns (e.g. clippy, dylint e.t.c), pallet-verifier
(using MIRAI) goes beyond this by performing a flow, path and context-sentitive analysis (see also) which evaluates the reachability of problematic code paths/program states before issuing warnings.
As a concrete example, pallet-verifier
will not issue a warning for the following code block, because the branch condition precludes an arithmetic overflow.
fn bounded_increment(x: u8, bound: u8) -> u8 {
if x < bound {
x + 1 // this cannot overflow because `bound <= u8::MAX`
} else {
bound
}
}
Useful Resources
- Check out
pallet-verifier
’s GitHub repository for installation and usage instructions, as well access to the source code (including detailed inline source documentation) e.t.c. - Visit the GitHub project board for a high-level overview of currently planned features, and/or create an issue to report bugs or make feature requests/proposals (PRs are also welcome
).
- Dive into the full introductory blog post (and/or the accompanying forum post) to learn more about
pallet-verifier
’s launch capabilities and architecture (see also). Key highlights include details about:- Automatic entry point generation which makes analysis with MIRAI tractable and efficient (and reasonably sound), which is a challenge for MIRAI for our use case because FRAME is inherently a generic framework, while unit tests as entry points for abstract interpretation suffer from under-approximation of program semantics and/or inefficient use of resources.
- Automatic invariant annotation infrastructure for either adding checks that aren’t included by the default Rust compiler (e.g. overflow checks for narrowing and/or lossy integer cast/
as
conversions), or declaring invariants that can’t be inferred from source code alone, to improve the accuracy of the verifier and reduce false positives (e.g. iterator invariant annotations).
And with that, we’re ready for our first update post below !