What is least privilege? Explained with a hotel key card
Least privilege means every person, app and AI agent gets only the access its job needs, nothing more. Explained with a hotel key card that opens only your room, until you check out.
- Author
Umair Mateen- Published
- Reading time
- 5 min
- Category
- Engineering
Our guide to using AI agents in customer support safely warns against giving an agent permissions broader than its task, and the idea behind that advice has a name: least privilege.
In one sentence: Least privilege is a security rule that gives every person, app and AI agent only the access they need to do their job, and nothing more, so a mistake or a break-in can only reach a small part of your systems.
The everyday picture
Think about a hotel key card. When you check in, reception loads your card to open your room, the lift to your floor and the breakfast room. It does not open other guests' rooms, the kitchen or the office.
The card also has an end date. When you check out, it stops working. The cleaner's card opens the rooms on their floor, during their shift. The manager's master key is kept apart and used only when it is really needed.
If you lose your card, the damage is small. Whoever finds it can open one room for a few days, not the whole hotel. That is least privilege: every card opens only what its holder needs, for as long as they need it.
Reception loads a card with just the doors the guest needs. Each door checks the card, so the guest's room opens while every other room stays locked.
How it works, step by step
- Someone or something asks for access (a guest at reception). It can be a new employee, a software tool, or an AI agent that needs to read your help articles.
- The task decides the access (reception loads only the doors you need). NIST, the US standards body, describes least privilege as giving each user or process the minimum access it needs for its assigned tasks. If a job only needs to read records, it gets read-only access, not the right to change or delete them.
- Every request is checked (the reader on each door). The system checks the access each time, not just once at login. OWASP's guidance for AI apps says this check should happen in the systems the agent calls, not by asking the AI whether it is allowed.
- Powerful access is kept apart (the master key in the safe). New Zealand's National Cyber Security Centre advises separate accounts for everyday work and admin work, and short-term admin access where possible.
- Access ends or shrinks (the card stops at checkout). Access is reviewed and removed when it is no longer needed. The same guidance notes that access is often given but never taken back.
Try it · Spot the weak point
Which part of this AI agent set-up gives too much access?
A shop sets up an AI agent to answer customer emails. Tap the part that breaks least privilege.
Where the picture stops
- A hotel has a few dozen doors. A business system can have thousands of permissions, such as "view invoices" or "send email", so working out the real minimum takes more care.
- A key card only opens doors. In software, access also controls what you can do once inside: read, change, delete or send. Least privilege limits those actions too, not just where you can go.
- A guest is one person. An AI agent can act many times a second and can be tricked by text it reads, such as a hidden instruction in an email. That makes tight limits on agents even more important.
Why it matters for your business
- Smaller damage when things go wrong. If an account is stolen or an AI agent makes a mistake, it can only reach what it was given. NCSC NZ says this limits how far an attacker can move inside your network.
- Safer AI agents. OWASP lists "excessive permissions" as one of three causes of AI agents doing damaging things, next to too many tools or functions and too little human checking.
- Fewer costly accidents. A staff member who can only read a record cannot delete it by mistake.
- Easier answers for clients and auditors. When each account has a clear, small set of access, it is simpler to show who can see customer data.
Try it · Myth or fact
Least privilege: myth or fact?
Decide for yourself first, then tap each statement to check it.
0 of 3 checked
An example
Imagine a 15-person online shop adding an AI agent to answer customer emails. Instead of logging it in with the owner's admin account, the team creates a separate account for it. The agent can read help articles and look up the order of the customer who wrote in. It can draft a refund reply, but a person approves every refund. After a month, the team checks what the agent actually used and removes the access it never touched.
Frequently asked questions
What is the principle of least privilege?
It is the rule that every user, program or AI agent gets only the minimum access needed for its job. Anything else stays closed by default.
Is least privilege the same as role-based access control?
No. Least privilege is the goal: as little access as needed. Role-based access control is one common way to reach it, by giving permissions to job roles instead of to each person.
How do I apply least privilege to an AI agent?
Give the agent its own account, connect only the tools its task needs, start with read-only access, and ask a person to approve high-impact actions such as payments or sending email.
Does least privilege slow people down?
It can if access requests take days. A quick, clear way to ask for extra access, and short-term access for one-off jobs, keeps work moving without leaving doors open.
Related explainers
- What is role-based access? Explained with office keycards
- What is an AI agent? Explained with an assistant you send on errands
- What is human-in-the-loop? Explained with a manager signing cheques
- What is an API key? Explained with a key to a supplier's stockroom
The DevDrift connects AI agents to business systems with tight permissions, approvals and audit trails: see how.
Sources
Could you explain this to a colleague now?
Mark it and posts that mention it will show a tick. Saved in this browser only.