/dstack-security:mermaid-to-proveriffrom DStack Security
Converts cryptographic Mermaid sequence diagrams into ProVerif models to check secrecy, authentication, replay, and forward secrecy.
Ships in DStack Security. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You turn a cryptographic Mermaid sequence diagram into a ProVerif model that checks what the diagram actually shows, then you run ProVerif and report each result honestly. You never invent cryptographic semantics the diagram does not contain. This skill writes only the named .pv model and report files, and rollback is deleting uncommitted files. Not for remote, credential, publish, deploy, or irreversible changes.
sequenceDiagram block or file containing at least two named participants and at least one message between them.secrecy, authentication, replay, forward_secrecy. Defaults to all four when not specified..pv). Defaults to <diagram-name>.pv.Parse the Mermaid sequenceDiagram into an abstract syntax tree. Extract every named participant and every directed message (A->>B: label). Record message order. Identify cryptographic operation keywords in each label: encrypt, sign, hash, sharedkey, dh, pk, sk. A label with no recognized keyword is a plaintext transfer over the channel type indicated by the arrow style (solid for public, dotted for private).
Define the Dolev-Yao cryptographic model from the keywords found above. This stage sets the primitive vocabulary the message mapping below translates into, so free form Mermaid labels become valid ProVerif constructs.
Declare types: key, bitstring, and any protocol specific types the labels reference.
Declare constructors for each cryptographic operation the diagram uses:
| Mermaid keyword | ProVerif constructor |
|---|---|
encrypt | fun enc(bitstring, key): bitstring |
pk | fun pk(key): key |
sk | fun sk(key): key (or free for long term keys) |
sign | fun sign(bitstring, key): bitstring |
hash | fun hash(bitstring): bitstring |
sharedkey | fun sharedkey(key, key): key (or a KDF) |
dh | fun dh(key, key): key (Diffie Hellman combine) |
Declare destructors for the inverse operations:
| Operation | ProVerif destructor |
|---|---|
| decrypt | reduc forall m: bitstring, k: key; dec(enc(m, k), k) = m |
| verify signature | reduc forall m: bitstring, k: key; getmsg(sign(m, sk(k)), pk(k)) = m |
A diagram operation with no standard Dolev-Yao primitive stops the run here: report the unsupported construct instead of inventing semantics.
Define channels: a public channel c for messages on public networks (the Dolev-Yao attacker controls these), and private channels for messages the diagram annotations mark authenticated or confidential. The attacker is the standard Dolev-Yao attacker: it can intercept, modify, replay, and compose messages on public channels but cannot break cryptographic primitives.
Represent each participant as a let p = ... process in ProVerif. Map each actor declaration to new p:name;.
Convert each message into process actions using the primitives above:
A->>B: m over a public channel becomes out(c, m) in A and in(c, x: bitstring) in B.A->>B: encrypt(m, k) becomes out(c, enc(m, k)) and in(c, x: bitstring); let m = dec(x, k).A->>B: sign(m, sk_A) becomes out(c, sign(m, sk_A)) and in(c, x: bitstring); let m = getmsg(x, pk(sk_A)).out(c, hash(m)) with no destructor (hash is one way).out/in pairs for the public values plus a sharedkey or dh computation on each side.Emit event(e_sent(A, m)) before each out and event(e_received(B, m)) after each in, preserving the message order from the parse. These events anchor the reachability and authentication queries below.
Write the .pv model file. Prefix it with a (* ADAPTED FROM: Trail of Bits mermaid-to-proverif skill; CC-BY-SA-4.0; https://github.com/trailofbits/skills *) comment block and a (* ASSUMPTIONS: <list of assumptions> *) block derived from the diagram annotations or human supplied constraints.
Append one reachability query query event(e_start) ... event(e_end) ... for each end to end message sequence before any security query, so reachability is established before security results are trusted.
Then append security queries for the requested properties:
secrecy: query secret ~m.; per sensitive message variable m.authentication: query event(e_received(A,m)) ==> event(e_sent(B,m)). per message variable m.replay: query not event(replay_attempted). per identified vulnerable transition.forward_secrecy: query secret ~m. @weak_agree ... per session key derived variable.Execute proverif <output>.pv. Collect the type check result, all query results, and any WARNING or RESULT line.
Validate the output: the type check must succeed; participant sends and receives in ProVerif must correspond to the original diagram participants; each security query must be preceded by a proved reachability query; all assumptions listed in the file header must be acknowledged in the report.
Write the verification report to <output>_report.txt containing type check status, participant correspondence confirmation, each reachability result, each security query result, and the assumption list.
RESULT i: noninterference_interpreted_as_secrecy_not_proved or equivalent). Never report it as proved.verification_inconclusive with the concrete reason. Claim no success..pv model file with the converted protocol model, Dolev-Yao primitive declarations, assumption block, reachability queries, and security queries.<output>_report.txt with type check status (SUCCESS or failure detail), participant correspondence confirmation or mismatch report, each reachability result, each security query result with RESULT classification, and the complete assumption list.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gosuda/dstack-skills --plugin dstack-security16 skills in this plugin
/chain-vulnerability-scannerUse when an Algorand, Cairo, Cosmos SDK, Solana, Substrate, or TON codebase needs vulnerability scanning with reachability-backed findings. Not for non-chain review: use security-review./codeql-security-analysisUse when building or reusing a CodeQL database, running CodeQL security analysis, or modeling project-specific sources and sinks. Not for manual vulnerability review: use security-review (mode: confirmed)./c-security-reviewUse when the user requests a userspace C or C++ security review with a threat model and severity filter and wants validated findings. Not for kernel or bare-metal code./function-audit-context-analyzerUse when asked for audit-context analysis of one function, or to build audit context across codebase before vulnerability hunting. Local write only. Not for vulnerability finding or severity rating./project-findings-onto-graphUse when graph-backed security analysis is needed: project SARIF or reviewer findings onto a program graph; build or query a multi-language graph; summarize Trailmark structure; map smart-contract entry points; compare two refs or snapshots; or hunt confirmed vulnerability variants with pattern or graph seeding. Select findings, build-program-graph, trailmark-structural, entry-point-analyzer, graph-evolution, or variant-hunt mode and supply its required inputs. Not for initial vulnerability discovery: use security-review. Not for verifying one named allegation: use security-finding-verification. Not for security-finding triage: use triage-security-finding. Not for unrelated remote, credential, publish, deploy, or irreversible work./security-finding-verificationUse when a named security allegation needs a true-positive or false-positive verdict. Not for discovering bugs: use security-review. Not for adding controls.Other plugins' skills for the same job