Back to Browse

Use with your AI agent

  1. Install — run npx skills add Kali-Decoder/Midnight-skills --skill midnight-security-checklist for this skill, or npx skills add Kali-Decoder/Midnight-skills for all
  2. Prompt — copy the example prompt and paste it into Cursor, Claude Code, or Codex
  3. Build — the agent loads this skill and scaffolds your Midnight work

Security Checklist

DomainAdvancedReviewedNewUpdated 3 days agov1.0.0

Agent picks this when: Run a pre-ship security and privacy gate

Pre-ship pass/fail security and privacy gate for a Midnight dApp: disclosure, cryptography, authorization, transaction semantics, keys, and deploy.

Good for

  • Pass/fail checklist over disclosure, crypto, witnesses, auth, transaction phases, keys, and deploy.
  • Each item links to the midnight-security section that explains it.

Preview in agent

Suggested prompts

Run a pre-ship security and privacy gate. Use the "midnight-security-checklist" skill from MIDSKILLS. Follow Compact smart-contract best practices, wire wallet flows where needed, and explain each step as you implement. Target Midnight Preprod unless I specify otherwise.

Loaded skill midnight-security-checklist

What the skill guides the agent to do:

  1. Pass/fail checklist over disclosure, crypto, witnesses, auth, transaction phases, keys, and deploy.
  2. Each item links to the midnight-security section that explains it.

Illustrative — based on the skill's description, not recorded agent output.

Try it without installing: npx skills use Kali-Decoder/Midnight-skills@midnight-security-checklist

What changed in v1.0.16

All registry changes

New skill — first published in v1.0.16 (not in v1.0.14).

On this page · 8 sections
SKILL.md

Midnight Security Checklist

A gate, not a tutorial: go through every box, mark it pass / fail / n.a., and report the failures. The why and the fixes live in midnight-security/ (section numbers below).

What this skill produces: a filled checklist with a verdict (ship / fix first) and one line per failed item.

Workflow

  1. List every .compact file, every witness implementation (witnesses.ts), and every place the frontend handles secrets.
  2. Walk sections A–F in order. Answer each item for each contract; quote the line when something fails.
  3. Any fail in A, B, or C blocks a mainnet deploy. Fails in D–F are reported with a severity.
  4. Run midnight-testing-checklist too: every security property you rely on needs a negative test that proves it.
  5. Report: the verdict, then the failures with file:line and the matching midnight-security section.

A. What is public (midnight-security §1–§4)

  • Every export ledger field is meant to be public; per-user data that only its owner needs stays in private state.
  • No sensitive value is a circuit argument (all arguments are in the public transcript); secrets come from witnesses.
  • Every disclose() is intentional: you can say in one sentence why that value may become public.
  • Map keys are not sensitive (keys are public on insert and lookup).
  • Anonymous membership uses MerkleTree / HistoricMerkleTree, not Set.member (which reveals the element).
  • Every emit(...) sends only disclosed values: events are public, indexed, and permanent (§5b).
  • Calling the circuit at all does not leak intent you meant to hide (e.g. a submitVote call reveals that someone voted).

B. Cryptography (midnight-security §2, §4, §9)

  • No persistentHash over a small value space (bool, vote, role, small amount): use persistentCommit with a fresh nonce.
  • No nonce is reused across commitments.
  • Every hash / commitment has a unique domain separator; a commitment and its nullifier use different ones.
  • Ledger-stored hashes use persistent*, never transient*.
  • Signatures (secp256k1EcdsaVerify) verify a hash you computed in-circuit with domain separation, the result is asserted, and no signature or signature hash is used as a nullifier or replay key (§5b).

C. Authorization and witnesses (midnight-security §2, §5, §7)

  • Every witness output is validated with assert before it drives logic: the proof only guarantees what the circuit checks.
  • Every privileged circuit checks authority in-circuit (hash-based key, Merkle membership, or kernel.caller() with is_some checked); none trusts the frontend.
  • Replay is impossible: one-shot actions use a nullifier set, repeated auth includes a round or counter.
  • Cross-contract callees are compared against a stored address before their results are trusted (§5b).
  • Every invariant the contract relies on is an assert, not a comment.

D. Transaction semantics (midnight-security §6)

  • Nothing consequential happens in the guaranteed phase if the fallible phase can still fail (partial success is permanent).
  • No assert in a fallible path can be tripped by state an attacker changes between proving and submission (fees are forfeited).
  • Order-sensitive actions (swaps, auctions) carry bounds or use commit-reveal against front-running.
  • Uint<N> widths hold every value (Uint<64> for Unix seconds, bigint amounts in Stars); casts are bounds-checked.
  • Merkle tree depth covers the expected maximum (inserting into a full tree fails) (§8).

E. Keys, secrets, and the frontend

  • No mnemonic, seed, private key, Blockfrost token, or .env file is committed (git log -p / a secret scanner).
  • User secrets (commitment nonces, private state) are stored where the user can recover them, and the UI says what is lost if they are cleared.
  • Private-state storage uses a strong password provider (16+ chars, 3 classes).
  • The UI explains the privacy boundary before any action that discloses something (e.g. an unshielded payout reveals the recipient).

F. Build and deploy

  • midnight-doctor reports 0 fail: the deployed contract was compiled by the pinned toolchain.
  • Deployed artifacts (compiler/, keys/, zkir/) come from the same build as the audited source.
  • After a recompile that changes verifier keys, callers and callees are re-audited together and redeployed (§5b).
  • Who holds the contract maintenance authority, and what they can change, is written down for users.
TaskSkill
Explanations, leak patterns, defensive codemidnight-security/
Prove each property with testsmidnight-testing-checklist/
Version and toolchain gatemidnight-doctor/

Start in 2 steps

  1. 1. Install — one skill or the full set
  2. 2. Prompt — paste the example into your agent

Install all skills (recommended)

npx skills add Kali-Decoder/Midnight-skills

One command adds every Midnight skill to Cursor, Claude Code, and similar agents.

Install this skill only

npx skills add Kali-Decoder/Midnight-skills --skill midnight-security-checklist

Installs only "midnight-security-checklist" into every detected agent (Cursor, Claude Code, Codex, …).

Example agent prompt

Run a pre-ship security and privacy gate. Use the "midnight-security-checklist" skill from MIDSKILLS. Follow Compact smart-contract best practices, wire wallet flows where needed, and explain each step as you implement. Target Midnight Preprod unless I specify otherwise.

Paste into Cursor, Claude Code, or Codex after installing.

Author
Tusharpamnani
Category
Domain
Difficulty
advanced
Version
v1.0.0

Tags

SecurityPrivacyAuditChecklist

Files included

SKILL.md
Create Social CardLive HackathonsGallery
Mock Demo
Security Checklist