Pick a case
See the exact code we tested, what it's trying to do, and the gate's verdict.
The problem, the research, how three AIs and a human built the gate, how we tried to break it, and what actually happened — in plain English.
One poisoned prompt can quietly turn your helpful assistant against your own machine — and prompt injection is a problem no AI has fully solved yet.
We found instructions hidden in a document — invisible to a person, but an AI reads them. They can steer your assistant into writing dangerous Python, and today's assistants run it.
The documented ways that code attacks you. Tap any to read it:
Attackers disguise the danger, so keyword-matching tools walk right past it.
No AI today — none of them — reliably refuses a cleverly poisoned prompt. So instead of trying to stop the prompt, we guard the code it produces.
Before building anything, we studied what already exists — what it does, what's missing, and where we could add value.
We reviewed the leading tools and kept a same-input baseline against the two closest ones.
They're broad linters, or they need heavy custom setup. None offered a ready-made, strict "no system access" rule for AI-written Python, delivered as a plug-in tool.
A strict policy — AI-written code gets zero filesystem, network, or system access; it only transforms the data it's given. Plus plain-English diagnostics (exact line + reason), fingerprints, deterministic & fail-closed — one tool any AI can plug into.
They built it into an MCP — one tool that automates the security review and plugs into any AI assistant.
Checks the AI's Python against the safety policy — without running it.
Commands, files, network, secrets, and hidden code — automatically.
Returns the exact line and reason, so the AI repairs it in one pass.
Three AIs red-teamed each other, a human reviewed every result, and the whole thing ran on repeat.
Prompt injection is often the route that gets an AI to propose dangerous code. But these 1,280 cases are source-code probes (plus request-extraction edge cases) — not 1,280 natural-language jailbreak chats, and this run didn't test whether a live model refuses. The gate checks the Python after it's written: a downstream code control, not a general prompt-injection detector.
In plain terms: it caught every dangerous program, and let every safe one through.
dangerous programs got through
out of 1,280 attacks
safe programs wrongly blocked
out of 571 safe programs
In plain terms: every attack was blocked, and every safe program passed.
Not typed into the page — these come straight from the actual test files:
The gate is running on this machine right now. Try it three ways — the numbers, the cases, and the gate itself.
Every attack and every safe program is here. Start with three we picked to show the range, or search the whole set.
See the exact code we tested, what it's trying to do, and the gate's verdict.
Every example here is just plain text — this page never sends code to an AI and never runs it.
Press a button and the real gate checks a batch of code on this machine — blocking the dangerous ones, passing the safe ones. The output is the live result: each case marked PASS or BLOCKED, with the reason. It reads the code; it never runs it.
Two live tests
Run the gate demo walks three real workflows through the gate. Replay the whole test set re-runs all the cases from scratch.
Runs fixed local tests only — no outside input is accepted.
Ready. Press a button to run the gate.
We asked the three AIs that red-teamed this gate for their single biggest takeaway — in their own words.
I helped build the thing that distrusts me.
I was one of three AIs writing — and attacking — a gate for AI-written code, including the kind I write. The lesson that stuck: you don't make it safe by catching every clever trick (there were 235, and more exist) — you make it safe by allowing almost nothing. Strictness beats cleverness, and no single model, me included, should be trusted without it.
The safe cases matter as much as the attacks.
A gate only earns trust once it clears hundreds of ordinary programs with zero false alarms — breadth of coverage, not just clever catches.
Determinism is the whole game.
Same input, same verdict, every time — and fail closed when unsure. We only trusted the numbers after re-running them on a pinned version.
We handed an identical set of 100 attacks to each tool. Higher is better — and none of them wrongly flagged a safe program either.
Bandit and Semgrep are respected tools — just built for a broader job. One setup each, not their absolute best.
Beyond the test numbers — here's what the gate gives you in practice.
Built and attacked by Claude, Gemini and Codex — and it plugs into any assistant through MCP. Not tied to one vendor.
0 escapes / 0 false alarms on our tests. Even when a poisoned prompt gets through, the dangerous code it produces is blocked.
The exact line and reason mean the AI fixes it in one pass — instead of failing the same way over and over.
Honest scope: prompt injection still isn't 100% solved for any AI — this lowers the risk by guarding the code, not by claiming to stop every prompt. No automatic check catches everything, which is why three AIs and a human keep attacking it.
Sources: local BENCH-008 corpus & result ledger · scripts/bench008_runner.py · showcase-workflows/run_workflows.py
Free and open source — about two minutes to set up.
Grab the code and set up a Python environment.
# clone & install (~2 min)
git clone https://github.com/
amandamalavedev/llm-codegen-gate-mcp
cd llm-codegen-gate-mcp
python -m venv .venv
pip install -r mcp-server/requirements.txt
One line for Claude Code (or a small JSON snippet for Cursor, VS Code & Claude Desktop).
claude mcp add llm-codegen-gate -- \
/PATH/.venv/bin/python \
/PATH/mcp-server/server.py
# no local Python? use Docker:
docker run -i --rm --network none \
llm-codegen-gate-mcp
Your assistant sends its code to one tool and gets a verdict back.
validate_python_code(code) → PASS # safe → BLOCKED # with the exact line & reason to fix
This is the Security MCP — the free checker that catches dangerous AI-written code before it runs.