agentic-actions-audito…
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI,…
Extracts protocol message flow from source code, RFCs, academic papers, pseudocode, informal prose, ProVerif (.pv), or Tamarin (.spthy) models and generates Mermaid sequenceDiagrams with cryptographic annotations. Use when diagramming a crypto protocol, visualizing a handshake
Claude Code
$ npx -y skills add trailofbits/skills --skill crypto-protocol-diagram --agent claude-code
Codex
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a codex -y
Cursor
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a cursor -y
Gemini CLI
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a gemini-cli -y
GitHub Copilot
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a github-copilot -y
OpenCode
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a opencode -y
Windsurf
$ npx skills add trailofbits/skills --skill crypto-protocol-diagram -a windsurf -y
name: crypto-protocol-diagram description: "Extracts protocol message flow from source code, RFCs, academic papers, pseudocode, informal prose, ProVerif (.pv), or Tamarin (.spthy) models and generates Mermaid sequenceDiagrams with cryptographic annotations. Use when diagramming a crypto protocol, visualizing a handshake or key exchange flow, extracting message flow from a spec or RFC, diagramming a ProVerif or Tamarin model, or drawing sequence diagrams for TLS, Noise, Signal, X3DH, Double Ratchet, FROST, DH, or ECDH protocols."
Produces a Mermaid `sequenceDiagram` (written to file) and an ASCII sequence diagram (printed inline) from either:
ProVerif (`.pv`), or Tamarin (`.spthy`) model.
**Tools used:** Read, Write, Grep, Glob, Bash, WebFetch (for URL specs).
Unlike the `diagramming-code` skill (which visualizes code structure), this skill extracts **protocol semantics**: who sends what to whom, what cryptographic transformations occur at each step, and what protocol phases exist.
For call graphs, class hierarchies, or module dependency maps, use the `diagramming-code` skill instead.
| Rationalization | Why It's Wrong | Required Action | |-----------------|----------------|-----------------| | "The protocol is simple, I can diagram from memory" | Memory-based diagrams miss steps and invert arrows | Read the source or spec systematically | | "I'll skip the spec path since code exists" | Code may diverge from the spec — both paths catch different bugs | When both exist, run spec workflow first, then annotate code divergences | | "Crypto annotations are optional decoration" | Without crypto annotations, the diagram is just a message flow — useless for security review | Annotate every cryptographic operation | | "The abort path is obvious, no need for alt blocks" | Implicit abort handling hides missing error checks | Show every abort/error path with `alt` blocks | | "I don't need to check the examples first" | The examples define the expected output quality bar | Study the relevant example before working on unfamiliar input | | "ProVerif/Tamarin models are code, not specs" | Formal models are specifications — they describe intended behavior, not implementation | Use the spec workflow (S1–S5) for `.pv` and `.spthy` files |
---
Protocol Diagram Progress: - [ ] Step 0: Determine input type (code / spec / both) - [ ] Step 1 (code) or S1–S5 (spec): Extract protocol structure - [ ] Step 6: Generate sequenceDiagram - [ ] Step 7: Verify and deliver
---
Before doing anything else, classify the input:
| Signal | Input type | |--------|-----------| | Source file extensions (`.py`, `.rs`, `.go`, `.ts`, `.js`, `.cpp`, `.c`) | **Code** | | Function/class definitions, import statements | **Code** | | RFC-style section headers (`§`, `Section X.Y`, `MUST`/`SHALL` keywords) | **Spec** | | `Algorithm`/`Protocol`/`Figure` labels, mathematical notation | **Spec** | | ProVerif file (`.pv`) with `process`, `let`, `in`/`out` | **Spec** | | Tamarin file (`.spthy`) with `rule`, `--[...]->` | **Spec** | | Plain prose or numbered steps describing a protocol | **Spec** | | Both source files and a spec document | **Both** (annotate divergences with `⚠️`) |
the implementation against the spec diagram and annotate any divergences with `⚠️`
document, or both?"
---
Grep for function names, type names, and comments that reveal the protocol:
# Find handshake, session, round, phase entry points
rg -l "handshake|session_init|round[_0-9]|setup|keygen|send_msg|recv_msg" {targetDir}
# Find crypto primitives in use
rg "sign|verify|encrypt|decrypt|dh|ecdh|kdf|hkdf|hmac|hash|commit|reveal|share" \
{targetDir} --type-add 'src:*.{py,rs,go,ts,js,cpp,c}' -t src -lStart reading from the highest-level orchestration function — the one that calls into handshake phases or the main protocol loop.
Extract participant names from:
`Verifier`, `Dealer`, `Party`, `Coordinator`
Map these to Mermaid `participant` declarations. Use short, readable aliases:
participant I as Initiator participant R as Responder
Follow state transitions and network sends/receives. Look for patterns like:
| Pattern | Meaning | |---------|---------| | `send(msg)` / `recv()` | Direct message exchange | | `serialize` + `transmit` | Structured message sent | | Return value passed to other party's function | Logical message (in-process) | | `round1_output` → `round2_input` | Round-based MPC step | | Struct fields named `ephemeral_key`, `ciphertext`, `mac`, `tag` | Message content
Trail of Bits skills and plugins for AI-assisted security analysis, testing, and development. Install this marketplace in Claude Code or Codex, or import it into your ChatGPT workspace marketplace.
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI,…
Understand a codebase before looking for bugs in it - what each function assumes, what it guarantees, and what it depends on…
Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing…
Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools,…
Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging…
Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…