Skip to content
All articles
Audit practice 9 min read· by Lars Zimmermann

From helper to master key: auditing AI agent access rights

Tokens with full rights, an SSH key for the whole Git account, access to the hosting account: how to find out what your AI agent can really do, and cut it back.

In short

An AI agent can reach whatever the keys in its hands open: tokens, SSH keys, hosting accounts, connectors. The tool’s permission mode mainly governs when it asks. That is why I survey six places: token scope, SSH, hosting accounts, connectors, lifetime and logging. Then I cut every right back to the task and give it an expiry date.

Auf Deutsch lesen: deutsche Fassung

“Full access rights, very much in the spirit of the times.” That is how a developer in a publicly shown set-up describes the token his AI agent uses to manage his database platform. The agent runs on a rented server and controls a second agent that writes code. Nobody hands out a master key on purpose. It grows. A token here, a key there, a ticked box at the hosting provider. In the workshop, a temp worker does not get the master key to the locking system on day one either. With agents, that is exactly what happens, and often nobody notices. I have explained elsewhere why an agent should only ever get a guest key. This article is about the inventory: how do you find out which keys your agent really holds, and how do you take them back?

Four cases from public set-ups

The cases come from tutorial and experience videos I analysed. Everything below is as the videos present it, and I have reproduced none of it. They show where rights end up in everyday practice.

  • The token. The developer from the opening gives his agent the management token for the database platform, with full access rights in his own words. On his web hosting he switches on SSH and stores the agent’s key. His comment: “And with that he can really do everything.”
  • The excursion. In another video about the same set-up he describes what happened after a commit. Instead of waiting to see whether the website had been updated, the agent went via SSH, on its own initiative, onto the machine that runs the deployment and read the logs there. He noticed through a command panel he had built himself: he had replaced the agent’s shell with one that also writes every command to a log file.
  • The account. In a beginners’ course, the instructor switches off the agent’s approval prompts because, he says, the managed environment at the hosting provider is a relatively closed box and the agent only gets access where it is meant to have it. Later he adds the agent’s public key to the SSH settings of his Git account and says himself that he is now granting access to the whole account. At the end, the course hands out the ground rule that the agent should only access the data it really needs.
  • The hosting provider. In a course on running your own server, the firewall lets through neither SSH nor HTTP after several resets. The presenter still gets into the terminal, via the web console in the hosting provider’s customer area. According to the video, this console uses the virtual machine’s serial port and is not affected by the firewall. The hosting provider’s built-in AI assistant fixes the fault directly in the terminal. The presenter says himself that the account with the provider is one of the most important accesses of all, since it can reset the entire server.

The pattern is the same: none of these rights was granted by a permission mode. They sit in tokens, keys and accounts. The program that runs the agent does not see them as rights, it only sees commands. And the agent in the second case did nothing forbidden. It used what was there.

Why an agent should only get a guest key in the first place, with the warnings from BSI and OWASP:

When AI clicks for itself

What the permission mode governs, and what it does not

Widely used coding agents have good switches. Claude Code has rules to allow, to ask and to deny. The program checks deny rules first, and no allow rule can override a deny. Anthropic stresses that Claude Code itself enforces these rules, independently of the model. Instructions in the prompt change nothing about them. According to the documentation, the mode that skips the prompts should only be used in isolated environments such as containers or virtual machines. In OpenAI’s Codex, the default mode keeps network access closed until you enable it. OpenAI lists the switch without any sandbox and without approvals as elevated risk and explicitly as not recommended.

Another passage of the same documentation matters more. There, Anthropic writes that a deny or ask rule for shell commands only catches the form in which Claude usually writes the command. It is not a security boundary around the program. For file and network limits that do not depend on the wording, Anthropic points to the sandbox. It is off by default. Once switched on, by default it may read most of the machine, explicitly including credentials such as the SSH folder. Anthropic itself advises protecting such files separately and offers a dedicated setting for it. According to the documentation, a plain SSH call cannot get out of the sandbox at all, not even to allowed destinations. If a command fails there, though, Claude can retry it without the sandbox. Whether that goes through without a prompt depends on the mode. It can be switched off with a separate setting.

For the inventory, that means: the mode tells you when the agent asks. What it can reach is determined by the keys on its machine and the rights attached to those keys. Both belong on the list.

An agent with strict rules and an admin token in its environment is a polite master key. It asks first. It can still unlock everything.

The checklist: six places where rights live

This is how I survey an agent’s rights in an audit. My first question is what it logs in with. What it may do follows from that. For each agent I create a row, and for each of the six places a column.

  • Token scope: Which tokens sit in the configuration, in environment variables or in the agent’s key store? For each one I record who owns it, which repositories, projects or databases it affects and with which rights. A token that can do everything gets a red mark, however convenient it is.
  • SSH: Which private keys are stored where the agent runs, and where is the public part registered? In the user account on Git, at the web host, on production servers? Every entry is a door, and the second case shows that the agent will find it.
  • Hosting accounts: Can the agent reach the customer account at the hosting provider, through an API token, a connector or the browser of a logged-in person? Is there a built-in AI assistant with terminal access? In the fourth case, such an account could reset the entire server and bypass the firewall.
  • Connectors: Which connectors and MCP servers are attached, with which rights in the target service, and who approved them? A connector to the ERP that can create orders is a right, even if the interface shows it only as a small icon.
  • Lifetime: When does each right expire? I write down “never” as an answer. Add the question of rights from earlier projects that are still valid, and of keys whose creator left long ago.
  • Logging: Where can someone see what the agent did, on its side and in the target system? Does it log in with its own account and its own key, or does the target system’s log show a person’s name?

For every row I ask two extra questions: who approved this right, and when did someone last look at it? If there is no answer, that is a finding, even if the right itself would be harmless.

Two-factor codes forwarded to the bot, and password vaults an agent can reach into, belong in the token scope column and deserve a separate look. Only this much here: if password and second factor sit with the same agent, the second factor no longer protects anything against that agent.

Cutting back with the vendors’ own tools

The tools for cutting back are in the documentation. They rarely appear in the videos.

GitHub has two kinds of personal access token. According to GitHub, a classic token grants access to all repositories in the organisations you have access to and to all personal repositories. A fine-grained token is limited to resources owned by a single user or organisation, can be restricted to specific repositories and carries individual permissions. GitHub recommends the fine-grained kind whenever possible. Organisations can block classic tokens and admit fine-grained ones only after approval. For access on behalf of an organisation and for long-lived integrations, GitHub advises a GitHub App, whose installation tokens expire after one hour. GitHub itself deletes tokens and SSH keys that go unused for a year. For a forgotten right with write access, a year is a long time.

For the case from the course there is the deploy key, an SSH key for exactly one repository, attached to the repository instead of a personal account. By default it is read-only, and write access has to be allowed explicitly when it is added. GitHub names the weaknesses as well: such keys usually have no passphrase and no expiry date, they stay active when their creator leaves the repository, and one with write access can do as much as an organisation member with admin access. On your own servers, OpenSSH helps. In the authorized_keys file, restrictions can be set per key: restrict switches off forwarding and the terminal, from limits the origin, command fixes the one command that runs at every login, and expiry-time sets an expiry date. An agent that is meant to read logs thus gets a key that starts exactly the log read-out and nothing else.

For connectors, the security guide to the Model Context Protocol explicitly lists catch-all permissions such as star, all or full-access as a common mistake. In Claude Code, /permissions is the quickest inventory: the dialog lists every rule together with the settings file it comes from. Individual tools of an MCP server can be denied or set to ask there. Through managed settings, IT sets rules that users and projects cannot override, and can block the mode without prompts entirely.

Whether your hosting provider’s API offers tokens with limited scope and an expiry date is stated in its documentation. If the information is missing, treat the token like the account password. Then it belongs in no agent. I treat the built-in AI assistant in the customer area like a service provider with remote maintenance access: what may it execute, who sees its commands, where are they recorded afterwards?

What the standards require, and how I check it

ISO/IEC 27001 has controls for all of this in Annex A, and they fit agents without contortions. Every identity is looked after from creation to deletion, an agent’s included (A.5.16). Access rights have a life from granting to withdrawal, with reviews in between and under defined rules (A.5.15, A.5.18). The allocation and use of privileged rights are to be restricted and managed (A.8.2). Access to source code has a control of its own (A.8.4). And the way someone logs in has to match what they can reach afterwards (A.8.5).

In the audit I therefore ask concrete questions. Does the agent have its own identity, or does it work with a person’s? Is its access to the hosting account recorded as a privileged right? When did anyone last review the keys in the Git account? An agent whose key sits in the instructor’s personal account is a topic under A.5.16 and A.8.2 at the same time. For logging (A.8.15), a log that merely exists falls short. It has to be kept protected and evaluated. In the second case, the home-made command log made the excursion visible. It only becomes evidence once it is stored protected and someone looks at it regularly.

If you run an AI management system under ISO/IEC 42001, Table A.1 gives you a second lever. Control A.9.4 ties the use of an AI system to its intended purpose and its documentation. For agents, I read it like this: the purpose is written down. Every right that goes beyond this purpose needs a justification, or it disappears.

The first afternoon

In a business with two or three agents, this takes one afternoon. This is how I go about it:

  • List all agents, including the one the shift supervisor set up himself to summarise inspection plans.
  • Fill in the six columns for each agent. You find tokens and keys where the agent runs: configuration, environment variables, key directory.
  • Check the other side: SSH keys and tokens in the Git account, access in the hosting provider’s customer area, connectors in the admin area of the AI platform.
  • Cut back: replace account keys with deploy keys, classic tokens with fine-grained ones that expire, and reduce catch-all permissions on connectors to what is needed.
  • Block the mode without prompts through managed settings, wherever the agent does not run in an isolated environment.
  • Put a date in the calendar three months out and go through the list again.

Honesty requires the other side too. The agent in the second case checked faster than its owner. That is exactly the benefit people use agents for. I have no wish to take reading the logs away from it. I want someone to have decided that it may. That it has a key for this that can do only that. And that it shows up in the log. Then the master key has become a key for one door. In a business, exactly one person carries the master key to the locking system, and that person knows it.

I independently review which keys your AI agents hold and which of them the task really needs, with ISO/IEC 27001 and ISO/IEC 42001 as the yardstick:

AI security

Primary sources

Share: LinkedIn E-Mail

Frequently asked questions

Is it enough to set the strictest permission mode in the tool?+

No. The mode governs when the agent asks. What it can reach depends on the tokens, keys and accounts it holds. Anthropic itself writes that a rule for shell commands is not a security boundary around the program. So check both.

Which GitHub token should an AI agent get?+

A fine-grained token, limited to the repositories and permissions the task needs, with an expiry date. According to GitHub, a classic token reaches every repository you can access yourself. For pure SSH access to one repository, a deploy key is the narrower choice.

How often should I review an agent’s rights?+

ISO/IEC 27001 requires a review in A.5.18 without prescribing an interval. I recommend a review every three months, and also whenever the agent, its connectors or its purpose change.

May an agent access production servers via SSH?+

If the task requires it, yes, with its own key per agent. In the authorized_keys file, OpenSSH limits such a key to an origin, a fixed command and an expiry date. Storing the key in an employee’s personal account is the road to a master key.

Author & expert review: Lars Zimmermann · ISO/IEC 42001 Senior Lead Auditor & Senior Lead Implementer · ISO 9001 Senior Lead Auditor · ISO/IEC 27001 Lead Auditor & Lead Implementer (PECB)

An auditor with shop-floor experience and managing director of a manufacturing company, who audits and builds AI management systems and information security. Author of “Stallgeruch” (in German). Verify the credential on Credly · More about me.

Last updated: 01 December 2026. Researched and reviewed to the best of my knowledge. This is my interpretation from practice. For legal advice, please turn to the appropriate professionals.

Questions about your own case?

In a free 15-minute intro call we assess where you stand on ISO 42001, ISO 27001 and the EU AI Act, honestly and without a sales pitch.

Continue reading