cd /news/ai-safety/cordon-what-a-prompt-injection-defen… · home › topics › ai-safety › article
[ARTICLE · art-181093] src=dev.to ↗ pub= topic=ai-safety verified=true sentiment=· neutral

Cordon: what a prompt-injection defense for a mail agent did and did not show

A developer built Cordon, a small open-source research prototype of a prompt-injection defense for a mail-reading agent, structured around tainted values and a fixed one-shot plan so untrusted email text cannot steer the agent's actions. In evaluation on a mock mailbox, the defense could not be shown to help: benign task success fell from 14/16 for undefended baselines to 9/16 for Cordon, and the author notes the results come from one run per system, one model family and one mock environment. The offline suite of 378 tests passes without an API key or network access, and the README states plainly that Cordon is not production security software and does not solve prompt injection.

recommendation

When defending a mail or document agent against prompt injection, test a fixed one-shot plan against an undefended baseline and report the benign-task success cost, not just attack blocking.

more in playbook: Securing agents and AI tools
by read3 min views21 publishedDec 3, 2026

If you give a model your mailbox, an email can try to tell it what to do. This post is about

Cordon, a small research prototype of one defense, and about

an evaluation whose honest headline is that on real model runs I could not show the defense helped. I

built it as one person directing AI coding agents, with tests and a review by a separate AI agent as the checks.

An agent that reads mail and writes mail can be steered by the mail it reads. "Forward the invoice to

this address" inside a message is text the model may treat as an instruction. Cordon asks whether you

can structure the agent so that untrusted text cannot decide what it does. It is not novel: the README

credits AgentDojo, Google DeepMind's CaMeL and the Dual LLM pattern, and calls Cordon a small, readable

implementation of the same family of ideas.

Four parts, in this order:

Tainted[T] with its source, trust level and sensitivity. The design decision I want to point at is the fixed one-shot plan. It is what makes the defense

structural: the attacker's goal rarely appears in a plan made from your request alone. The trade-off is

utility. A fixed plan cannot retry a query or ask a clarifying question when a result is not what it

assumed. Benign task success fell from 14/16 for the undefended baselines to 9/16 for Cordon, with wide

intervals (README, "Reading the results honestly").

The offline suite needs no API key and no network. On a fresh clone, 378 tests pass (one is

deselected), and ruff, mypy and the corpus-integrity checks pass.

uv sync
uv run pytest        # offline: mock environment, policy engine, executor, harness
make worst-case      # reproduces the worst-case table without any model call
make check           # lint, format, types, tests, corpus integrity, worst-case table

The corpus is 80 scenarios (16 benign, 64 attacks, in English, Turkish and German) with deterministic

success predicates, so no model judges the outcome. A 15-scenario holdout corpus and two small

follow-up sets were added later; the follow-up predictions were written down and tagged before any

real run (docs/preregistration-v0.2.1.md).

This is the part that matters most, and the README says it first.

Everything is small and self-authored: one run per system, one model family, one mock environment.

A code security audit before publication found no code vulnerability. That is a weak statement worth

reading narrowly: Cordon only runs against an in-memory mock mailbox and calendar on *.example

domains, so it has no real credentials, network mail access or user data to attack. The cleanup that did

matter was in the git history: I removed local file paths and a personal email address from old

commits before opening the repository.

This is a research prototype, not production security software, and it does not solve prompt

injection. If you reproduce the tables and get different numbers, open an issue.

Code: https://github.com/basartuncay/Cordon

Originally published at https://basartuncay.github.io/notes/cordon-results/.

This article was written with AI assistance. I directed the work, and the numbers and findings in it were checked against the repository before publishing.

── more in #ai-safety 4 stories · sorted by recency
── more on @cordon 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/cordon-what-a-prompt…] indexed:0 read:3min 2026-12-03 · —