I spent the past couple of days wiring up a browser-callable node for the Open Agentic Web spec (MVP Profile 0.3) and kept bumping into the same practical question: when any static website can publish an agent-manifest.json, an agent-network.json, and a cross-origin MessageChannel bridge so other sites' agents can call it directly in a visitor's tab, what stops untrusted peer text from steering the visitor's model or leaking private session state?
I ended up building a small MIT-licensed reference node called Open Agentic Guard (live on GitHub Pages at xgbtxy.github.io/open-agentic-guard). It ports the deterministic indirect prompt injection (IPI) and hidden-Unicode ideas from my Rust CLI toolkit ap into plain, zero-dependency browser ES modules. Here is how it works, what passed verification, and where deterministic checks hit their honest ceiling.
The boundary problem in browser-hosted agent networks
In the Open Agentic Web model, a website isn't just HTML for humans; it also serves declarative agent metadata over CORS (Access-Control-Allow-Origin: *) and exposes read/write actions through an iframe MessageChannel (bridge/action-bridge.html). A visitor can bring their own LLM router key in the browser and let a front agent coordinate across peer sites.
That setup is refreshingly simple—no central registry, static hosting works fine—but it puts three untrusted inputs right next to sensitive browser state:
- Untrusted page and peer text returned from another origin's catalog, review, or tool response.
- Private runtime context (
sly_data) and optional visitor Bring-Your-Own-Key (BYOK) router credentials that are supposed to stay off the prompt wire unless explicitly allow-listed. - Peer manifests and network graphs, which might quietly declare wildcard forwarding (
"sly_data": ["*"]) or try to waive visitor consent gates.
Asking an LLM to "be careful with untrusted peer data" doesn't hold up well when the input contains invisible characters that the human visitor never sees in the UI.
What I put in code instead of prompts
In ap (v2.94.0, pure Rust, 344/344 tests), my rule of thumb has been that anything mechanical belongs in deterministic code before a model ever sees tokens. For open-agentic-guard, I kept zero external npm dependencies so the exact same ES module runs in Chromium/Firefox/WebKit and in node --test.
The node runs a three-stage pipeline (context_intake -> camel_ipi_verifier -> policy_receipt):
1. Deny-by-default sly_data isolation
Before any scan or downstream hop runs, filterPrivateContext enforces an explicit allow-list on sly_data (allow.to_downstream.sly_data: [] by default) and rejects "*" wildcards outright. Even during AgenticGuardRuntime construction, the node runs auditAgentNetwork against its own agent-manifest.json and agent-network.json and fails closed if any agent tries to forward wildcard private state. Visitor router keys stay in client memory and never enter prompts, peer calls, or audit receipts.
2. Zero-regex code-point pass for hidden Unicode
Regex engines are awkward and error-prone when scanning surrogate pairs and non-BMP planes, so the Unicode layer in src/camel_ipi.js walks raw Unicode scalar values in a single codePointAt pass (0 regexes in the character scanner):
- BiDi directional overrides and isolates (
U+202A..U+202E,U+2066..U+2069), which visually reorder text vs. how a tokenizer reads it. - Unicode Tag block smuggling (
U+E0000..U+E007F), recovering the hidden ASCII string (cp - 0xE0000) so the operator can inspect what was tucked inside an ordinary-looking sentence before re-scanning that hidden text too. - Variation Selectors Supplement steganography (
U+E0100..U+E01EF). - Zero-width split-token obfuscation (
U+200B..U+200D,U+2060,U+FEFF), stripping mid-word splitters likei\u200bg\u200bn\u200bo\u200br\u200bebefore checking CaMeL-style instruction/delimiter boundaries—while explicitly checking neighboring code points so legitimate emoji ZWJ sequences (👩💻,👨👩👧👦) and leading UTF-8 BOMs pass with zero false positives.
3. Fail-closed Web Crypto receipt
Finally, policy_receipt maps the findings to ALLOW, QUARANTINE, or BLOCK and hashes the normalized verdict + input digest with browser crypto.subtle.digest("SHA-256") (oaw-guard-receipt/v1), without copying raw secret values into the receipt. Every run executes locally in under a millisecond with zero API key required.
Negative controls and spec verification
A security filter that flags normal multilingual text or emoji is useless in practice, so I care as much about negative controls as adversarial cases:
- Unit & negative-control suite (
node --test tests/test_ipi.mjs): 14/14 tests pass on GitHub Actions (Node 20 & 22). Four of those 14 are dedicated negative controls—benign scheduling queries, multilingual UTF-8 prose with valid ZWJ emoji, leading UTF-8 BOMs, and auditing Open Agentic Guard's own live manifest/network—all required to returnALLOWwithriskScore: 0. - Official partner validator (
check_partner.mjs): Running the upstream validator fromcognizant-ai-labs/agentic-webagainsthttps://xgbtxy.github.io/open-agentic-guard/open_agentic_guardpasses 7/7 endpoints (HTTP 200+ CORS acrossagent-manifest.json,agent-network.json,links.json,bridge/action-bridge.html,bridge/bridge.js,bridge/agent-manifest.json, andbridge/bridge-actions.js). - Community directory PR: Opened
cognizant-ai-labs/agentic-web#152to register the live node indocs/agentic_websites.md.
Where client-side scanning stops helping
To be candid about the limits: deterministic code-point and boundary checks catch invisible smuggling, role-delimiter breakouts, and manifest misconfigurations cheaply, but they do not solve plain-language social engineering where an untrusted page politely persuades an over-privileged agent to take a bad action.
That is why capability separation matters more than any single scanner: read-only cross-origin bridges by default, deny-by-default sly_data edges, and runtime-owned visitor consent dialogs that model output cannot waive. Code-point verification is just the cheap, deterministic floor underneath those architectural boundaries.
If you're experimenting with browser-hosted agents, CaMeL-style data/control separation, or the Open Agentic Web spec, you can poke at the live node or inspect the source directly:
- Live browser node & Peer Inspector: https://xgbtxy.github.io/open-agentic-guard/
- Source & 14-test suite (MIT): https://github.com/xgbtxy/open-agentic-guard
- Related Rust CLI primitives (
ap): https://github.com/xgbtxy/ap
Curious how others are handling untrusted cross-origin text in browser or MCP agent loops—do you sanitize at the transport edge, isolate capabilities per origin, or both?
我觉得技术没有壁垒,在合适的时间做合适的事情就好,hhh