canister-audit
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
${var} - Target selector. Three forms:
- `` (empty) -> auto-select the day's fresh feed target, audit only if it is a Rust IC canister, else exit clean. See §C1.
owner/repo-> audit that GitHub repo (e.g.dfinity/examples, a specific canister repo).fixture:<name>-> local regression mode: audit the bundled fixture atskills/canister-audit/fixtures/<name>/(e.g.fixture:token_vault). No fork, no dedup, no disclosure - a self-contained way to exercise the whole pipeline including the PocketIC proof arm. See §C1/§C2.Scope: Rust canisters only (ic-cdk / candid). Motoko is out of scope for this skill. There is no on-chain-by-address mode - an IC audit operates on source (a canister's logic is not recoverable from its deployed wasm the way verified EVM source is).
Today is ${today}. Read memory/MEMORY.md and the last 30 days of memory/logs/ before starting.
Why this skill exists
Canister bugs are logic and economics on a message-passing model, not syntax. The high-value classes - anonymous-principal access, TOCTOU across await, callback-trap-after-mutation, unbounded storage/cycle-drain DoS, upgrade-safety - are what an agentic reviewer catches by reading the source and reasoning about who can call what and which invariant breaks across an await. No off-the-shelf static tool models them: vuln-scanner and sc-audit have zero IC-aware analysis (Slither is Solidity-only; osv/cargo-audit cover Rust dependency CVEs, not canister logic). This skill is that missing IC arm.
It is sc-audit with the EVM pieces swapped for IC pieces and the shared machinery reused unchanged: the PoC gate (command mode), disclosure routing, dedup ledger, coverage manifest, report shape, and the staging/allowlist pattern. The agentic source pass (§C5) is the reliable core and needs no toolchain; Semgrep and the PocketIC proof arm are best-effort extras, so a clean audit never depends on either succeeding.
Shell shape. Each Bash call is one allowed command (pipes are fine). The run refuses a call that redirects into a file (> f, >> f, cat > f <<EOF, | tee f - /tmp included), sets a variable (REPO=...), starts with export, uses if / case / [ ... ] tests, joins commands with ; / && / ||, or uses find / cp / rm / tr / printf / command -v. So decide in prose from what each call printed, write the values you already know (<WORKDIR>, <SCRATCH>, <TARGET_COMMIT>, <REPO>, <FIXTURE>) into later commands literally in place of the placeholder, save tool output with a flag (--output / -o) or a node -e writer, copy files with python3, and write or append sources.txt/JSON artifacts with the Write/Edit tools. Only the working directory carries between calls; shell variables do not. <SCRATCH> is /tmp/canister-audit (the staging step sets CARGO_TARGET_DIR under it); gh, git, cargo, semgrep, node, python3, mkdir, cd are allowed by bare name (dep CVEs run via the cargo audit subcommand; the PocketIC server is launched by the repro's pocket-ic crate via POCKET_IC_BIN, not a bare command).