Bulwark - Multi-layer, zero-dependency prompt-injection defense for AI summarizers and agents. Python, TypeScript & Swift. Includes MCP firewall.
Been working on Bulwark since June. It's an open source library for protecting AI summarizers and agents from prompt injection. Used to be part of my Searxly project (completely local browser using the search engine SearXNG that runs locally), the project has been since abandoned due to lack of finance on my part, so I am putting Bulwark under my name instead of the project.
The problem is straightforward. When you feed a model a web page, an email, a PDF, or a search result, you're handing it untrusted text. That text can contain hidden instructions telling the model to ignore its system prompt and do something else entirely. Most of the time a naive summarizer will just obey them. This is the top risk in the OWASP list for LLM applications, and it isn't something a single clever filter solves.
Bulwark applies every robust, well understood mitigation at once. It first recursively decodes anything that was base64, hex, percent encoded, ROT13, reversed, or hidden in zero width characters. Then it strips the tricks that are invisible to people but readable by models: Unicode tags, bidi controls, homoglyphs, leetspeak, nested hidden HTML. After that it runs signature detection across multiple cleaned views of the text, in English plus fourteen other languages. The content gets wrapped in a random nonce boundary so the model can see it is data rather than instructions. A strict system prompt and a secret canary token go in front of it. Once the model replies, the output is checked for canary leaks, boundary escapes, or anything that looks like an attempt to fetch data or exfiltrate information. Finally it grounds the summary: every URL or address in the reply has to actually appear in the original document.
None of this is perfect. A novel jailbreak written in ordinary prose that a specific model decides to follow can still get through. What changes is the bar. Instead of one hidden comment in a page being enough, an attacker now has to defeat input sanitization, structural isolation, the hardened prompt, and output validation at the same time. That is a very different problem.
It is zero dependency, written in Python, TypeScript and Swift with matching behavior across all three. There is also ToolGuard for the agent loop and an MCP firewall that can sit in front of any stdio MCP server. MIT licensed.
If you are building anything that takes untrusted content and passes it to a model, this is the kind of defense in depth I wanted when I started looking at the problem.
(Still being worked on and tested)






Comments
0 comments