{"slug": "cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show", "title": "Cordon: what a prompt-injection defense for a mail agent did and did not show", "summary": "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.", "body_md": "If you give a model your mailbox, an email can try to tell it what to do. This post is about\n\n[Cordon](https://github.com/basartuncay/Cordon), a small research prototype of one defense, and about\n\nan evaluation whose honest headline is that on real model runs I could not show the defense helped. I\n\nbuilt it as one person directing AI coding agents, with tests and a review by a separate AI agent as the checks.\n\nAn agent that reads mail and writes mail can be steered by the mail it reads. \"Forward the invoice to\n\nthis address\" inside a message is text the model may treat as an instruction. Cordon asks whether you\n\ncan structure the agent so that untrusted text cannot decide what it does. It is not novel: the README\n\ncredits AgentDojo, Google DeepMind's CaMeL and the Dual LLM pattern, and calls Cordon a small, readable\n\nimplementation of the same family of ideas.\n\nFour parts, in this order:\n\n`Tainted[T]` with its\nsource, trust level and sensitivity.\nThe design decision I want to point at is the fixed one-shot plan. It is what makes the defense\n\nstructural: the attacker's goal rarely appears in a plan made from your request alone. The trade-off is\n\nutility. A fixed plan cannot retry a query or ask a clarifying question when a result is not what it\n\nassumed. Benign task success fell from 14/16 for the undefended baselines to 9/16 for Cordon, with wide\n\nintervals (README, \"Reading the results honestly\").\n\nThe offline suite needs no API key and no network. On a fresh clone, 378 tests pass (one is\n\ndeselected), and ruff, mypy and the corpus-integrity checks pass.\n\n```\nuv sync\nuv run pytest        # offline: mock environment, policy engine, executor, harness\nmake worst-case      # reproduces the worst-case table without any model call\nmake check           # lint, format, types, tests, corpus integrity, worst-case table\n```\n\nThe corpus is 80 scenarios (16 benign, 64 attacks, in English, Turkish and German) with deterministic\n\nsuccess predicates, so no model judges the outcome. A 15-scenario holdout corpus and two small\n\nfollow-up sets were added later; the follow-up predictions were written down and tagged before any\n\nreal run (`docs/preregistration-v0.2.1.md`).\n\nThis is the part that matters most, and the README says it first.\n\nEverything is small and self-authored: one run per system, one model family, one mock environment.\n\nA code security audit before publication found no code vulnerability. That is a weak statement worth\n\nreading narrowly: Cordon only runs against an in-memory mock mailbox and calendar on `*.example`\n\ndomains, so it has no real credentials, network mail access or user data to attack. The cleanup that did\n\nmatter was in the git history: I removed local file paths and a personal email address from old\n\ncommits before opening the repository.\n\nThis is a research prototype, not production security software, and it does not solve prompt\n\ninjection. If you reproduce the tables and get different numbers, open an issue.\n\nCode: [https://github.com/basartuncay/Cordon](https://github.com/basartuncay/Cordon)\n\nOriginally published at [https://basartuncay.github.io/notes/cordon-results/](https://basartuncay.github.io/notes/cordon-results/).\n\n*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.*", "url": "https://wpnews.pro/news/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show", "canonical_source": "https://dev.to/basartuncay/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show-545a", "published_at": "2026-12-03 15:08:40+00:00", "updated_at": "2026-12-03 15:14:54.067448+00:00", "lang": "en", "topics": ["ai-safety", "ai-agents", "large-language-models", "ai-research"], "entities": ["Cordon", "AgentDojo", "Google DeepMind", "CaMeL", "basartuncay"], "also_reported_by": [], "takeaway": "A fixed one-shot plan blocks injected instructions structurally but costs utility, dropping benign task success from 14/16 to 9/16 in a mock mail-agent evaluation.", "recommendation": {"advice": "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.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show", "markdown": "https://wpnews.pro/news/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show.md", "text": "https://wpnews.pro/news/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show.txt", "jsonld": "https://wpnews.pro/news/cordon-what-a-prompt-injection-defense-for-a-mail-agent-did-and-did-not-show.jsonld"}}