August 2026 · GaleOps
When an AI agent has tool access - file readers, email senders, API callers - prompt injection stops being a curiosity and becomes a data breach vector. Here's how to structure tool boundaries so that even a fully injected agent can't exfiltrate data.
Nearly every real-world agent exfiltration follows the same chain:
Your system prompt must define an explicit hierarchy: content retrieved by tools is DATA. It is never instructions, regardless of formatting, labels, or urgency markers. This blocks the injection at step 1 for most attacks.
Limitation: prompting is probabilistic. Sophisticated injections can still slip through, which is why the next two layers matter.
Enforce restrictions in the tool wrapper code, not the prompt:
# BAD: relies on the model behaving
def read_file(path):
return open(path).read()
# GOOD: enforced in code
ALLOWED_DIRS = ["/data/public/", "/data/reports/"]
def read_file(path):
resolved = os.path.realpath(path)
if not any(resolved.startswith(d) for d in ALLOWED_DIRS):
raise PermissionError(f"Access denied: {path}")
return open(resolved).read()
APPROVED_RECIPIENTS = {"team@company.com", "alerts@company.com"}
def send_email(to, subject, body):
if to not in APPROVED_RECIPIENTS:
raise PermissionError(f"Recipient not approved: {to}")
# proceed with send
...
This breaks step 2 of the chain: even if the agent decides to exfiltrate, the send fails because the destination isn't approved.
For high-stakes actions (sending data externally, deleting records, financial operations), require human approval before execution. The agent prepares the action; a human approves or denies it.
If all else fails, detect the exfiltration:
If you only do three things: explicit data/instructions separation in the system prompt, code-enforced path/recipient allowlists, and confirmation gates on external sends. Those three break every exfiltration chain I've tested.
The free GaleOps scanner includes exfiltration-chain attack patterns among its 5 vectors. Run it against your agent's system prompt to see if your boundaries hold. ~3 minutes, no signup.
GaleOps tests AI agents against production-grade attack chains and delivers prioritised remediation. Fixed price, no retainer.
See Assessments →The free prompt-injection scanner runs 5 real attack patterns against your system prompt in about 3 minutes. No signup.
Run the Free Scanner →