Allowlist should not extend to redirects

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When you add a command to the allowlist, Cursor apparently extends that authorization to file redirects.

Case in point, the following horror story:
Step 1: I added “grep” and “echo” to the Allowlist, just so that Cursor could search through files more quickly
Step 2: Cursor started damaging my .zshrc with echo >> .zshrc to workaround a problem it had encountered.

Steps to Reproduce

  1. Add echo to the Allowlist
  2. Ask about something that could be fixed by adding something to a configuration file
  3. Watch Cursor add that using echo >> config-file without asking to edit the file

In my case, Cursor seems to have done this multiple times, starting with adding GDK_BACKEND=x11 to address a warning that Emacs shows when running the GDK build over ssh / X11. It’s a good thing I keep these configuration files under version control.

Expected Behavior

When adding a command to the Allowlist, that should not extend to a command that has a file redirection. More precisely, doing so should be seen as an edit of the file and ask for confirmation that you want to edit the file.

Screenshots / Screen Recordings

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.7.54 (Universal)
VSCode Version: 1.99.3
Commit: 5c17eb2968a37f66bc6662f48d6356a100b67be0
Date: 2025-10-21T19:07:38.476Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 25.0.0

For AI issues: which model did you use?

Auto with claude-4.5-sonnet, gpt-5 and claude-4.5-haiku enabled

Additional Information

It does not look like an AI issue to me, more like the AI is smart enough to find alternative ways to edit files.

Does this stop you from using Cursor

No - Cursor works, but with this issue

1 Like

I wonder if the problem also potentially exists with something like echo $(rm -f /path) or similar. I’ve not observed it.

To echo this (pun :frowning:). I had to remove a different shell comment as the agent was using it to apply patches via the shell instead of using the in-IDE edit tools. I wish I could remember which one, but it was a fairly standard shell comment that it was using to forward patches to the file…maybe a git command? Sorry I can not recall.

Any comment from the developers on that problem? Is there a simple workaround (other than banning Allowlists from your workflow?)

Hey, thanks for the report. This is a clear security issue, allowlisted commands shouldn’t bypass file edit confirmation via redirects.

I’ll pass this to the team. The expected behavior you described (treating echo >> file as a file edit requiring confirmation) makes sense as a safety guardrail.

As a temporary workaround, you can:

  • Remove echo from the allowlist (temporarily keep only read‑only commands like grep)
  • Keep config files under version control (as you’re already doing)

We’ll track this for a fix. Thanks for catching it.

1 Like

@deanrie I think it was cat that was used to do this as well. I’ll re-add it to my settings and see if it happens again. I can’t think off the top of my head how this command would be used to make a patch to apply, but there is no other reason I would have taken it away as it is really nice allowing the agent to use cat.

1 Like

Not to be pedantic, but I’m pretty sure that echo is a read-only command, as far as the file system is concerned. Moreover, I can probably get grep to do anything that I could get echo to do (e.g., grep ‘.*’ <<< “Look at me echo!”). :person_shrugging:

So, I think the problem is the redirection, not the source command.

Perhaps adding some “guidance” to the prompt (like what files/directories may or may not be modified) would help?

2 Likes

Thanks @deanrie for passing that to the team. Indeed, I agree with @webbnh that the problem is specifically the redirection and not the command. If the agent is capable of doing this with echo, I see no reason it would not us any other command that has any other output to achieve the same goal. Here are a few examples I can think of:

  1. If env is allowlisted, setting environment variables to what you want then run env >>
  2. If grep is allowlisted, find a file that has the desired content and run grep >>
  3. If cat is allowlisted, cat <<EOF and a redirect and you are in business

And so on…

1 Like

Another couple of things that comes to mind regarding allowlists:

  1. Can the allowlist button recognize by default commands that have subcommands, and allowlist only the specific subcommand when you click on the button? For example, I manually added tmux capture-pane to the allowlist, but not tmux send-key. By default, if I click on the allowlist button, it allows all of tmux. Same obvious problem with git, where git diff might be OK but git commit is not. So if the agent suggests git log and I click on allowlist, I would like the allow list to contain git log and not git.
  2. Same problem with options. I might be OK with sed without allowing sed -i to take a simple example. sed treats files as input, sed -i edits the files in place, so they have remarkably different filesystem semantics.
  3. Maybe add another list of “dangerous patterns” that automatically disable the effect of allowlist when specific patterns are on the command-line. Not sure how to make that easy to use, but disabling the allowlist on things that write into /proc or /etc might be sensible…
1 Like

Another funny case to consider is find which you might want to allow, but where you want to disable the -exec option :slight_smile:

Had to reply for a strong +1 on this.

It is both a nice behavior and protection for those who may not know fully what they are allowing.

Currently I have to open settings to manually add subcommands each time. I really never accept a main command when there are subcommands.

1 Like