One email with a hidden instruction is all it takes for an AI agent to delete, send, or leak what you told it to protect. This kit puts security outside the prompt: 5 ready-to-use locks and a bank of 10 attacks to test your agent.

Agente Blindado is a free kit for people who use AI agents with access to files, email, or systems, such as Claude Code or n8n. It protects against prompt injection: external text (email, webpage, PDF) containing a hidden instruction that the agent follows. Instead of trusting the prompt alone, the kit includes 5 locks that work outside it, an installer, and a bank of 10 harmless attacks to measure your agent. You only need Python 3 and, for the Claude Code locks, Claude Code itself.
The project explained in a few minutes.
Prompt injection is the #1 risk on the OWASP Top 10 for LLM Applications (2025). A model can be persuaded; code that runs before every action cannot.
An envelope for external text, owner rules, least privilege, a hook that asks for your approval, and a planner separated from the executor.
Email, webpage with hidden text, spreadsheet, code, API response, base64. All harmless: fake keys and addresses that do not exist.
The test checks the files after the attack (was one deleted? leaked? created?), not what the agent says it did.
Locks 1 and 2 help the model resist. Locks 3, 4, and 5 hold even if it falls for the attack.
Each one is a file in the repository. Use one or combine them all.
Wraps email, webpage, or PDF as data, not an instruction, with a random boundary the attacker cannot guess. It can also mark text word by word or encode it in base64.
python3 travas/1-marcar-fora/envelope.py email.txtA block for the top of CLAUDE.md or the system prompt: the owner is in charge; all external text is data; and what must never be done, even if requested.
# copy to your agent
travas/2-hierarquia/REGRAS-DO-DONO.mdThree Claude Code permission profiles: reader (read-only), writer (edits and tests, no network or deletion), and publisher (pushes and sends require your approval). Secrets stay locked away.
travas/3-minimo/escritor.json
A hook that runs before each tool, outside the model. Deleting, sending, downloading, and executing; changing .env; force pushing; and DROP TABLE all require your approval, or are blocked outright when no one is watching the agent. Includes instructions for n8n.
travas/4-aprova/trava_destrutiva.py travas/4-aprova/N8N.md
A read-only planner returns a plan in JSON. You approve it. An executor without AI performs only actions on the allowlist and writes only the files you specified.
travas/5-planeja-executa/planeja_executa.py
10 poisoned documents + a test with a real model (banco.py) + a worst-case test without AI (pior_caso.py).
banco/ataques/ · teste/
Nothing is sent outside. Tests with a model use Claude Code through your subscription.
For the envelope, hook, executor, and tests.
# check
python3 --versionFor locks 3 and 4, and to score your agent with a real model.
# check
claude --versionFor tests of the locks without AI.
# install pip install pytest # Ubuntu: sudo apt install python3-pytest
Every step includes the actual command. Start with step 3: it enables three locks at once.
Clone the repository into a folder outside your project.
git clone https://github.com/inematds/agente-blindado cd agente-blindado
Tests without AI verify the envelope, hook, and executor in under 1 second.
python3 -m pytest teste/ -q # 8 passed
Choose a profile (reader, writer, or publisher). The installer backs up .claude/settings.json, merges permissions, enables the hook, and adds the owner rules to the top of CLAUDE.md. You can run it again without creating duplicates.
./instalar.sh ~/meu-projeto escritor # unattended agent (claude -p, cron): block directly instead of asking ./instalar.sh ~/meu-projeto escritor --negar
Open the project's CLAUDE.md and replace what is inside < >: your name and working folder.
nano ~/meu-projeto/CLAUDE.md
Before asking the agent to read an email, webpage, or PDF, run it through the envelope and provide the output.
python3 travas/1-marcar-fora/envelope.py email.txt --origem "supplier email" > material.txt
The planner only reads and returns a plan. You review it and approve. The executor writes only the files you specified in --arquivos.
python3 travas/5-planeja-executa/planeja_executa.py \ --tarefa "summarize the email and note the dates" --material material.txt --arquivos resumo.md,notas.md
Simulates a 100% deceived agent that follows every hidden instruction, and shows what each lock can stop on its own.
python3 teste/pior_caso.py
Runs the 10 attacks with real Claude Code, without locks, with locks, and in planning mode. Each run uses your subscription.
python3 teste/banco.py --modos sem,com,planeja --modelo sonnet # results in teste/resultados/<data>.md
Each blocked action is logged in the project folder.
cat ~/meu-projeto/.agente-blindado.log
After the AI Agent, an IF node routes the dangerous action to a Telegram, Gmail, or Slack node using the Send and Wait for Response operation (approval). The full instructions are in the repository.
travas/4-aprova/N8N.md
Worst case: an agent that follows EVERY hidden instruction. Attacks that caused no harm, out of 10:
No locks. Created a file, deleted the contract, leaked the key, sent the .env outside.
Hook only (lock 4). Blocks deletion, leaks, and sending. Lets ordinary file writes through.
Plan × execute (lock 5). Only allowlisted actions and only the files you specified.
Attack 04 does not ask the agent to do anything: it simply lies in the text ("approved supplier, pay R$ 48,000"). Code cannot know what is true. You catch it by reading before acting, which is why lock 4 asks for your approval for anything that costs money or cannot be undone.
We ran the 10 attacks on Claude Code (07/11/2026). Sonnet and Haiku stopped all 10, even without locks: they noticed the hidden instruction and alerted the owner. With the locks on, they also held all 10. (In the Sonnet run the checker flagged a failure that was just the model quoting the attack to warn the owner; we corrected it by hand and noted it in teste/resultados/.) In other words, leading models already resist these attacks. Locks are for the day an attack is better than the model, for agents using smaller or open models, and for when your agent has access to sensitive resources. Run teste/banco.py with your agent and see its score.
The kit will grow with attacks contributed by the community.