1

I'm trying to configure VS Code's chat.tools.terminal.autoApprove setting to automatically approve specific curl commands to localhost when using GitHub Copilot agent mode. However, while simple command name matching works (e.g., "curl": true), my more specific patterns including exact string matches and regex patterns are not working. Here is an example of a command I'd like to be auto approved:

curl -X GET http://localhost:3001/api/state-machine/test-session

What works: Simple command names like "curl": true, What doesn't work: My efforts to restrict the curl command to localhost

I also used a regex tool to check my regex, and it did match the test command.

Using this command for testing:

curl -X GET http://localhost:3001/api/state-machine/test-session

I got these results:

  • switching "curl": false to true worked as expected, so I know these settings are being applied
  • "curl -X GET http://localhost:3001/api/state-machine/test-session": { "approve": true, "matchCommandLine": true }, I expected this to match, but it didn't autoApprove the test command
  • "/^curl.*localhost.*$/i": { "approve": true, matchCommandLine": true }, I expected this to match, but it didn't autoApprove the test command

What am I doing wrong and how do I fix it?

Environment:

  • VS Code version: [latest]
  • GitHub Copilot extension: [latest]
  • Agent mode: Enabled
  • Platform: macOS

Note: I know my regex is overly simplistic and could be hacked. I have the regex to fix that, but wanted to use a simple regex for this question. Please critique my regex for problems that cause it to fail to match, but not issues of it being overly broad

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.