/appsec-skills:source-to-sinkfrom appsec-skills
Traces dataflow from sources to dangerous sinks (backward from a sink or forward from an input), producing code-card diagrams and VS Code CodeTours. Useful for SAST finding validation, taint analysis, and security review.
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.
Follow one value at a time through the code and show its path as a chain of code cards: where it enters, every line that passes or renames it, and the sink it reaches (or where it stops). The reader should see the path in five seconds, and then follow it line by line in the tour.
src/repositories/orderRepository.js:10), a
function call, or findings in a scanner report (semgrep.json). One trace per sink.req.query.file on GET /exports), or a route, in which
case trace every input it reads. One trace per input.docs/traces/ for specs and pages, .tours/ for
tours.If the mode is unclear, a location or finding means backward, an input or route means forward. If the target itself is ambiguous, ask once.
${CLAUDE_PLUGIN_ROOT}/skills/source-to-sink/references/trace-spec.md: the spec format.
Read it before writing a spec.${CLAUDE_PLUGIN_ROOT}/skills/source-to-sink/scripts/trace.mjs: builds and checks the outputs.
Run it from the target repo root.${CLAUDE_PLUGIN_ROOT}/wiki/docs/threats/source-to-sink/: the sink catalogue for forward mode,
one page per threat (SQL injection, NoSQL injection, SSRF, path traversal, XSS, SSTI, open
redirect, client-side path traversal). Per-stack sinks and safe patterns are in
${CLAUDE_PLUGIN_ROOT}/wiki/examples/<threat-file-name>/<stack>.md (What to grep for,
Mitigation options). Read only the files for the project's stack, one threat at a time.stop card that says so.docs/flows/*.flow.json), or derived from the
code and labelled (derived from code, not run).If docs/flows/*.flow.json exists (from the code-walkthrough skill), read the flow that
contains the sink or the source before you start: it gives the route, the auth and role gates
(who can send an input), the captured example requests, and the file order. Don't copy its steps.
A trace follows one value, not the whole request. If it doesn't exist, work from the code.
readFile, the
URL passed to the HTTP client. Values passed safely (bound parameters) are not traced.a || b, ternary, concatenation, template) → each operand is its own path.user, identity, config, constant,
stored, external; see the spec). For user input, record who can send it from the
route's middleware (anonymous, any logged-in user, a role). For config or stored data, record
who can write it.stored in comments.body, read back for every visitor), and the source is the writer's
input, with who can write it and who receives it in its label. Only stop at a stored source
when nothing in the codebase writes the field (a migration, another service), and say so.stop
card. The value that continues (the config entry, the database row) is a new source with its
own origin. This is the difference between "user input reaches the sink" and "user input
picks which trusted value reaches the sink".gap.from in the spec).source-to-sink threat pages, using
the stack's What to grep for. A use that matches is a sink card, labelled with the sink
type (SQL text, file path, outbound URL, HTML output, redirect, template).stop card when the value is neutralised (cast to a number, checked
against an allowlist, parameterised, sanitised for this sink type), only compared or used as a
key, or leaves the code you can see.stop card
(stored in comments.body), then follow the readers of that field one level, as a new
path with origin stored. Say that you stopped at one level.If the app can run locally (README, package.json, docker-compose), start it and send one normal
request that exercises the path, so each card can say what the value is at that point
(orderBy = 'total'). Reuse walkthrough examples if they exist. Otherwise derive the values from
the code and label them.
One docs/traces/<id>.trace.json per sink (backward) or per input (forward), in the format of
${CLAUDE_PLUGIN_ROOT}/skills/source-to-sink/references/trace-spec.md.
gap/control)
where they occur, then its hops, then the sink or stop. Put a path that stops before the path
that reaches the sink.async function find(userId, status, orderBy)) whenever the value is renamed on the way in.label or description.gap, control) attach to the card whose line they guard, usually the next hop
after the check. Include the route's auth gate as a control on the user-input source when it
decides who can send it.module.exports that holds them.**bold**.orderBy), or the rename (sort → orderColumn).
Never start it with an arrow.SOURCE: req.query.sort, sort → orderColumn, Check on the path: status allowlist, User input stops here, SINK: ORDER BY ${orderBy}.**Source:** / **Propagates:** / **Sink:** (what happens to
the value) · **Value here:** (the example) · any control or second source on this line ·
**Next →** ... (step N). The sink card ends with what the sink receives for the example, and a
one-line summary of the path (origin → controls → sink).order and chain them with next.node ${CLAUDE_PLUGIN_ROOT}/skills/source-to-sink/scripts/trace.mjs build docs/traces
node ${CLAUDE_PLUGIN_ROOT}/skills/source-to-sink/scripts/trace.mjs check docs/traces
Fix every problem (a pattern matched 0 or 2+ times, a path with no source, a bad attach), and
every ! warning: a warning means the tour highlight doesn't contain the value in bold, so the
capture group is on the wrong text. Rebuild until check passes, then read the card table in each
generated docs/traces/<id>.md: every highlight must be the value.
Tell the user, per trace:
docs/traces/*.trace.json, docs/traces/*.md, .tours/source-to-sink-*.tour);docs/traces/<id>.md for the diagram and the CodeTour extension
(vsls-contrib.codetour) for the tour, where step N = card N. After code changes, run build
again to move the highlights with the code, or check in CI.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 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.Other plugins' skills for the same job
/security-experimentBuild a short, runnable notebook that shows why a security control makes a sink safe (or why its absence doesn't): one classic payload goes through the application's real steps, first without the control, then with it, printing the value after every step with the dangerous part highlighted, until the payload disappears (or reaches the sink). Works for sanitisers, encoders, validators, allowlists, parameterised queries and path checks. Use when asked why a finding is a false positive, to prove or demonstrate a control, to show what a sanitiser removes, or to "experiment" with a payload against the code.npx claudepluginhub mohamed-osama-aboelkheir/appsec-untangled-resources --plugin appsec-skills