What Permissions Should AI Coding Agents Have for Files, Shell, Git, and Cloud?

AI coding agents should hold the minimum coding agent permissions each task needs across files, shell, Git, and cloud, granted per tool call and expired when the task ends. The thesis: least privilege for autonomous development tools is not a static role grant, it is a per-task, per-tool-call boundary that tightens or expires as the agent moves through the execution path. For engineering managers, that means enforcing scope at each action, not only at session start.

Last updated: July 2026.

A modern coding assistant does more than autocomplete. It reads your repository, edits files, runs shell commands, opens Git branches, invokes tools through the Model Context Protocol (MCP), and reaches cloud APIs with whatever credentials sit in the environment. Each capability can leak source code, expose secrets, or push unreviewed changes toward production. This guide maps the capabilities an AI coding agent uses to the permission boundaries an engineering manager should set, and shows where enforcement has to live to hold under autonomous behavior.

Why Do Static Role Grants Fail for Autonomous Coding Agents?

Static grants create standing authority that outlives the task, so a coding agent reaches files, commands, and credentials the current work never required. A role grant answers one question at login: what is this identity allowed to do? A static developer role assumes a human chooses when to use each permission. A coding agent turns that standing authority into executable reach across files, commands, tools, and APIs. It makes many tool calls during a task, and its next call depends on model output you cannot predict. Grant it read access to a repository and it may read every secret checked into that repo. Grant it unrestricted shell access to run tests and it can invoke commands that read environment variables, install packages, or send data to an approved endpoint.

Formal policy for AI-generated code remains rare in many organizations, which opens a gap between how widely developers use AI coding tools and how tightly those tools are governed. OWASP ranks Excessive Agency among the top risks for AI applications, assigning it the code LLM06 in the OWASP Top 10 for LLM Applications, and names overly broad tool permissions as a primary driver [OWASP, 2025]. Gartner predicts that over 40% of agentic AI projects will be canceled by the end of 2027 due to escalating costs, unclear business value, or inadequate risk controls [Gartner, 2025], and weak permission controls drive that risk.

The fix moves the decision from login time to action time. Define scope per task and evaluate it per tool call, so authority reflects what the agent is doing right now, not what its identity could theoretically do. A written developer AI policy that specifies this per-task model turns the principle into an enforceable standard.

How Should Teams Scope File, Shell, Git, and Cloud Permissions?

Least privilege for AI coding agents means granting the narrowest file, shell, Git, and cloud capability a specific task requires, evaluated at each tool call, and revoked when the task completes. A refactor of one module does not need write access to the whole tree. A test run does not need cloud deploy credentials. A documentation pass does not need shell access at all.

Decompose the work, not the identity. For each task type, write down the intended capabilities and the boundary for each. Here is a sequence engineering managers can apply.

  1. Enumerate the tool classes the agent can invoke: file read, file write, shell, Git operations, package install, MCP tool calls, and cloud API calls.
  2. Map each task type (bug fix, refactor, test, dependency update, deploy) to the minimum tool classes it truly needs.
  3. Set a path and command allowlist so file writes and shell commands stay inside the task boundary.
  4. Require explicit human approval for high-blast-radius actions: pushing to a protected branch, altering CI/CD config, or touching cloud credentials.
  5. Expire the grant when the task ends, and evaluate every tool call against the current task boundary while the task runs.
Agent capability Primary risk Recommended control
File read Secrets, source code, or credential files read into model context Path allowlist; real-time data classification; block or redact on sensitive content
File write Unreviewed code changes or config overwrites Scope to task directory; require code review before merge
Shell Arbitrary command execution, environment variable access, data exfiltration Command allowlist; block destructive commands; approve at human-in-the-loop threshold
Git operations Push to protected branches; history rewrite; credential exposure in commits Block push to protected branches without approval; scan commits for secrets
Package install Malicious dependency; supply chain compromise Require human approval; use a private registry mirror with vetted packages
MCP tool calls Tool poisoning; unauthorized data access via external server Allowlist approved MCP servers; sign approved calls; block unsigned ones
Cloud API calls Unauthorized resource access, deploy, or IAM changes Short-lived task-scoped credentials; approve deploy and IAM actions at human-in-the-loop threshold
CI/CD pipeline access Broad deploy credentials inherited; pipeline config tampering Job-scoped credentials; approval required for config edits and environment promotion

Sandbox Isolation and Concrete Constraints

Sandboxing constrains what the agent can reach and gives you a solid containment layer. Cover four dimensions: file-system path scope, process restrictions, package install limits, and network egress rules.

File-system scope: restrict read and write to the directories the task needs. A bug-fix agent working in src/auth/ should not have a path allowance that covers the whole repository, and certainly not the home directory where credential caches live.

Process restrictions: allowlist the commands the agent may run. A test runner needs the test framework binary and nothing else. Block process spawning outside the allowlist, including interpreters, archive utilities, and network tools.

Package install limits: require approval before the agent installs a dependency. Treat unapproved package installation as a software supply chain control point. A malicious package executes during install, reads local secrets, or opens outbound connections before code review catches it.

Network egress rules: limit outbound calls to approved destinations: the designated model endpoint, the relevant package registry, permitted MCP servers, and the specific cloud API the task requires. Block calls to arbitrary endpoints, even ones the model suggests as helpful.

A sandbox is necessary but not sufficient. A permitted endpoint can still receive an out-of-scope action, so pair sandboxing with authorization at the tool call itself. The control evaluates the tool call before execution, then applies allow, coach, warn, block, or redact based on task scope and data context.

Secrets, Source Code, and Credential Exposure in Agent Workspaces

The agent workspace is where source code leakage and secrets exposure happen. Protect these sources: .env files, SSH keys, package registry tokens (npm, PyPI, private registries), cloud credential profiles (~/.aws/credentials, ~/.config/gcloud), CI/CD environment variables, GitHub personal access tokens and deploy keys, and credential caches written by CLI tools. When the agent reads any of these to gather context, then transmits that context to a model endpoint or an MCP server, proprietary code and secrets leave with it.

OWASP ranks Sensitive Information Disclosure alongside Prompt Injection and Excessive Agency among the top risks for AI applications in the OWASP Top 10 for LLM Applications, using the codes LLM02, LLM01, and LLM06 respectively (OWASP, 2025). The World Economic Forum notes that organizations assessing AI tool security before deployment nearly doubled from 37% to 64% between 2024 and 2026, yet assessment alone does not govern runtime behavior [World Economic Forum, 2026]. Two controls cut workspace exposure. First, keep secrets out of the workspace the agent can read, using short-lived credentials scoped to the task. Second, classify and act on data at the moment the agent tries to read or transmit it.

Aurascape classifies data in real time with 600+ real-time data classifiers (Aurascape, 2026) at the interaction layer. Context-aware policy actions (allow, coach, warn, block, redact) apply the moment an agent attempts to read or transmit sensitive content. A policy redacts a secret from an outbound prompt or blocks a source-code transmission before it leaves the interaction, not after a network log records that it already did. For the common paths code and secrets take out of the workspace, see our note on AI coding assistant data leakage.

Human-in-the-Loop Approval, Subagent Decomposition, and Mid-Session Escalation

Not every action deserves the same friction. Clear thresholds let developers move fast on low-risk work while keeping high-blast-radius actions gated. Require explicit human approval for each of the following:

  • Pushing a commit to a protected branch
  • Editing a CI/CD pipeline configuration file
  • Running a destructive shell command (delete, overwrite, truncate)
  • Installing a new package dependency
  • Adding or connecting a new MCP server
  • Invoking a cloud action (deploy, provision, IAM policy change)

Watch for mid-session privilege escalation. An agent begins a bug fix and, several tool calls later, attempts a scope expansion the original task never justified: reaching a new repository, installing an unexpected package, or calling a cloud API outside the task boundary. Per-tool-call evaluation catches that drift because each call is checked against the current task scope, not the session’s opening grant.

Subagent decomposition shrinks the authority any single probabilistic component carries. Split authority across at least four roles: a reader agent (file read, no write, no shell), a patch writer (file write scoped to the target module, no shell, no Git push), a test runner (shell restricted to the test command, no file write outside the test output path), and a deploy requester (raises a deploy request for human approval, holds no deploy credentials itself). No single agent holds the full chain from reading source to executing a deploy. The Cloud Security Alliance reports that 82% of organizations have unknown AI agents operating in their environments and 65% have already experienced agent-related incidents [Cloud Security Alliance, 2026], which shows why decomposed authority and clear approval gates matter before scope expands mid-session.

MCP Server Trust, CI/CD Access, and Pipeline Credential Scope

MCP servers extend an agent’s reach, and they open a permission attack surface. A tool-poisoning attack hides malicious instructions in a tool description or result, steering the agent into actions the developer never intended. Many MCP services reachable on the internet operate without authentication, since the protocol does not require it by default [Censys, 2026]. Which servers an agent may call, and which tool calls it may make once connected, are explicit policy decisions, not defaults to accept.

CI/CD access is the top high-blast-radius case. Enforce this full set of pipeline controls:

  • Scope pipeline credentials to the specific job, not the whole pipeline
  • Require approval for any edit to pipeline configuration files
  • Restrict package publish rights to a designated publishing agent, not the general coding agent
  • Require a human-approved deploy request before any environment promotion (staging to production)
  • Keep standing deploy credentials out of general-purpose coding-agent sessions entirely

Aurascape discovers coding agents and unsanctioned AI accounts across network, endpoint, and API planes before a manager defines scope, so the inventory reflects observed reality rather than a manually maintained list [Aurascape, 2026]. The Zero-Bypass MCP Gateway (Aurascape, 2026) cryptographically signs approved tool calls and blocks unsigned ones, governing the agent-to-tool execution path inline rather than observing it after the fact. MCP is one common tool-execution pattern, not the whole agent access-control problem, so the Gateway pairs with discovery and policy across the agent’s other capabilities. Aurascape creates interaction records for audit and effectiveness, governed by role-based access control (RBAC) for privacy, giving engineering managers a per-tool-call record rather than a network-flow summary. For IDE-layer prompt injection risk, see prompt injection in IDE coding assistants.

Enforcement Layers: Side-by-Side Comparison

These layers are not mutually exclusive. Session-start configuration and prompt-level instructions have a place. The distinction is where enforcement holds when the agent behaves unpredictably. This side-by-side comparison puts the tool call at the decision point.

Capability Session-start and environment boundary controls Aurascape
Where enforcement runs Session start and environment boundary Inline at each tool call
Unauthorized tool call handling May depend on environment limits, prompt instructions, or post-action review unless tool-call authorization is enforced inline Unsigned calls blocked before execution within governed workflows
Data policy on secrets and code Network egress filtering at the boundary 600+ real-time data classifiers with allow, coach, warn, block, redact at the interaction layer
Agent inventory Manually declared or discovered later through logs, tickets, or configuration review Proactive discovery of coding agents and shadow AI accounts
Audit granularity Network or process flow summary Per-tool-call interaction record, governed by RBAC

Our AI coding assistant security comparison extends this analysis across tools. For Gemini CLI’s specific file and shell access patterns, see Gemini CLI local files, shell commands, and cloud credentials. Gartner also notes that at least 80% of unauthorized AI transactions will be caused by internal policy violations rather than malicious attacks, which reinforces why per-tool-call policy evaluation matters more than perimeter controls alone.

Frequently Asked Questions

What permissions should an AI coding agent have by default?

The minimum the current task needs, and nothing standing. Default to read access scoped to the relevant paths, no shell, no Git write to protected branches, and no cloud credentials unless the task is a deploy. Add capabilities per task and expire them when the task ends.

Why is a static role grant not enough for coding agents?

Because it grants authority for the whole session, not the task. An agent makes many unpredictable tool calls and cannot distinguish the action you wanted from one the model improvised. Per-tool-call evaluation checks each action against the current task scope instead.

How do I stop an agent from leaking secrets or source code?

Keep secrets out of the workspace with short-lived, task-scoped credentials and restrict path access to the files the task needs. Classify data at the moment the agent reads or transmits it so a policy can redact or block a sensitive transmission before it leaves the interaction.

Is sandbox isolation enough to control a coding agent?

No. Sandboxing constrains reach but can be misconfigured, and an approved destination can still receive an action outside the task scope. Pair the sandbox with authorization at the tool call so control persists even when boundaries are weak.

When should an agent require human approval?

Require approval where blast radius is high: pushing to a protected branch, editing CI/CD configuration, running a destructive shell command, installing a new package, adding an MCP server, or invoking a cloud action. Keep low-risk, in-scope actions frictionless so developers are not slowed on routine work.

Should coding agents have access to CI/CD credentials?

No, not as standing access. Pipeline credentials should be scoped to the specific job and issued only when a human approves a deploy request. A general-purpose coding agent should raise a deploy request and hand off to a deploy requester role; it should never hold credentials that can push to production directly.

How risky are MCP servers for coding agents?

MCP servers open a meaningful permission attack surface. Tool poisoning hides malicious instructions in a tool description or result, and many internet-accessible MCP services operate without authentication (Censys, 2026). Allowlist approved MCP servers and enforce signed tool calls so only vetted servers and approved calls execute.

Can the model police its own permissions?

No. Model self-policing is probabilistic. The model follows an instruction to avoid an action most of the time, but not always. A deterministic control at the tool call, one that signs approved calls and blocks unsigned ones in governed workflows, does not depend on the model choosing to comply.


Aurascape lets engineering managers enforce coding agent permissions as a per-task, per-tool-call boundary: discovering coding agents and AI accounts across the environment, signing approved tool calls and blocking unsigned ones in governed workflows, classifying sensitive data in real time with 600+ classifiers, and creating interaction records for audit and effectiveness, governed by RBAC for privacy. See how Aurascape governs coding agent permissions across files, shell, Git, and cloud.

See how Aurascape secures AI coding agents →

Aurascape Solutions