Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

icp-deploy-check

БесплатноБез исполняемых скриптовНе проверен

Pre-deploy safety gate for an Internet Computer Rust canister (ic-cdk). A fast, read-only checklist for the five deploy-time footguns that brick a canister or…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

ICP deploy check

Run this static, read-only gate over a Rust canister repo before a mainnet deploy. It reads source and reports; it never deploys, never calls mainnet, never needs a key. The fix patterns behind each check live in the canister-security skill — this skill is the checklist, that one is the reference.

Scope: every update entrypoint and the init/pre_upgrade/post_upgrade hooks in the Rust ic-cdk canister(s), plus any frontend or agent code in the same repo (check #2 only). Produce one row per check: PASS / FAIL / REVIEW / N/A with file:line evidence.

Enumerating update entrypoints

Checks #1 and #3 both start from the full list of update methods. Match the attribute with or without arguments — #[update(guard = "...")], #[update(name = "...")] and #[ic_cdk::update(manual_reply = true)] are all entrypoints:

rg -n -A4 '#\[(ic_cdk::)?update\b'

\b matches both update] and update(; a bare 'update\]' pattern silently skips every parameterized entrypoint. Record each method's name, its attribute arguments (especially guard = "..."), and its body.

Callers are read with ic_cdk::api::msg_caller() (ic-cdk >= 0.18). Older code uses ic_cdk::caller() / ic_cdk::api::caller() — treat them as equivalent when tracing.

The five checks

1. Anonymous principal reaches a state change — FAIL if reachable

Every state-changing update must reject Principal::anonymous() before its first mutation.

  • Trace, don't pattern-match. For each update that mutates state (writes a thread_local!/stable structure, credits/debits a balance, mints, sets config, makes a state-changing inter-canister call), confirm that on every path to the mutation the call is rejected (trap, Err return, or guard Err) when the caller is anonymous. Accept any of:
    • an explicit comparison against Principal::anonymous() (== with trap/return, or != gating the mutation), on msg_caller() or a variable bound to it;
    • a guard = "fn_name" attribute — open fn_name and confirm its body returns Err for the anonymous principal;
    • a controller/owner/allowlist check that rejects the caller (anonymous can never be a controller). An owner-equality check counts only if the owner can never be anonymous — RefCell::new(Principal::anonymous()) as the default owner with no require_authenticated first means anonymous is the owner until init runs.
  • Not authentication — FAIL if these are the only "guard":
    • CallerGuard / per-caller locks / PENDING sets: these are reentrancy locks, they accept the anonymous principal like any other;
    • a guard identified only by its name (require_caller, check_access, ...) without reading its body;
    • is_controller(...) or a comparison whose result is computed but never acted on, or that runs after the mutation.
  • An update that is deliberately open to anonymous callers (e.g. a public counter, an open sign-up whose cost is bounded) is REVIEW, not FAIL — state why it is intended. Query methods cannot persist state and are out of scope.

2. fetch_root_key in shipped code — FAIL if present

fetch_root_key() (Rust ic-agent) / fetchRootKey() (JS agent) fetches the root public key from the replica it is talking to and trusts it. If that code runs against mainnet, a man-in-the-middle can substitute its own key and forge every certified response. This lives in frontend or agent/client code, not in the canister, so scan the whole repo:

rg -n 'fetch_root_key|fetchRootKey|shouldFetchRootKey'
  • FAIL on any occurrence in a shipped frontend or client path — even behind an environment check (if network === "local", process.env.DFX_NETWORK, #[cfg(feature = "local")]): environment branching is how the call leaks into production builds. The fix is to stop fetching it: pass the root key from the ic_env cookie (IC_ROOT_KEY, via safeGetCanisterEnv()) as rootKey to HttpAgent.create(). See canister-security for the full pattern.
  • Not a finding: test-only code (#[cfg(test)], tests/, PocketIC harnesses, scripts that only ever target a local replica) — mark PASS with a note.

3. Unguarded admin / privileged method — FAIL if not privileged-guarded

Mint / burn / migrate / upgrade / config / set_* / withdraw updates must be restricted to a controller, owner or admin — not merely to authenticated users.

  • Candidates: from the enumerated update list (not a separate grep), take every method whose name contains — anywhere, not only as a prefix — (?i)(mint|burn|admin|migrate|upgrade|config|set_|withdraw|transfer_from|owner|controller|pause|allowlist|whitelist). Name matching only finds candidates: an update whose visible body changes fees, ownership, other users' balances, or canister-wide settings is privileged regardless of its name. A user-facing method acting on the caller's own a
Полный SKILL.md на GitHub

Установить icp-deploy-check в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSESOURCE.mdTRUST.auto.yaml

FAQ

Что делает скилл icp-deploy-check?

Pre-deploy safety gate for an Internet Computer Rust canister (ic-cdk). A fast, read-only checklist for the five deploy-time footguns that brick a canister or let anyone drain it - anonymous-principal access, fetch_root_key in shipped code, unguarded admin methods, pre_upgrade traps, single controller - with grep signals, the tracing rules to confirm each hit, and a PASS/FAIL/REVIEW report. Use before `icp deploy -e ic` (or `dfx deploy --network ic`), in CI, or when asked whether a canister is ready or safe for mainnet. For the secure-coding patterns themselves, use canister-security.

Как установить скилл icp-deploy-check?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл icp-deploy-check запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить icp-deploy-check с