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-ic crate (e.g. 16.1). With POCKET_IC_BIN unset, PocketIc::new() downloads the matching server release from dfinity/pocketic on first use. To pin a binary you have verified (sha256) instead, point POCKET_IC_BIN at it; the server's major version must match the crate's.

The audit workflow

Installs
17
GitHub Stars
40
First Seen
8 days ago