/appsec-skills:security-experimentfrom appsec-skills
Builds a runnable notebook that demonstrates why a security control makes a sink safe (or why its absence doesn't) by tracing a payload through the application's real steps.
Ships in appsec-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Answer one question with a notebook the user runs step by step: "The sink is dangerous. Why does this control make it safe?" (or "why doesn't it?"). It should be a 2–3 minute read: the user presses Shift+Enter on each cell and watches the payload survive every step without the control, then disappear at the control's step.
comments.ejs:18 is safe because of DOMPurify"), or a control to demonstrate.experiments/<id>.ipynb.If docs/triage/*.md or docs/traces/*.trace.json exist, read the finding and its trace first:
they give the sink, the control, the steps in between, and the "would become a true positive if"
conditions to mention.
${CLAUDE_PLUGIN_ROOT}/skills/security-experiment/templates/show.ts: the step logger. Copy it to
experiments/lib/show.ts.${CLAUDE_PLUGIN_ROOT}/skills/security-experiment/scripts/notebook.mjs: build (cells file →
notebook) and verify (runs a copy, prints every cell's output, checks the saved notebook is
empty). Run from the repo root.<img src="x" onerror="alert('XSS')">,
' OR '1'='1 for a query shown as text, a ../ path resolved against a temp folder). Nothing
that reaches real systems, reads real secrets, or changes data. Never send it to a running app.experiments/.deno). Import the app's
libraries with pinned npm: specifiers (npm:[email protected], versions from
package-lock.json), and add experiments/deno.json with { "nodeModulesDir": "none" }, so
Deno uses its own npm cache instead of the repo's node_modules (some packages, like jsdom's
dependencies, don't load from there). Set libraries up the way the app does (e.g.
isomorphic-dompurify is DOMPurify on a jsdom window). App modules without dependencies, and
templates read from disk, can be used directly.python3 notebook that imports the app's modules.Prerequisites: jupyter (e.g. pipx install jupyter --include-deps) and, for Deno,
deno jupyter --install. If they're missing, tell the user the install commands; don't install
system packages yourself.
Write the cells in a Markdown file, then build it:
node ${CLAUDE_PLUGIN_ROOT}/skills/security-experiment/scripts/notebook.mjs build experiments/<id>.cells.md experiments/<id>.ipynb.
Every fenced ```ts / ```python block becomes a code cell; the text between becomes a
markdown cell (split with <!-- cell -->).
# Why <control> makes <sink> safe. Two or three sentences:
the sink (file:line, what it does with the value, why the scanner flags it), and the one line
of app code that holds the control, quoted.setDanger([...]) with the payload's active part (what makes it dangerous
at this sink), the payload, and the step variables declared with let so any cell can be
re-run. Prints nothing.## Without <control> heading): one step per cell, each with a
one-line bold heading (**2 · Markdown → HTML** (\marked.parse`)) and a code cell that does exactly one thing and logs it: input = payload; log('input', input);, then each app step, then the sink's real output (e.g. the rendered page fragment, cut out with its indentation and passed through dedent()`). Then one sentence on what the browser,
database or filesystem would do with it.## With <control>: what the app does): the same steps again, one per
cell, with the control starting its own cell (sanitized = DOMPurify.sanitize(html);), so the
payload is visibly there in the cell before and gone in this one. In the same cell, list what the
control removed or rejected and why (logList). Finish with the sink's real output again.payload,
then re-run the cells.Output rules, learned the hard way:
console.log per step (log/logList do this). The Deno kernel can drop a cell's output
when it is sent in many small pieces.readTextFileSync), so each
cell's output is complete when the cell finishes.build writes it empty.node ${CLAUDE_PLUGIN_ROOT}/skills/security-experiment/scripts/notebook.mjs verify experiments/<id>.ipynb --markdown experiments/<id>.md
It runs a copy and prints what every cell printed. Check it tells the story: ⚠️ with the active
part at every step without the control, ⚠️ up to the step before the control, ✅ from the control's
step on, and the sink's real output at the end of both halves. Fix and rebuild until it does and
verify passes. Keep the .cells.md next to the notebook: it's the source.
Tell the user: the notebook path; how to run it (VS Code with the Jupyter extension → Select
Kernel → Jupyter Kernel… → Deno or Python; if the Deno kernel isn't listed, select a Python
interpreter that has Jupyter installed, then reload the window); the story in four lines (payload,
where it survives, where the control removes it, what reaches the sink); and the readable copy
(experiments/<id>.md).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub mohamed-osama-aboelkheir/appsec-untangled-resources --plugin appsec-skills6 skills in this plugin
/code-walkthroughExplain how a feature or a code location works as a numbered walkthrough: a Mermaid sequence diagram (UI → HTTP → app → route → auth → controller → service → store → database) and a matching VS Code CodeTour whose steps highlight the exact code, with real request/response and error examples. Starts from a route, a feature, or a code location such as a SAST/Semgrep finding's sink, and finds the routes that reach it. Use when asked to walk through, trace, diagram, explain or "code tour" a flow, route, feature or finding./secure-code-reviewThreat-model-first security code review of a pull request, commit or diff. Builds the story of the change, lists entry points and dangerous sinks, picks the relevant threats from the AppSec Untangled wiki, checks each mitigation against the code, and writes Markdown and HTML reports with evidence. Use when asked for a security review of a PR, commit, branch or diff./semgrep-triageTriage Semgrep (or other SAST) findings: for each finding, trace the flagged value back to its sources, check the controls on the path against the AppSec Untangled wiki, and decide true or false positive, severity (impact × likelihood) and confidence. False positives get a decision on whether to disable or suppress the rule. Writes one Markdown report with source-to-sink diagrams, CodeTours and manual reproduction steps for every finding. Supports a learn mode where the user decides first. Use when asked to triage, review, validate or prioritise scanner findings, or to check whether a finding is exploitable or a false positive./source-to-sinkTrace how data flows between sources and dangerous sinks, like a SAST dataflow trace, and explain it as a diagram of code cards plus a VS Code CodeTour that highlights the value on every line. Backward mode starts from a sink (a file:line, or a Semgrep/SAST finding) and finds every source that reaches it and whether it is user input, and which users can send it. Forward mode starts from an input (a parameter, header, body field, or all inputs of a route) and finds every dangerous sink it reaches, or where it stops. Use when asked what reaches a sink, whether a finding's input is user-controlled, where an input goes, or for a source-to-sink / taint / dataflow trace./threat-modelBuilds a threat model with the Doors, Windows & Holes method from the AppSec Untangled wiki, for a design doc, a feature description, an architecture or a repository. Writes the problem and stories, answers the template's scope questions, groups doors (entry points), windows (hidden entry points) and holes (dangerous sinks), adds business-logic and source-to-sink threats with shared mitigations, and ends with a testing plan of point-in-time and continuous tests per mitigation. Runs in four stages with a user review after each (stories, doors/windows/holes, threats and mitigations, tests) unless asked for one shot. Outputs Markdown and JSON, and can fill the Notion threat model template. Use when asked to threat model a system, feature, design or repo.