Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

AI Coding Agent Permissions: What It Can Read & Change

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

AI coding agents (like GitHub Copilot, Cursor, or Codeium) can read and modify your project files, run commands, and sometimes access your entire file system. Knowing exactly what an agent can see and change is essential for protecting sensitive data (like API keys or .env files) and preventing accidental overwrites. This guide shows you how to inspect the permissions, scopes, and configuration of any AI coding agent you use, so you can lock down access to only what the agent needs.

What You'll Need

  • Access to the AI coding agent's settings or configuration file (usually found in your project root or user home directory).
  • Basic familiarity with your project's file structure and the command line.
  • Optional: a test file or a dummy repository to safely test what the agent can modify.

Step-by-Step

  1. Identify the agent and its configuration file. Most agents use a config file like .cursorrules, .github/copilot-instructions.md, .codeium/config.json, or a general ai-agent.json. Look in your project root and in your home directory (e.g., ~/.config/). If you're unsure, check the agent's documentation for the exact file name.
  2. Open the configuration file. Use a text editor to view the contents. Look for sections like permissions, allow, deny, include, exclude, readOnly, or write. These define what the agent is allowed to do.
  3. Check the default file access scope. Most agents default to reading the entire workspace (the folder you opened). Some also read your home directory or environment variables. Look for a setting like workspace vs global or filesystem. If you see filesystem: true, the agent can read any file on your computer—that's a red flag.
  4. Review the list of allowed or blocked files. Look for patterns like **/*.env, **/node_modules/**, or **/secrets/**. These tell you which files are explicitly allowed or blocked. If you don't see any deny rules, the agent can likely access everything in the workspace.
  5. Check the command execution permissions. Agents often can run terminal commands. Look for a commands or shell section. If it says allowAll or lists specific commands like npm test, note that. If it's not specified, assume the agent can run any command it wants.
  6. Test with a dummy file. Create a file named test-secret.txt in your project with a fake API key. Ask the agent to read it. If it can, the agent has read access to that file. Then ask it to modify the file. If it changes, it has write access. This confirms what the config allows.
  7. Use the agent's UI or CLI to inspect permissions. Many agents have a command like /permissions (in Cursor) or a settings panel (in VS Code extensions) that shows exactly what the agent can access. Run that command or open the panel to see a summary.
  8. Check the agent's logs. If the agent logs its actions (often in a .agent folder or in the output panel), review the logs to see what files it has actually read or modified. This shows real-world behavior, not just configuration.

Common Mistakes

  • Assuming the default is safe. Many agents default to reading everything in the workspace, including .env files and node_modules. Always check the config.
  • Only checking the project config. Some agents have a global config in your home directory that applies to all projects. If you only look at the project config, you might miss that the agent can read your entire home folder.
  • Ignoring symlinks. If your project contains symlinks to outside directories, the agent might follow them and read files outside the workspace. Test for this.
  • Forgetting that the agent can run commands. Even if file access is restricted, the agent can run cat /etc/passwd or curl to exfiltrate data. Check command permissions separately.
  • Not re-checking after updates. Agent updates can reset or change default permissions. Re-check after every update.

Tips

  • Use a dedicated folder for sensitive files (like secrets/) and add a deny rule for it.
  • Set the agent to readOnly mode when you're just asking questions or reviewing code, not when you want it to write code.
  • Use environment variables for secrets instead of hardcoding them in files, so the agent doesn't need to read them.
  • If your agent supports it, use a sandbox or container to run the agent in an isolated environment.
  • Review the agent's permissions before you paste a large codebase or proprietary code into it—some agents send code to remote servers.

Troubleshooting

  • I can't find the config file. Search your home directory for files with names like .cursorrules, .codeium, or settings.json. Also check the agent's documentation for the exact location.
  • The agent ignores my deny rules. Some agents have a hierarchy where global config overrides project config. Try setting the deny rule in both places. Also check if the deny rule uses glob patterns correctly (e.g., **/.env not .env).
  • The agent still reads files I blocked. This could be because the agent caches file access or the block list is not applied to certain operations (like search). Restart the agent and try again. If it persists, report it as a bug.
  • I can't tell if the agent changed a file. Use a version control system like Git. Run git status before and after asking the agent to make a change. If you see unexpected modifications, you know the agent did it.
  • The agent asks for permission but the prompt is unclear. Most agents show a diff or ask for confirmation before writing. If you're unsure, deny the action and manually review the proposed changes.

Frequently Asked Questions

Can an AI coding agent read files outside my project folder?

It depends on the agent's configuration. Some agents are restricted to the workspace, but others can read your entire home directory or even the whole file system. Check the config for filesystem or global permissions.

Does the agent send my code to a remote server?

Most cloud-based agents send parts of your code to their servers for processing. Check the agent's privacy policy. Some agents offer local-only mode, but that's rare. If you're concerned, use a local model or block network access.

How do I make the agent read-only?

Look for a readOnly or readonly option in the config file, or use the agent's UI toggle. In Cursor, you can set the model to "Read-only" in the settings. In VS Code extensions, check the extension settings for a similar option.

What are the most common sensitive files I should protect?

At minimum, protect .env, *.pem, *.key, credentials.json, id_rsa, and any file containing passwords or API keys. Also consider protecting package-lock.json or yarn.lock if you don't want the agent to modify dependencies.

Can I see a log of what the agent has accessed?

Some agents log their actions to a file or an output panel. Check the agent's documentation for logging. If there's no log, you can use a file system monitoring tool like inotifywait (Linux) or fs_usage (macOS) to see real-time file access.

Do I need to worry about the agent modifying files without my consent?

Most agents ask for confirmation before making changes, but not always. To be safe, always review the diff before accepting a change. You can also set the agent to "suggest" mode instead of "auto-apply" mode.