flow-security
БесплатноБез исполняемых скриптовНе проверенAudits multi-step business flows for vulnerabilities that are invisible when endpoints are checked in isolation — order/payment/invoice state-machine…
от jiayaoqijia★ 81 звезда на GitHubОб этом скилле
Business Flow Security (cross-endpoint analysis)
Why this exists
Route-level audits check each endpoint against its own request. Flow-level vulnerabilities live BETWEEN endpoints: an invariant that must hold across the sequence (paid before invoiced, server-side price from order time, ownership through the join chain) is enforced nowhere because every handler assumes an earlier step established it. Individually clean, jointly broken.
Grounding: OWASP WSTG-BUSL-01..03 (business logic testing), OWASP A04 (Insecure Design), OWASP API Top 10 (API1 BOLA across associations).
1 — Reconstruct the flows
Pick the app's money/state-carrying flows (usually 1–5; ask the user or read routes/models to name them). For each flow, extract:
# state-carrying entities + their status fields
rg -n "status|state|phase|stage" -g '**/models/**' -g '**/entities/**' -g '*.prisma' -g 'schema*' | rg -v "test" | head -20
# every status WRITE (= a transition) and the endpoints that own them
rg -n "status\s*[:=]|SET\s+status|status:" -g '*.js' -g '*.ts' -g '*.py' -g '*.java' -g '*.rb' -g '*.php' | rg -i "update|set|save|patch" | head -20
# terminal artifacts of flows (what the flow produces)
rg -n -i "invoice|receipt|refund|credit|shipment|provision|payout" -g '*controller*' -g '*handler*' -g '*routes*' -g '*views*' | head -20
Write the flow as a sequence with the entity each step reads/writes:
POST /orders writes order(status=cart, total=<derived>)
POST /orders/:id/pay reads order → calls gateway → writes payment
POST /payments/webhook writes payment(status=paid)… order(status=paid)?
POST /invoices reads order + payment → writes invoice(total=?)
Include hidden steps: webhooks, background jobs, retry/queue consumers, admin override endpoints — they are flow steps even when not in the UI.
2 — Build the invariant table
For each step, write down what MUST be true before it runs (preconditions)
and what it writes. Two columns per step: requires / effects. Missing
preconditions are findings — the table makes them visible:
| Step | Requires (must verify in code) | Effects |
|---|---|---|
| create invoice | order.status == paid AND order.user == caller AND payment not already invoiced AND total from order row | invoice row |
3 — The 9 flow vulnerability classes
F1 — Unguarded state transitions (skip / replay / disorder)
rg -n -i "update.*set.*status|status\s*:\s*['\"]" | rg -v "where.*status|AND status|status\s*==" | head
A transition that doesn't check the CURRENT state atomically allows:
invoice a cart order (skip payment), invoice twice (replay), refund after
refund. Safe shape: UPDATE orders SET status='invoiced' WHERE id=? AND status='paid' (and check rows-affected), or findOneAndUpdate({id, status: 'paid'}, …). High/Critical (money steps = Critical).
F2 — Cross-step data provenance (stale / client-supplied at terminal steps)
rg -n "req\.(body|query)\.(total|amount|price|qty|quantity|discount|currency)" | head
The invoice/refund/charge step must derive money values from the persisted source of truth (the order row as written at order time), never from client re-submission or re-derivation from a mutable relation. If the client sends the total anywhere past the first step → price tampering (order says 100, payment says 100, invoice obediently records 1). Critical.
F3 — Chained (association) IDOR
rg -n "(invoice|receipt|shipment|refund).*find(By)?\(\s*\{?\s*(orderId|order_id|paymentId|payment_id)" | head
Each endpoint checks ITS object's ownership but not the JOIN path:
/invoices?order_id= fetches the order without order.userId == caller —
user A invoices/reads user B's order even though /orders/:id itself is
properly guarded. Rule: any handler accepting an id of entity X that
belongs to the flow must verify ownership through the FULL association
chain (invoice → order → user), not just existence of X. High/Critical.
F4 — Replay & duplication at terminal steps
Webhook fires twice, retry double-submits, user double-clicks: does the
terminal step dedup on the flow's BUSINESS key (unique index on
payment_id in invoices, idempotency key checked at the step that
consumes it — not only where it's created)? Absence → double invoice /
double refund. High (Critical for refunds/credits).
rg -n -i "idempot|unique.*payment|uniqueIndex|ON CONFLICT|duplicate key" | head
F5 — Step-skipping via direct access
Call the last step first: POST /invoices with an order id that has no
payment at all. Terminal endpoints must verify the PRIOR ARTIFACT exists
(payment row), not just the order. Census the flow's steps and hit each
with "what if I call this directly?" reasoning. High/Critical.
F6 — Post-boundary mutation
rg -n "(put|patch|update).*(order|payment|cart)" -i | head
If the order is mutable after status=paid (PUT without a status guard),
the attacker changes q
Установить flow-security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл flow-security?
Audits multi-step business flows for vulnerabilities that are invisible when endpoints are checked in isolation — order/payment/invoice state-machine violations, cross-step data provenance (stale or client-supplied totals at terminal steps), chained/association IDOR (ownership through entity joins), replay and duplication across steps, step-skipping via direct access, post-payment mutation, amount drift, and privilege transitions between hops. Use when the app has stateful workflows (checkout, signup/verify, submit/approve/publish, request/approve/execute, refunds, provisioning) — the classic case is "order, payment, and invoice each look fine alone, but order → payment → invoice compromises security at invoice generation."
Как установить скилл flow-security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл flow-security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic