zn is a high-performance, transparent security proxy for AI agents. It intercepts tool calls (MCP), scrubs sensitive data, assesses tool risk, and enforces cryptographically signed, state-aware WASM security policies in real-time.
Define your security rules in Rust and compile them to WebAssembly. logic is executed in a secure sandbox with nanosecond latency.
- Hot Reloading: Update policies without restarting the proxy.
- Stateful Logic: Policies can remember past actions (e.g., "Allow
delete_fileONLY ifbackup_filewas called first").
Built for SaaS and large organizations.
- Namespaces: Isolate traffic between teams (
@dev,@prod) or customers. - Role-Based Access: Standard RBAC (
SuperAdmin,Admin,User,Viewer). - Data Sovereignty: Audit logs are strictly partitioned by tenant.
Blocks sophisticated attacks before they reach your infrastructure:
- SQL Injection Guard: Detects SQLi patterns in tool arguments.
- Prompt Injection: Analyzing context to prevent jailbreaks.
- Shodan Canary: Identifies and blocks reconnaissance scanners.
- NoSQL Injection: Prevents MongoDB/NoSQL payload attacks.
- Live Dashboard: Watch agent activity as it happens via Server-Sent Events (SSE).
- Audit Vault: AES-256-GCM encrypted local storage for compliance.
- SIEM Export: Stream logs to Splunk, Datadog or Elastic.
The recommended way to deploy zn for production is using the Enterprise Stack (Backend + Dashboard + WASM).
-
Clone the repository:
git clone https://github.com/netsim-labs/zn.git cd zn -
Configure Environment: Create a
.envfile (or use default variables):ZN_API_KEY=my_secure_super_admin_key
-
Launch Stack:
docker-compose -f docker-compose.prod.yml up -d --build
-
Access Dashboard: Open
http://localhostin your browser. Login with yourZN_API_KEY.
- Rust 1.75+
- Node.js 18+
- SQLite3
# Compile WASM Policies
cd policies
cargo build --target wasm32-unknown-unknown --release
# Copy to bin directory
mkdir -p ../policies_bin
cp target/wasm32-unknown-unknown/release/policies.wasm ../policies_bin/base_security.wasm
# Run Proxy
cd ..
cargo run --bin zn -- startcd web
npm install
npm run devzn acts as a transparent proxy. Configure your agent to use the zn URL instead of the direct MCP server.
Example (Claude Code / OpenCode):
your-agent-cli --proxy-url "http://localhost:9090?api_key=YOUR_TENANT_KEY"- Go to Dashboard > Tenants.
- Click + New Tenant.
- Copy the generated API Key.
- Use this key in your agent's configuration. Traffic will now be isolated to this tenant's namespace.
graph TD
Agent["🤖 AI Agent"] -->|"1. JSON-RPC (HTTP/WS)"| Proxy["🛡️ zn Proxy"]
subgraph Core["zn Core"]
Proxy -->|"2. Auth & RBAC"| Auth["🔑 Tenant Manager"]
Proxy -->|"3. Guardrails"| Guards["🧠 SQL/Prompt Guards"]
Proxy -->|"4. Policy Engine"| WASM["📦 WASM Sandbox"]
WASM -->|"5. State Check"| DB["💾 SQLite Audit Vault"]
end
WASM -- DENY --> Proxy
WASM -- ALLOW --> MCP["🔌 Upstream Tool"]
Proxy --"6. Stream Event"--> Dash["🖥️ Live Dashboard"]
Proxy --"7. Response"--> Agent
We welcome contributions! Please check CONTRIBUTING.md (coming soon) for details on how to submit Pull Requests.
“Building the infrastructure for a safe, agentic world.”
