/trappsec:add-deceptionfrom trappsec
Adds decoy API routes, honey fields, and frontend lures to an application for detecting attackers probing business logic. Creates believable tripwires that blend into real code and alert on contact without affecting legitimate users.
Ships in trappsec. 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.
You are adding a detection layer to an application the user owns, written in the app's own code:
A decoy that runs the same code as its neighbors answers every probe the way they do: unknown IDs, bad bodies, expired tokens, other methods, headers and bytes all come from the app itself. The judgment calls are yours:
The bar: a seasoned tester who reads the JavaScript bundle, replays API calls and diffs responses cannot tell the tripwires and lures from the real thing, even on a careful second look. A decoy that looks planted is worse than none. It tells the attacker the app is instrumented, and they become careful.
Tripwires are hidden from attackers, never from the team. Everything you add appears in your final report and stays easy for maintainers to recognize (see "Keep the team in on it").
Check every tripwire and lure against these properties:
| Property | In practice |
|---|---|
| Believable | Matches this codebase's real constructs: naming, structure, response shapes, behavior. |
| Enticing | Worth an attacker's time. It points at privilege, money, other tenants' data, or hidden features. |
| Discoverable | Sits on a path attackers already walk: the bundle, API responses, specs, old versions. |
| Non-interfering | Has no effect on real users or real behavior. A false positive is a bug: when unsure, pick the placement with no false-positive risk. |
| Inert | Performs no real action. Its last step is a denial; it writes, sends and calls out nothing. |
| Detectable | Every touch produces an attributed alert, and you have fired it to prove it. |
| Variable | Shares no fingerprint with other decoys, other apps, or this skill's examples. |
| Differentiable | The team can tell decoys from real code, so nobody deletes one or wires it into the UI. |
Believable and enticing pull against each other. The attackers worth catching skip anything that looks too good to be true. Aim for mundane in detail, interesting in shape.
Seven habits produce that:
Extrapolate, don't invent. Derive every decoy from something real in this codebase. Candidates: a sibling of a real resource, the previous version of a real route, a role adjacent to the real roles, a field that sits naturally beside real fields, a feature the team plausibly built next or half-retired. Use the app's own vocabulary (workspace vs. organization, member vs. seat).
Confirm what attackers already believe. Reinforcing an existing belief is far easier than creating a new one. Attackers expect these things, so lures that match them get acted on:
Give every lure an innocent reason to exist. Real dead code always has a story: deprecated, behind a flag, role-gated, or kept for an older client. Write the one-sentence cover story first. It decides naming, location and response.
Let them discover it. A full URL next to a "do not use" comment reads as planted. A role-gated button, a flag-gated code path or an extra response field is something the attacker feels clever for finding, and people trust what they discover. From least to most suspicious to someone reading the client:
data- attribute no script reads, a handler for a form no page renders, a commented-out form.Suspicion is relative: what stands out is what has no precedent. In an otherwise clean client, a gated high-value feature unlike anything else in it is the obvious place to look. So give every visible lure a precedent: copy a pattern the client already uses for a real feature, and vary which pattern each lure copies.
Someone probing the running app sees something else. Honey fields leave nothing to observe from outside. Decoy routes can be found by elimination (Design step 5).
Keep every layer consistent. Frontend calls a decoy with POST → the decoy route accepts POST. There is a client method → there is a type. The app translates every string → the lure's strings are translated. Give a lure the care a real feature with the same stakes would get: one name across method, flag, handler and strings; its own place in the layout; a gate as strict as the value warrants; the states, copy and typed responses the real feature would have.
Chain the breadcrumbs. Along each attack path, let touching one tripwire lead to the next. Example: a decoy's 403 names a permission, a response field shows where permissions live, and sending that permission trips a honey field. Each step is another alert, and the second step removes doubt about intent.
Leave no fingerprints, including this skill's. Names in this skill and its references only illustrate patterns. Never reuse them: a decoy path shared by many apps becomes a signature attackers learn.
Before writing code, write these three lines for every tripwire:
If you can't name a belief an attacker would plausibly form, the tripwire won't convince anyone. And if acting on that belief doesn't raise the alert, the tripwire never fires.
OpenTelemetry traces and logs are a prerequisite. Check them first, as references/telemetry.md describes, including how the app samples traces. If they aren't in place, stop and tell the user.
Ownership and scope. Confirm this is the user's own application. Deception belongs only in systems you operate. Change only what the plan says, and ask before touching auth, infrastructure or CI.
Layout. Find which service is the public API, where the frontend lives (same repo, another repo, none), and how each is built and run.
Questions. Ask in one batch, and only what the code cannot tell you:
If the user wants you to proceed without questions, assume: private repo, no legacy clients, and whatever the deployment config in the repo shows about proxies. State those assumptions in the report.
The attacker's view (what is visible from outside):
Build the frontend for production and inspect the output: chunk names, API path strings, role/permission names, feature-flag names, locale strings, inline bootstrap state, and whether source maps are emitted and served.
Run the app locally (never against production) and call the API both anonymously and as a normal signed-in user. Save the real responses (status, body, content type, headers) for:
You will compare every decoy with these. If the app can't run locally, derive the shapes from its error handlers and tests, and say so in the report.
Note where the valuable things are:
The authors' view (the texture of the code):
git log --oneline, deprecated folders, version migrations, TODOs, flags, renamed features. The best tripwires continue a story the codebase already tells.If there is a frontend, read references/frontend-lures.md now.
Threat narrative. In two or three sentences: who would attack this app, and what do they want? Examples: a B2B SaaS draws privilege escalation and cross-tenant access; a marketplace draws price and payout manipulation; a fintech app draws limit and balance tampering. Pick the intents that matter.
Attack paths. Deception is laid like a minefield: along the routes an attacker must take, where each tripwire looks like the ground around it. Map the routes and their chokepoints as references/attack-paths.md describes, starting from add-detection's map and hand-offs if it has run. Then classify every input at each chokepoint by what the app does with it today. Deception covers the inputs the app ignores; inputs it refuses go to add-detection, and inputs it wrongly accepts are vulnerabilities to report.
Placement. Give every chokepoint input that falls to deception a tripwire wherever one passes the bar: derived from this app (habit 1), safe from every legitimate client, and for a decoy route, able to survive elimination (step 5). The measure is how completely the paths are covered, not how many tripwires there are.
Leave a chokepoint uncovered only for a reason about effectiveness, and write it down: every candidate there would look planted, a legitimate client could trip it, or it would give away a tripwire next to it. Parts of the app no path crosses need nothing.
The final denial. A caller who passes every one of the sibling's checks reaches the decoy's end, and that caller is often the owner of their own workspace, the most privileged account an attacker can create. Choose a denial that fits every such caller (references/implementation.md §2).
Decoy routes that survive elimination. A tester with the accounts a customer can create writes data and reads it back, which clears every real endpoint; whatever never works for any account is left over. A decoy route never works, so make sure that isn't what singles it out:
Specification. For each tripwire, write down:
Review. Look at the design through five sets of eyes, and revise until it passes each:
Unless the user already told you to go ahead, show the plan and wait. It changes product code the whole team will see. Keep it scannable:
| # | Path / stage | Tripwire | Kind | Cover story | Lure(s) | See → Think → Do | Chain copied / final denial | Intent |
|---|
Then list, from the attack-path map, the inputs handed off to add-detection, the vulnerabilities found and the chokepoints left uncovered and why, the files you will touch, your assumptions, and anything the user must decide.
The rules for each piece are in references/implementation.md, and the event every tripwire emits is in references/telemetry.md. Build them with the app's own idioms.
Backend.
Frontend (references/frontend-lures.md):
scripts/scan_bundle.mjs looks for, such as decoy, honeypot and tripwire.A tripwire you haven't fired is a tripwire you don't have. Commands and details: references/verification.md. ${CLAUDE_SKILL_DIR} below means the directory that contains this SKILL.md.
node ${CLAUDE_SKILL_DIR}/scripts/compare_responses.mjs: anonymous and with an expired token using --identical, a normal user, the owner of their own workspace, an unknown, foreign and malformed ID, a bad body, other methods. Every response matches the sibling's except the final denial, and the tripwire records every authenticated hit with the right user, role and intent.node ${CLAUDE_SKILL_DIR}/scripts/scan_bundle.mjs --dir <build-output> --lure <string> .... Every lure must survive the bundler, with nothing near it that reveals intent. Also search the HTML shell and anything served outside the build directory for the words the scan looks for.client.address check in references/telemetry.md.Finish with a report the user can hand to their security team, following the template in references/verification.md §8.
Tripwires only work if the people who maintain the app know about them. Otherwise someone deletes a lure as dead code, or wires a decoy into the real UI and floods the alert channel. The markers, inventory, tests and notes that prevent this are in references/implementation.md §6.
Review before adding:
Propose fixes in the plan format, then extend. Walk the attack paths again, and read add-detection's inventory: a path the app has grown since, a chokepoint left uncovered, or an input handed off to deception is where to extend. For a request about one specific decoy or field, skip the path map. Still capture the real responses for that area, review the design and verify it.
references/attack-paths.md (opens in a new tab)references/backend-traps.md (opens in a new tab)references/frontend-lures.md (opens in a new tab)references/implementation.md (opens in a new tab)references/telemetry.md (opens in a new tab)references/verification.md (opens in a new tab)references/worked-example.md (opens in a new tab)scripts/compare_responses.mjs (opens in a new tab)scripts/scan_bundle.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/add-auditingAdd an audit trail to an application the user owns: what people, services and agents do in the product, from everyday changes to its core objects to sign-ins, permission changes, sharing and exports, as self-contained OpenTelemetry audit records in the product's own terms. Use this whenever the user wants audit logs, a user activity log or history, an audit trail, compliance logging (SOC 2, ISO 27001, HIPAA), a customer-facing audit log API, or a record of authorization decisions. Not for debugging logs, metrics, tracing setup or detecting attacks./add-detectionTurn an application's existing validation and authorization into high-signal detections of someone probing its business logic. Finds the checks that reject inputs and states the app's real clients can never produce (values the UI never offers, client-sent totals that disagree with the server, workflow steps out of order, another tenant's IDs, replayed one-time tokens) and makes each one emit an OpenTelemetry finding tied to the caller's identity, without changing any response. Use this whenever the user wants to detect tampering, impossible states, business-logic abuse, mass assignment or IDOR attempts in their own app, or wants security alerts from existing validation. Inputs the app ignores rather than refuses (fields no handler reads, routes nothing serves) are add-deception's. Not for adding new validation, fixing vulnerabilities, rate limiting, WAF rules or audit logging.npx claudepluginhub trappsec-dev/trappsec --plugin trappsecOther plugins' skills for the same job