Your AI Agent Is Not a Security Boundary
From the publisher’s feed, collected in the ZeroLabs newsroom.
An AI coding agent deleted a production database in about nine seconds.Not because it was evil.Not because the model wanted to break things.Because the system gave it enough access to do real damage.The agent had a goal. It found a credential. It called a destructive API. That is the part every engineering team should care about.The lesson is not “never use AI agents.” The lesson is simpler: do not treat the agent’s prompt as your security boundary.The 9-Second IncidentOn April 24, 2026, an AI coding agent deleted PocketOS’s production database and every volume-level backup in roughly nine seconds.The agent was Cursor, running Claude Opus 4.6. The task was routine — fixing a staging environment credential issue. The agent hit a mismatch, searched the available files, and found a Railway CLI token that had been created for managing custom domains but was scoped broadly enough to authorize any operation. It used that token to issue a destructive volumeDelete call against the production volume. Railway stored backups on the same volume, so they went with it. The most recent off-volume backup was three months old. (The Register)In the postmortem, PocketOS founder Jer Crane published the agent’s own confession. It listed the exact safety rules it had violated: “I violated every principle I was given: I guessed instead of verifying. I ran a destructive action without being asked.” (Fast Company)Here is the part that got buried under the commentary: the agent’s action made sense inside its narrow task loop. That is what made it dangerous. It had a goal, it had a credential, it took an action, and its reasoning was internally coherent the whole way down.Nothing outside the model said no.If an AI agent can delete production with a credential it found while fixing staging, the model is not the first thing I would blame. The access model is.The Real Problem Is Ambient AuthorityMost teams already have this problem without AI. CI jobs, admin scripts, and shared cloud tokens routinely carry more access than the task in front of them needs. The uncomfortable part is that many teams already trust those CI jobs with more authority than they trust a junior engineer. We have just been lucky that humans are slow, ask questions, and hesitate before running something irreversible. Agents remove all three of those brakes.AI agents did not create the ambient-authority problem. They made it faster.The technical name for the PocketOS failure is ambient authority: the agent found a credential that granted more permission than any specific task required, and nothing forced it to justify the match between the token and the operation. Whatever the intended scope was, the effective authority was too broad — the agent could reach a destructive production operation from a routine staging task.That is the bug. Not the model’s judgment. The fact that the judgment was load-bearing at all.Prompt Rules Are Not Security ControlsWhen you write “you must never delete production data” into a system prompt, you are placing a soft constraint inside the same probabilistic process that is trying to solve the problem in front of it. A prompt is not enforcement. It is another instruction competing for the model’s attention.The research here is blunt. In the October 2025 paper “The Attacker Moves Second,” researchers from OpenAI, Anthropic, and Google DeepMind tested 12 recent defenses against prompt injection and jailbreaks. Under adaptive attack, they bypassed most of them with success rates above 90% — and a human red-teaming track defeated every defense outright. (arXiv)Anthropic’s own safety documentation makes the same point from the other direction: agentic systems still carry measurable prompt-injection risk, and that risk climbs the more an agent can act through tools, browsers, or GUI environments. (Claude Opus 4.6 System Card) The exact percentages matter less than the lesson — model-side safeguards are not enough once the agent can take real actions on real systems.None of this is a criticism of the models. It is a statement about where you put the boundary. When the goal and the safety instruction conflict — and in production, they will conflict — the safety instruction often loses, because both live in the same reasoning context.Simon Willison named the underlying pattern in June 2025: the lethal trifecta. An agent becomes catastrophically dangerous when it simultaneously has access to private data, exposure to untrusted content, and the ability to take external actions. (Simon Willison) PocketOS hit all three, with no deterministic control outside the loop to break the chain.The Architecture Shift: Propose, Authorize, ExecuteAI agent security starts outside the prompt. The fix is to move enforcement outside the agent’s reasoning loop entirely. The agent proposes an action. A deterministic system — not the model — authorizes or denies it. Only then does it execute. Fail closed.This is not a new idea. It is capability-based security, and distributed systems engineers have been building it for decades. The only new part is applying it to agents. The next three sections are the practical pieces: capabilities instead of credentials, a policy gate on every tool call, and a hard human checkpoint for destructive actions.Give Agents Capabilities, Not CredentialsThe root cause at PocketOS was that the agent held a raw credential and decided for itself how to use it. The alternative is to never hand an agent a credential at all. Instead, it requests a short-lived, task-scoped capability at the moment of need — and that capability is revoked the instant the task is done. This is usually called Zero Standing Privilege: no persistent authority, only scoped and time-limited access for the operation at hand.Here is a simplified example. The exact language is not the point — the boundary is. In Rust, a capability type makes the shape of that contract explicit:use std::time::{Duration, Instant};#[derive(Debug, Clone)]pub struct Capability { pub resource: String, // e.g., "railway:volume:staging-db" pub action: String, // e.g., "read" | "write" | "delete" pub expires_at: Instant,}impl Capability { pub fn new(resource: &str, action: &str, ttl: Duration) -> Self { Self { resource: resource.to_string(), action: action.to_string(), expires_at: Instant::now() + ttl, } } pub fn is_valid(&self) -> bool { Instant::now() } pub fn authorizes(&self, resource: &str, action: &str) -> bool { self.is_valid() && self.resource == resource && self.action == action }}// A tool accepts a capability, not a raw credentialpub fn delete_volume(cap: &Capability, volume_id: &str) -> Result { let resource = format!("railway:volume:{}", volume_id); if !cap.authorizes(&resource, "delete") { return Err(format!( "Capability does not authorize delete on {}", resource )); } // Proceed with deletion only if explicitly authorized Ok(())}This is not magic, and it is not really about Rust. This version still checks authorization at runtime — resource and action are strings, and the authorizes() call is what does the work. A stricter design could encode resource and action types more deeply into the type system. But even this simple version removes the most dangerous pattern: the tool no longer accepts a broad credential and trusts the caller to use it well. It accepts a narrow capability that must match the resource, the action, and the expiry window. A capability issued for custom-domain management would not satisfy a "delete this production volume" check.I ran into a quieter version of this while building cloud cost tooling. An agent with Azure Reader permissions felt safe — until we traced that “read” access on a billing scope let it enumerate production resource names, regions, and usage data that had no business leaving a task context. We tightened it to subscription-scoped, task-lifetime tokens. That was capability-based thinking before I had a name for it. The pattern is old. Applying it to agents is the new part.Fail Closed at the Tool LayerCapabilities scope what an agent can reach. A policy gate decides what it is allowed to do — and it runs outside the model, on every tool call, before anything executes.This is the next layer, and it is where most teams should start: intercept the tool call before it executes. In Go, an Open Policy Agent (OPA) interceptor wraps each call:package guardrailsimport ( "context" "fmt" "github.com/open-policy-agent/opa/rego")type ToolCall struct { Tool string `json:"tool"` Arguments map[string]string `json:"arguments"` Env string `json:"env"` // "staging" | "production"}type PolicyEngine struct { query rego.PreparedEvalQuery}func NewPolicyEngine(ctx context.Context, policyRego string) (*PolicyEngine, error) { q, err := rego.New( rego.Query("data.agent.allow"), rego.Module("policy.rego", policyRego), ).PrepareForEval(ctx) if err != nil { return nil, fmt.Errorf("policy compile error: %w", err) } return &PolicyEngine{query: q}, nil}// Intercept evaluates every tool call. Returns error if denied.// FAILS CLOSED - any evaluation error or malformed result = denied.func (pe *PolicyEngine) Intercept(ctx context.Context, call ToolCall) error { input := map[string]interface{}{ "tool": call.Tool, "arguments": call.Arguments, "env": call.Env, } results, err := pe.query.Eval(ctx, rego.EvalInput(input)) if err != nil { // Fail closed: evaluation error = denied return fmt.Errorf("policy evaluation failed (denied): %w", err) } // Type-check the result. Anything missing, malformed, or non-boolean = denied. allowed, ok := extractAllow(results) if !ok || !allowed { return fmt.Errorf("policy denied: tool=%s env=%s args=%v", call.Tool, call.Env, call.Arguments) } return nil}func extractAllow(results rego.ResultSet) (bool, bool) { if len(results) == 0 || len(results[0].Expressions) == 0 { return false, false } v, ok := results[0].Expressions[0].Value.(bool) return v, ok}That extractAllow helper matters more than it looks. When you are teaching fail-closed security, you cannot let a malformed policy result panic the process or, worse, slip through as truthy. If the value is missing, the wrong type, or anything other than an explicit true, the call is denied.The Rego policy that runs inside the interceptor:package agent# Deny by defaultdefault allow = false# Allow read operations in any environmentallow { input.tool == "database_query" input.arguments.operation == "SELECT"}# Allow non-destructive writes only in stagingallow { input.env == "staging" not is_destructive(input.tool)}# Destructive operations require an explicit human approval tokenallow { is_destructive(input.tool) input.arguments.human_approval_token != "" valid_approval_token(input.arguments.human_approval_token)}is_destructive(tool) { destructive_tools := {"volume_delete", "database_drop", "backup_purge"} destructive_tools[tool]}The critical line is default allow = false. The policy fails closed. If the agent proposes something the policy does not explicitly permit, the call is blocked before it executes. No exception, no escalation path that quietly bypasses the check.Microsoft’s open-source Agent Governance Toolkit, released April 2, 2026, ships exactly this pattern: a stateless policy engine that intercepts every agent action before execution at sub-millisecond latency (under 0.1ms p99), with support for OPA Rego and Cedar. (Microsoft Open Source Blog) At that latency, performance is not the reason to skip the guardrail.Make Destructive Actions Require a HumanEven with capabilities and a policy gate, there is a structural risk whenever an agent handles untrusted input, touches sensitive systems, and can take external actions in the same session. A Meta AI post, summarized well by Simon Willison, frames this as the Agents Rule of Two: in a single session, an agent should satisfy at most two of these three at once. (Simon Willison’s writeup)Process untrusted input (user messages, scraped content, third-party data)Access sensitive systems or data (production databases, credential stores, financial systems)Change state or communicate externally (write operations, API calls, webhooks)When all three converge, put a human in the loop. Build that as a deterministic gate, not a prompt that politely asks the model to pause and double-check.In practice: an agent that reads user-provided files and has access to production infrastructure should not be able to execute a write without a human approval token. If you expose tools through MCP — the Model Context Protocol, the emerging standard for connecting agents to tools — tag the destructive ones explicitly and require that approval token before the policy engine will let them run. Generate the token from a human-facing UI, expire it in five minutes, and make it single-use.Keep Backups Outside the Blast RadiusThe PocketOS damage was doubled by a storage decision that had nothing to do with AI: backups lived on the same volume as the data they protected. Delete the volume, delete the backups.This is not an AI problem. It is a backup architecture problem that AI made more dangerous by collapsing the time-to-disaster from “several deliberate human steps” to nine seconds.The rule is simple to state and easy to get wrong: nothing about backups should be reachable by the same actor that can delete the thing being backed up. Off-volume, off-region, immutable backups are not optional once agents have write access to infrastructure. The agent’s blast radius is bounded by what it can reach. Put backups outside that radius and they survive the mistake.A Practical Checklist for This QuarterThe control plane, in priority order:Capability broker — issue short-lived, task-scoped tokens per tool call (RFC 8693 Token Exchange is a clean fit). Revoke on task completion.Policy interceptor — route every tool call through OPA or Cedar. Fail closed. Log every denial with full call context.Destructive action gate — any tool tagged destructive requires a human approval token before the policy engine allows it. Single-use, short expiry, generated by a human.Environment scoping — agents never get production credentials by default. Staging is the ceiling unless an explicit, human-approved escalation happens.Immutable off-volume backups — verified independently of any infrastructure the agent can touch.The CoSAI Agentic Identity and Access Management work (Workstream 4) calls the underlying principle Zero Standing Privilege: agents hold no persistent authority and must request scoped, time-limited capabilities for every operation. (Coalition for Secure AI)The PocketOS agent violated every principle it was given because the principles were advisory and lived inside its own reasoning loop. The point of the architecture above is to make the model’s bad decision unable to become a production incident, regardless of what the model decides.The safest agent is not the one with the best system prompt. It is the one that cannot do the wrong thing even when it tries.Give agents capabilities, not credentials. Check every tool call outside the model. Make destructive actions require human approval. Keep backups outside the blast radius.Treat agents like highly confident interns with access to nothing.If your team is already running agents near production, I am curious where you draw the line today: read-only access, staged write access with approvals, or no production access at all? That is the debate worth having in the comments.If this helped, a clap helps more engineers find it.And if you build backend systems, AI agents, or cloud tooling, follow or subscribe. I write about what happens when AI leaves the demo and touches real infrastructure.Vinamra Yadav is a Software Engineer building tools where AI meets real infrastructure. Go, Python, Cloud. He writes about production systems, engineering decisions, and the business impact of clean code.Your AI Agent Is Not a Security Boundary was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.