Web Development

I Let An AI Agent Delete My Files, So Now I'm Obsessed With Permission Systems

A

Adil Sher

Author

Sep 4, 2026
4 min read
0 views
I Let An AI Agent Delete My Files, So Now I'm Obsessed With Permission Systems

I've been building with AI SDKs for about two years now, and I've noticed something that keeps me up at night: we're shipping agents with tool access like we're shipping regular API endpoints. No friction, no hesitation, just execute() and pray. Last week, I read about someone who actually built exactly this scenario, gave an AI agent a file deletion tool and watched it work without asking. That "oh shit" moment when you realize what could have gone wrong? That's become my baseline for how I think about agentic systems now.

The original article walks through this exact problem, and what strikes me is how honest it is about the near-miss. The developer didn't lecture about safety theater. They just showed what happened when they connected an AI model to destructive capabilities without any approval gate. Then they fixed it. That's the kind of engineering mindset I respect, you break it, you understand why it broke, and you build something better.

The Real Problem: Speed vs. Safety Trade-off

Here's what most developers miss about AI agents: they're fundamentally different from request-response APIs. When you call an LLM-powered system, you're not just waiting for compute. You're letting something reason about what to do, and that reasoning happens before the irreversible action fires. This is both beautiful and terrifying.

The approval mechanism described here isn't about adding a modal dialog. It's about intercepting that decision moment, after the model has decided what it wants to do but before the system does it. In AI SDK 7, this happens at the model-call level, which means you're not bolting this on as an afterthought. It's baked into the architecture.

What I find interesting is that this isn't new security theater. This is genuine friction in the right place. When you're deleting files or running database migrations or sending emails, you want that moment of "wait, let me verify this is actually what we meant to do."

Setting Boundaries That Actually Work

The article emphasizes something I've learned the hard way: approval doesn't replace path validation. The developers demonstrate this by implementing two separate checks in their file deletion tool. First, they validate the input path. Then, after resolution (using realpath()), they validate again. This catches the sneaky symbolic link attacks that casual developers miss.

// First validation - input level
function resolveInsideFixtures(inputPath: string): string {
 const root = resolve(process.cwd(), 'fixtures')
 const target = resolve(root, inputPath)
 const rel = relative(root, target)
 
 if (rel === '' || rel.startsWith('..') || isAbsolute(rel)) {
 throw createError({
 statusCode: 400,
 statusMessage: `Path escapes the fixtures directory: ${inputPath}`
 })
 }
 return target
}

// Second validation - after symlink resolution
const canonicalTarget = await realpath(target)
const rel = relative(root, canonicalTarget)
if (rel === '' || rel.startsWith('..') || isAbsolute(rel)) {
 throw createError({
 statusCode: 400,
 statusMessage: 'File resolves outside fixtures'
 })
}

This pattern matters because approval is a gate, not a jail. The user approving the action might not catch every detail. Your code still needs to enforce boundaries. They move in parallel, not serial.

My Take: This Is Just the Beginning

I think the tech stack here, Nuxt 4, AI SDK 7, Amazon Bedrock, is solid, but I'm more interested in the mental model being advocated. The approval pattern seems obvious in retrospect, but I've seen enough production systems that skip it entirely because "we'll add it later" or "the model is smart enough."

The reality is that models are great at many things, but they're probabilistic. They sometimes decide to delete things. And when your infrastructure runs on probabilities, you need deterministic checkpoints.

What I'd add to this approach is audit logging. An approval system without a record of what was approved and when is just security theater. I'd want every approval decision, yes and no, logged somewhere immutable. Not because I'm paranoid, but because when something goes wrong at 2 AM, you need to know exactly what path the system took.

I'm also curious about how approval scales. The example is single-file operations. What happens when an agent needs to approve a batch operation? Do you approve each item, or the batch? That tension between user experience and safety is where things get interesting.

What's Next for Your Agent?

If you're building agents in production, and I know more of you are than will admit it, this permission-first pattern should be your baseline, not your aspirational goal. Build it in from day one, not as a patch.

The question I'd leave you with: What irreversible actions is your agent currently capable of without any approval gate? Go find those. That's where your leverage for improvement is.

Source: This post was inspired by "How to Build an AI Agent That Asks Permission First (Nuxt + AI SDK 7)" by Dev.to. Read the original article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

The AI Model Speedrun Just Changed How I Price My Agent Systems
Web Development Sep 3

The AI Model Speedrun Just Changed How I Price My Agent Systems

Last month, I deployed an AI agent system for a client that needed to classify documents at scale. I picked Claude because, frankly, it was the safe choice, everyone uses it, the benchmarks looked solid, and I didn't want to bet my reputation on chasing the latest frontier model....

The SEO Playbook I Ignored Until My Client's Traffic Tanked
Web Development Sep 2

The SEO Playbook I Ignored Until My Client's Traffic Tanked

I had a conversation with a client last month that forced me to confront something I'd been quietly avoiding. Their website was ranking #1 for their primary keyword in Islamabad, yet their phone wasn't ringing like it used to. I assumed it was seasonal. Then they showed me their...