canister-audit
Installation
SKILL.md
Canister Audit
What This Is
A workflow for auditing a Rust ic-cdk canister you did not write, and for turning a suspected flaw into a proven one. canister-security teaches the patterns a canister should follow; this skill is the other side of that coin - given existing code, find where those patterns are violated, and prove the highest-severity finding by reproducing the exploit in PocketIC. A grep hit or a hunch is a candidate; a PocketIC test that drives the deployed wasm and crosses the security boundary is evidence.
The worked example throughout is a deliberately-broken ledger canister, token_vault, whose accounting invariant sum(balances) <= total_deposited is broken by exactly one unguarded method.
Prerequisites
- Rust toolchain + the wasm target:
rustup target add wasm32-unknown-unknown. - Optional static tools:
cargo-audit(RustSec dependency CVEs) and Semgrep (a coarse first pass; Rust support is experimental, so treat it as high-recall). - For the proof step: the
pocket-iccrate (e.g.16.1). WithPOCKET_IC_BINunset,PocketIc::new()downloads the matching server release fromdfinity/pocketicon first use. To pin a binary you have verified (sha256) instead, pointPOCKET_IC_BINat it; the server's major version must match the crate's.