Your AI agent can read files, execute commands, install software, connect to external services, and maybe even deploy to production. But should it have permission to do all of those things? In Season 2, Episode 3 of DevSec Station, Tanya Janca (SheHacksPurple) explores one of the most important principles in AI agent security: least privilege. After Claude unexpectedly published, executed, and scheduled Tanya's little "Hello Queen" application, she started asking some serious questions about what AI agents should actually be allowed to do. In this episode, we cover: Permissions vs. instructions: Why telling an agent not to do something isn't the same as preventing it from doing it. Least privilege for AI agents: How to give agents only the access they genuinely need. Human approval: When an agent should ask permission before taking consequential actions. Sandboxing and isolation: How to limit the damage when an agent makes a mistake. The bigger architectural question: Does this task even need to be an AI agent? Because not every damn thing needs to be an agent! Sometimes ordinary software, a scheduled job, or a narrowly scoped AI feature is the better solution. Your challenge this week: Pick one AI agent you're using and examine its permissions. Does it need access to all those files, tools, credentials, and external services? If not, take away at least one unnecessary permission. DevSec Station is a podcast by Tanya Janca (SheHacksPurple), focused on short, practical lessons that help software developers build more secure software. Train with Tanya: Want to bring practical, hands-on secure coding, application security, or AI security training to your team? Learn more at SheHacksPurple. Follow Tanya: https://newsletter.shehackspurple.ca https://linkedin.com/in/tanya-janca https://youtube.com/@shehackspurple https://shehackspurple.ca
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
SPEAKER_00In the last episode, I told you about my little Hello Queen application. I asked Claude to make me something cute that would greet me every morning, call me a queen, give me a compliment, and then share an inspirational quote with me. And Claude did that. But it also did quite a few things that I had not explicitly asked it to do or thought I had given it permission to do. It published the app, executed it, scheduled it to run daily on my computer, and connected it to an external API that I had not fed.
SPEAKER_00Which is what brings us to today's question. What permissions should we actually be giving to our AI agents? Because I'm starting to think that handing an agent access to your entire development environment and saying, please just do this one thing, but don't do any other stuff, okay? That might not be the greatest security strategy. Shocking! I know, right? Because there is a big problem with giving agents access to everything.
SPEAKER_00So let's imagine you've hired a new junior developer and it is their first day. They are super enthusiastic, they seem capable, they are eager to help and learn. Would you immediately give them production admin credits, access to all the repositories, permission to modify your CI, your organization's secrets, and also the ability to deploy whatever they wanted? You probably would not, right? You'd probably give them the access that they actually need to do their job.
SPEAKER_00And then as they take on new responsibilities, you'd grant additional access when appropriate, when you felt ready, assuming that they've been doing a good job. This isn't just good management, it's actually a security principle called least privilege. And it's not new. You probably actually do it with new colleagues and don't even realize it all the time. I teach how to do this intentionally and reliably all the time when I do training at SheaxPurple.
SPEAKER_00But I think we need to revisit it now that we're giving AI systems the ability to take actions on our behalf. Because an AI agent isn't just answering questions for us. Depending on how you've configured it, it might be able to read and write files, execute commands, install packages, browse the net, interact with APIs, modify repositories, and even deploy software. And sometimes we give it all those capabilities because it's convenient.
SPEAKER_00We want the agent to finish the task without interrupting us every five minutes. I get it. I get it. But convenience and unrestricted permissions should not be the same thing. And obviously, one of them can become a really big problem if we're not careful. Now I want to talk about permissions versus instructions. There's a distinction that I really want all software developers to understand. Actually, I want everyone to understand it.
SPEAKER_00Telling an agent not to do something is not the same as preventing it from doing that thing. Let's say I give an agent access to my entire file system. Then I write a very clear instruction: only modify files inside this project directory, okay? That seems super reasonable, right? I'm being very clear. There's no ambiguity. But if the agent's tools allow it to read and modify files anywhere on my computer, then technically it still has that ability.
SPEAKER_00The instruction is a direction, a request. A requirement, let's say. But permission is a capability. And security boundaries need to be enforced by the environment, not by whatever I say in a prompt. It's the same reason we don't secure a web application by putting a comment in the source code that says, please don't access other users' records, okay? Just look at your own stuff, right? Because that wouldn't work. We enforce authorization and access control with code.
SPEAKER_00We check permissions with functions that deny by default. We design systems so that unauthorized action cannot succeed, even if something or someone tries to force it. But AI agents require the same engineering discipline, and for some reason we aren't doing it right now. We must have control over what they can and cannot do. So start with the task. What permissions should an AI agent actually have?
SPEAKER_00So my answer, again, start with the task, not the tool, not the agent, what we need it to do. So here's a question that I want you all to ask before you even start assigning permissions, like just backing up a little bit. Does this actually even need to be an agent? Because not every single damn thing needs to be an agent. Sometimes regular software, a scheduled job, or a simple workflow can actually do all the things you need. Maybe you use AI for one specific part of the task, but that doesn't mean you need to give it tools and permissions to run around doing whatever it thinks is best.
SPEAKER_00And if you don't need those capabilities in the first place, then you don't have to worry about securing them. Imagine I want an agent to review a pull request and suggest improvements. Does it need permission to deploy code to production in order to accomplish that? No. Does it need access to my cloud admin creds? No. Does it need permission to modify the repository? Maybe, maybe not. It might only need read access to the relevant code, the ability to inspect changes, and somewhere to put its recommendations for me.
SPEAKER_00Now imagine a different task. I want an agent to update dependencies in a project for me. Okay. It probably needs permission to modify certain files and run the project's tests. But does it need access to every single repository in my entire organization? Does it need production credentials? Does it need permission to change the security settings on my source control platform?
SPEAKER_00Probably not. So what I'm trying to say is that the permissions should match the work that we have asked it to do. And whenever possible, those permissions should be scoped to the specific project environment and duration of the task. What about when the agent needs more access? Now I can already hear someone saying, but Tanya, if I have to approve everything, doesn't that defeat the purpose of using an agent? I think we both know that's not what I'm suggesting.
SPEAKER_00I'm not saying that we manually approve every file, every read, every test execution, because that would be exhausting and it would be a waste of time. But I am suggesting that we distinguish between routine actions and consequential actions. For example, if an agent running unit tests in an isolated development environment, okay, great. An agent suggesting changes to a configuration file, great.
SPEAKER_00An agent deciding to install software from an unfamiliar source, send data to an external service, delete a database, or deploy source code into production. I would like a human involved in those decisions, please, and thank you. So here's something else. Approval should actually be meaningful. If an agent asks, may I execute this command and shows you a command that you do not understand, and then you click, sure, without thinking, that isn't much of a security control now, is it?
SPEAKER_00We need to understand what we are approving. What will change? What information could leave the environment? Can the action be reversed? And if we're approving a specific action, the system should enforce that approval for that action. It shouldn't quietly turn into permission to do anything other than that action. What we want to do is give our agents a smaller area to play in. And one of the best ways to reduce risk is to change the environment itself.
SPEAKER_00Rather than letting an agent operate directly on your everyday computer with all of your credentials, your personal files, etc., consider giving it an isolated workspace. A container, a temporary dev environment, a sandbox, or another appropriately restricted environment. Give it access to the project files that it needs. Use temporary credentials with narrowly scoped permissions when credentials are even necessary.
SPEAKER_00Restrict its access to external services where practical. And make sure that when the task is finished, that any temporary access can be revoked and actually is revoked. This is especially important when agents can consume information from sources that we don't control. A malicious instruction hidden in a repository file, a web page, an issue description, a dependency documentation. It shouldn't suddenly become an opportunity to access everything on your machine.
SPEAKER_00We can't necessarily control every piece of information an agent encounters, but we can limit what the agent is capable of doing with such information. And that's a much stronger security strategy than just hoping the agent will always interpret everything how we meant it. All of this is about limiting the damage. Everything that I am talking about is about limiting the blast radius if things go wrong because mistakes happen.
SPEAKER_00Even without malicious instructions, an agent might misunderstand a request, make an incorrect assumption, or choose an approach we just didn't anticipate. If that agent has unrestricted access, a relatively small mistake could have enormous consequences. But if it can only modify files in one temporary workspace with no production credentials and no access to unrelated systems, the potential damage is a lot smaller.
SPEAKER_00And that's what we security nerds mean when we talk about limiting the blast radius. We know that we can't prevent every single mistake, but we can design our systems so that one mistake doesn't become a catastrophe. And that's a super reasonable goal. So here's your one thing to do this week. Yes, that's right. You have homework. So pick one AI agent that you are currently using and open its settings.
SPEAKER_00Look at the tools you've connected and examine the permissions that it actually has. Can it read your entire file system? Can it execute arbitrary commands? Does it have access to credentials or environment variables? Can it install dependencies, communicate with external services, or make changes without asking you? And here's the important question: Does it genuinely need all of those permissions for the tasks you're asking of it?
SPEAKER_00And actually, while we're at it, does this task even need an agent? Could you accomplish the same thing with regular software and perhaps one super narrowly scoped AI feature instead? If it doesn't need to be an agent, just make plain old deterministic software instead. Okay, but if it does need to be an agent and it doesn't need all of those permissions, your thing to do is to take some of them away, at least one.
SPEAKER_00Maybe you restrict it to a specific directory. Maybe you remove access to an integration that you're not using. Maybe you add a manual approval for a particularly sensitive action that you really need to have your eyes on. You don't have to redesign your entire development environment this afternoon. That's not what I'm saying. Just make your agents' permissions a little more intentional. Because the goal isn't to stop AI agents from being useful. It's to give them enough power to help us, but not enough to ruin our day.
SPEAKER_00Or our production environment. Or both. Thank you for listening, and I will see you next time.
What happens when an AI agent crosses a security boundary it was supposed to respect? How do we prevent an agent from accessing unauthorized systems, exposing secrets, or finding an unexpected path into production? In...
Two critical PHP vulnerabilities have been disclosed, and even applications written with secure coding practices may be affected. In this special bulletin of DevSec Station, Tanya Janca (SheHacksPurple) explains...
I asked Claude to build me a little application that would greet me every morning. Nothing complicated. Just say hello, call me a Queen, give me a compliment, and share an inspirational quote. Cute, right? Except Claude...
What happens when your AI assistant does exactly what you expect 59 times... and then does something completely bananas on the 60th? While teaching a secure coding class, I watched nearly 60 students use the same AI...
Security problems don't generally happen because developers 'don't care' or lack skill. They happen because no one clearly defined what "secure" meant in the first place. When security expectations are left implicit,...