Skip to content

Block auto-approved file writes with literal tilde - #316311

Merged
Megan Rogge (meganrogge) merged 1 commit into
mainfrom
merogge/block-tilde-file-writes
May 13, 2026
Merged

Megan Rogge (meganrogge) merged 1 commit into
mainfrom
merogge/block-tilde-file-writes

Conversation

@meganrogge

Copy link
Copy Markdown
Collaborator

Add ~ to the variable/sub-command detection regex in commandLineFileWriteAnalyzer so paths like ~/foo that the shell will expand are not auto-approved based on a static path that does not match what bash will open.

Add ~ to the variable/sub-command detection regex in commandLineFileWriteAnalyzer so paths like ~/foo that the shell will expand are not auto-approved based on a static path that does not match what bash will open.
Copilot AI review requested due to automatic review settings May 13, 2026 20:53
@meganrogge Megan Rogge (meganrogge) added this to the 1.121.0 milestone May 13, 2026
@meganrogge
Megan Rogge (meganrogge) enabled auto-merge (squash) May 13, 2026 20:53
auto-merge was automatically disabled May 13, 2026 20:56

Pull request was closed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 tightens terminal command auto-approval safety by treating ~ as a potentially dynamic path element (tilde expansion) when analyzing detected file write destinations, preventing auto-approval based on a path that may differ from what the shell actually opens.

Changes:

  • Extend the “variable/sub-command” detection regex to also flag ~ in detected file write paths.
  • Update the associated analyzer log message to mention tilde expansion.
Show a summary per file
File Description
src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.ts Blocks auto-approval for file writes whose resolved fsPath contains ~, to mitigate tilde-expansion mismatches.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

@meganrogge
Megan Rogge (meganrogge) merged commit d3c0126 into main May 13, 2026
36 of 51 checks passed
@meganrogge
Megan Rogge (meganrogge) deleted the merogge/block-tilde-file-writes branch May 13, 2026 22:27
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Jun 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants