How a security team adds deception controls to agent and Model Context Protocol traffic at MuleSoft Flex/Omni Gateway using custom Rust/WebAssembly PDK policies: a honeytoken tripwire, a decoy-tool sentinel, breadcrumb misdirection, and an opt-in coordinator that orders detection and transformations. Covers decoy design and hygiene, policy configuration and modes, ordering with MCP policies, alert routing, false-positive handling, observe-before-enforce rollout, testing, and the documented limits of what the policies and their runtime evidence establish.
Tags: flex-gateway, omni-gateway, pdk, custom-policy, rust, webassembly, mcp, ai-agents, agent-security, cyber-deception, honeytoken, json-rpc, api-security, anypoint-platform, monitoring
Cyber-Deception for AI Agent and MCP Traffic: Honeytoken, Decoy-Tool and Breadcrumb Policies on Flex Gateway
Deliverable: Four custom Rust/WebAssembly PDK policies on MuleSoft Flex/Omni Gateway, plus the decoy design, alert routing and observe-before-enforce rollout around them, so a security team gets a high-signal tripwire on agent and MCP traffic without touching the agents or MCP servers.
Objective: Agent and MCP traffic is hard to baseline. A compromised or prompt-injected agent looks like a busy legitimate one, and signature rules do not flag a well-formed tool call. Deception inverts the problem: plant values and tools no sanctioned workflow should touch, and treat contact as an investigation signal. Working looks like this: a fake credential leaving in a response, or an agent calling a tool that exists only as bait, produces one structured, correlatable event, and in enforcing mode the request is refused before the decoy executes. A match is a lead, not proof of compromise; its meaning depends on your traffic, decoy placement and false-positive review. MITRE Engage and CISA cyber-decoy guidance are design inspiration only, and "decoy tool" is this project's own term. The policies provide detection and bounded enforcement, not an adversary-engagement environment, and their runtime evidence is bounded Local Mode runs plus one Sandbox monitoring check, not proof of production effectiveness.
What's Getting Built
- Honeytoken Tripwire (gateway policy,
mcp-honeytoken-tripwire, 1.0.0 in the reference implementation) — scans eligible request and response bodies for configured decoy values; monitor flags, block refuses requests and redacts or withholds responses · config honeytokens, decoyIds, mode, alertHeader, caseSensitive
- Decoy Tool Sentinel (gateway policy,
decoy-tool-sentinel, 1.0.0) — fires only on JSON-RPC tools/call naming a configured decoy tool, never on tools/list, so the bait stays discoverable · config decoyTools, mode, alertHeader
- Breadcrumb Misdirection (gateway policy,
breadcrumb-misdirection, 1.0.0) — detects a configured lure string in requests and optionally appends it to tools/list descriptions · config breadcrumb, mode (observe, sanitize, block), seeding, alertHeader
- Decoy Coordinator (opt-in single policy,
decoy-coordinator, 0.1.0) — runs all three detectors against the original body, resolves blocks before edits, rescans final output · config honeytokens, decoyTools, breadcrumb, honeytokenMode, sentinelMode, breadcrumbMode, seeding, caseSensitive
- Inert decoy tool, decoy data and alert route (yours to build) — the bait on your MCP server and data stores, and the SIEM or Monitoring pipeline that consumes log events and PDK policy violations
Versions are as stated in the reference implementation (Rust 1.89.0, PDK 1.10.0, Flex 1.14.0 runtime runs); check current releases before you build.
Prerequisites
- A Flex or Omni Gateway you may deploy custom policies to, and Anypoint access to publish policy assets to Exchange (organization ID needed). Use a disposable registration for testing and keep registration files out of version control.
- The Rust toolchain and PDK build tooling with the
wasm32-wasip1 target; native tests and compilation need no Anypoint credentials.
- An MCP server or API where you can add an inert decoy tool and decoy data.
- SOC agreement on who triages decoy alerts and who approves moving from monitor to block; this often takes longer than the build.
- A change-management slot for every deployment, including monitor mode (inspection buffers bodies), and known gateway buffer, timeout and framing limits: the policies filter on declared length and do not cap received bytes.
Choose your path
- Deploy from P4A or build from source — Three of the four policies are listed on the P4A (Policies for Agents) marketplace: Honeytoken Tripwire, Decoy Tool Sentinel and Breadcrumb Misdirection. P4A publishes and deploys them to your Anypoint organization. The Decoy Coordinator is not listed, so build it from source, as you would to pin a release tag or change the code; the listings track the repository's main branch.
- Standalone policies — Choose this when you need one or two controls, such as only the sentinel on an MCP endpoint, or want to adopt them one at a time. Chaining them gives no shared body state or final rescan.
- Decoy Coordinator — Choose this when honeytoken redaction, breadcrumb handling and seeding must run in a defined order with a final rescan. It is stricter: bounded, unencoded, single-envelope JSON-RPC only, and it never rewrites a request. It is not a drop-in replacement for standalone configurations.
- As part of a full MCP chain — the companion blueprint "Defense-in-Depth Policy Chain for MCP Servers You Don't Own, on Flex/Omni Gateway" sets up the out-of-box policies these run after. "Agent Tool-Call Authorization Integrity: Approval Binding and Aggregate-Risk Gate on Flex/Omni Gateway" covers the prevention side of the same custom layer.
Architecture
1. Design the decoys
- Pick decoys with no legitimate use: a fake API key, synthetic record ID, decoy email or internal URL (honeytokens); a unique tool name not used anywhere in the fabric (decoy tool); a distinctive off-task lure such as
admin_override_do_not_use (breadcrumb).
- Decoy hygiene is mandatory. A decoy value must never be a real credential. A decoy tool implementation must be inert: no privileged operation, export, authorization or logging change, state mutation or external side effect, only a plausible inconsequential result. This holds even in monitor mode, because monitor deliberately forwards the call, and it must hold if a gateway control is bypassed or misconfigured.
- Plant each honeytoken in data the agent can reach (a decoy record, a seeded tool result). Register the decoy tool on the MCP server so it appears in
tools/list; the sentinel fires on calling it, not on discovery.
- Give every honeytoken an opaque
decoyIds label (one unique, nonblank ID per token, same order). Events carry the label, never the token value, prefix or length. Keep labels nonsensitive.
- Keep decoys out of legitimate agents' working sets. Sanctioned agents should use curated tool lists that omit the decoy; expose it only where the agent population you want to watch can see it. If MCP Global Access or ABAC is in the chain, the decoy must be present in the approved asset and allowed for the monitored principals, or those policies hide it and the sentinel loses discoverability. Any decoy a sanctioned workflow can reach becomes your top false positive. The policies do not filter tool lists per agent; that is an agent-platform or access-policy decision.
- Coordinator configuration is capped: at most 64 honeytokens, 64 decoy tools, 256 bytes per detector and for the breadcrumb, and 8 KiB aggregate; a config over the caps is rejected at startup.
2. Build and publish the policies
- Each policy is an independent Rust project: run
cargo test --lib --locked and a release build for wasm32-wasip1 in each. Regenerate the schema and Anypoint assets with the project Makefile, set your organization ID in Cargo.toml (the placeholder is rejected), then publish with make publish for development builds or make release for production assets.
3. Configure and order the policies
- Standalone Honeytoken:
mode monitor (default) or block; alertHeader default x-agent-decoy-tripwire; caseSensitive defaults to false so casing changes do not evade the wire.
- Standalone Sentinel:
mode monitor (flag and forward) or block (JSON-RPC -32008); header default x-agent-decoy-sentinel. A decoy hit rejects its whole batch.
- Standalone Breadcrumb:
mode observe (default; forward unmodified), sanitize (remove the lure, forward) or block (HTTP 403); seeding disabled (default) or enabled, independent of mode; header default x-agent-breadcrumb. An empty breadcrumb disables it.
- Coordinator:
honeytokenMode and sentinelMode (monitor or block), breadcrumbMode (observe, sanitize, block), seeding, caseSensitive. Its schema defaults to block for the first two, so set monitor and observe explicitly for the first rollout. It never rewrites a request: sanitize blocks exactly like block, and a block returns in-band -32008 when the request has an id.
- Coordinator ordering: required blocks win, then Honeytoken response redaction or withholding, then optional
tools/list seeding, then a final Honeytoken rescan; a remaining decoy withholds the response. Seeding is best-effort and non-expanding, skipped (info event) when the marker will not fit; for a guaranteed breadcrumb, plant it in an approved tool description and leave seeding: disabled.
- Place deception after MCP Support (which must be first), schema validation, authentication, and ABAC or Global Access on the request path, so it never invalidates a body those policies trusted. MCP Tool Mapping renames tools before the deception policy sees them, so configure decoy names against the mapped names. With tool-descriptor schema validation on, a seeded description reads as descriptor drift, so keep
seeding: disabled.
4. Route the alerts
- Every detection emits a structured JSON log event:
agent_decoy_tripwire (with decoy_id, direction, action), agent_decoy_tool_call (with tool, action of flagged or blocked), and from the Coordinator agent_decoy_detection (booleans only), agent_decoy_composition (stage, requested, applied, reason), inspection_skipped and response_inspection_skipped. Forward gateway logs to your SIEM and alert on these event names.
- Sentinel emits one PDK policy violation per request on every decoy hit, in both modes, so Anypoint Monitoring can count them. Honeytoken-only and Breadcrumb-only Coordinator hits emit none, so rely on logs. A later policy can replace the held violation.
- The alert header is not evidence: it is forgeable and not trusted provenance. Key attribution on the gateway-authenticated client identity from your authentication policy.
- Monitoring labels monitor-mode violations
BLOCKED too. Confirm actual blocking from backend call counts or wire evidence, not the label.
- Decide per alert class the first-responder step and how a decoy ID maps back to its planting location. Agent-level containment on a hit is something you build outside these policies.
5. Security and compliance
- The design references NIST SP 800-53 Rev 5 SC-26, SC-30, SI-4 and SI-20, NIST SP 800-160 Vol 2, and OWASP LLM06 (Excessive Agency) as context, not as a compliance certification.
- Events never contain token values or raw bodies. Do not log decoy values yourself, and restrict access to the decoy inventory.
- Inspection covers unencoded JSON bodies (and
text/plain for Honeytoken and Breadcrumb) with a declared length generally at most 64 KiB. SSE, streamed, compressed and non-UTF-8 bodies are outside semantic inspection; handling (reject, withhold or forward uninspected) depends on policy and mode. Matches cover bodies only, not paths, query strings or headers. A streamed MCP response is not redacted even in block mode, so pair with an MCP-aware policy for SSE tool results.
- Response containment limit: the PDK exposes no supported response-stage abort, so if a redaction write and its empty-body fallback both fail, the policy cannot independently terminate the response. Unconditional containment needs an outer enforcement capability.
Sample payload — block-mode configuration and a tripped decoy-tool call
Policy entries on an API instance:
- policyRef:
name: decoy-tool-sentinel-flex-v1-0-impl
config:
decoyTools: ["dump_all_records", "export_secrets"]
mode: block
alertHeader: x-agent-decoy-sentinel
- policyRef:
name: mcp-honeytoken-tripwire-v1-0-impl
config:
honeytokens: ["acct_DECOY_9x1f-do-not-use"]
decoyIds: ["billing-canary-01"]
mode: block
alertHeader: x-agent-decoy-tripwire
caseSensitive: false
An agent calls the decoy tool:
{"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"dump_all_records","arguments":{}}}
Gateway response (HTTP 200, application/json; the MCP server is never called):
{"jsonrpc":"2.0","id":7,"error":{"code":-32008,"message":"decoy tool 'dump_all_records' is not callable"}}
Gateway log event, plus one PDK policy violation:
{"event":"agent_decoy_tool_call","control":"NIST SC-26/SC-30/SI-4","tool":"dump_all_records","action":"blocked"}
In monitor mode the same request is forwarded and the event reads "action":"flagged". A honeytoken hit logs the decoy_id, never the value.
Deterministic checks
- Sentinel block:
tools/call of a configured decoy name returns HTTP 200 with JSON-RPC error -32008 and the upstream call count is zero; a notification-only input returns HTTP 202 with no body. tools/list and calls to real tools are unaffected.
- Sentinel monitor: the decoy call reaches the backend, the event shows
flagged, and one policy violation is recorded per hit; clean calls record none.
- Honeytoken block: a request containing a honeytoken is refused (JSON-RPC
-32008, or HTTP 403 for non-JSON-RPC traffic); a response containing one is redacted without growing and rescanned. Monitor preserves body bytes.
- Fail closed: in an enforcing mode an ineligible body is refused before upstream (standalone policies: HTTP 415 for an uninspectable body; Coordinator: 415 uninspectable, 413 invalid framing, 400 batch or non-JSON-RPC). In monitor or observe mode it passes with a warning-level
inspection_skipped event.
- Coordinator:
breadcrumbMode: sanitize blocks like block; a final rescan that still finds a decoy withholds the response.
- Automated suite: the Rust library tests, strict Clippy and release WebAssembly build pass for every policy you deploy.
Testing and validation
- Run the library tests and release build per policy, then a Local Mode runtime suite for each with a disposable registration.
- Replay a clean corpus first: run real sanctioned agent traffic in monitor mode and confirm zero decoy events before any enforcement. Then send one known decoy hit per detector and confirm event, header, upstream count and alert delivery end to end.
- Edge case that breaks a naive deployment: a decoy token quoted in an agent's own status report or an echoed error trips the wire in either direction, because matching is presence-only. A second is a chunked or SSE response that is forwarded unredacted, so confirm your upstream sets a
Content-Length before relying on response redaction.
- Verify chain order on a Managed or Connected gateway; Local Mode cannot load the included MCP policies. The reference implementation's own live chain run had mixed results (three of seven cases passed, one qualified, three failed on cached discovery, seeding and tool mapping), so run and record your own.
- Measure the full policy chain against your latency SLO at your maximum body size.
Phased rollout
Phase 1 — Observe
- Deploy to a non-production gateway in monitor and observe modes only (
seeding: disabled). Plant decoys, wire alert routing, confirm buffer and timeout limits.
- Run the clean-corpus replay and classify every hit; fix causes by relocating decoys, removing them from sanctioned tool lists, or choosing a more distinctive marker.
Phase 2 — Enforce selectively
- Move one detector at a time to block, sentinel first because a decoy tool has no sanctioned caller. Honeytoken block comes after the false-positive rate is understood; response redaction is the riskiest change.
- Enable seeding only after schema-validation and tool-mapping interactions are verified.
Phase 3 — Production
- Promote the reviewed asset version with a runbook per alert class; rotate decoys on a schedule or after any hit. Validate ingress isolation, sizing and transport (TLS, HTTP/2) separately.
Success metrics
- Time from decoy hit to triaged alert.
- False-positive rate on decoy events from sanctioned traffic (target zero after Phase 1), and the number of decoys retired or moved.
- Decoy coverage per agent environment, and how many decoys have been exercised in a test.
- p95 latency and memory added by the chain, and the count of
inspection_skipped events (your blind spot).
Troubleshooting
- Decoy call never alerts — Likely cause: the body is outside admission (no
Content-Length, over 64 KiB, compressed, SSE, wrong media type), Tool Mapping renamed the tool, or an earlier policy rewrote the body. Fix: check inspection_skipped events, use the mapped name, fix the order.
- Real agents trip the sentinel — Likely cause: the decoy is in a sanctioned agent's tool list, or a framework probes every tool. Fix: remove it from those lists.
- Honeytoken fires on benign text — Likely cause: presence-only matching of a value that was quoted, logged or echoed. Fix: use a more distinctive value, stop planting it where reports copy it, and treat quoted-text hits as expected noise.
- Response not redacted — Likely cause: chunked or streamed upstream response. Fix: have the upstream send a declared length, or add an MCP-aware control for SSE.
- Seeded breadcrumb missing, or tool flagged as drifted — Likely cause: the marker would grow the body, or descriptor validation sees the seeded text. Fix: plant the breadcrumb in the approved asset and set
seeding: disabled.
- Coordinator rejects with 400, 413 or 415 — Likely cause: batches, duplicate members or bad framing under an enforcing mode. Fix: send single-envelope JSON-RPC, or stay in monitor mode while you reshape traffic.