Skip to content

Conversation

@Tyriar
Copy link
Member

@Tyriar Tyriar commented Dec 11, 2025

Fixes #282824

@Tyriar Tyriar added this to the December / January 2026 milestone Dec 11, 2025
@Tyriar Tyriar self-assigned this Dec 11, 2025
Copilot AI review requested due to automatic review settings December 11, 2025 18:51
@Tyriar Tyriar marked this pull request as draft December 11, 2025 18:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds auto-approval support for ripgrep (rg) commands in the terminal chat agent tools, addressing issue #282824. The change allows most rg commands to be automatically approved while blocking potentially dangerous flags that could execute arbitrary code.

Key Changes

  • Auto-approves rg (ripgrep) commands by default
  • Blocks rg commands using --pre (preprocessor execution) or --hostname-bin (hostname command execution) flags
  • Follows the existing pattern of "safe command with dangerous argument exceptions" used by other commands like find, date, sort, and tree

Comment on lines +263 to +267
// rg (ripgrep)
// - `--pre`: Executes arbitrary command as preprocessor for every file searched.
// - `--hostname-bin`: Executes arbitrary command to get hostname.
rg: true,
'/^rg\\b.*(--pre|--hostname-bin)\\b/': false,
Copy link

Copilot AI Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding test cases for the new rg auto-approval rules to match the pattern used for other commands. The test suite should include:

  1. Auto-approved case: 'rg pattern file.txt' in the autoApprovedTestCases array
  2. Confirmation required cases in the confirmationRequiredTestCases array:
    • 'rg --pre cat pattern'
    • 'rg --hostname-bin hostname pattern'

This would ensure the new rules are properly tested alongside the existing command patterns like find, sort, and tree.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal tool: Auto approve safe rg by default

2 participants