Skip to content

Commit 4b479c4

Browse files
authored
Merge pull request microsoft#261514 from microsoft/tyriar/pwsh_verbs
Ensure default auto approved regexed check from start of sub-commands
2 parents 9158d87 + 71d69fd commit 4b479c4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalChatAgentToolsConfiguration.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,22 +135,22 @@ export const terminalChatAgentToolsConfiguration: IStringDictionary<IConfigurati
135135
// While these PowerShell verbs can have side effects, they are generally innocuous (eg.
136136
// updating OS-level file access info) and and often have prompts if they're more
137137
// involved (eg. Get-Credential)
138-
'/Get-[a-z0-9]/i': true,
139-
'/Select-[a-z0-9]/i': true,
140-
'/Measure-[a-z0-9]/i': true,
141-
'/Compare-[a-z0-9]/i': true,
142-
'/Format-[a-z0-9]/i': true,
143-
'/Sort-[a-z0-9]/i': true,
138+
'/^Get-[a-z0-9]/i': true,
139+
'/^Select-[a-z0-9]/i': true,
140+
'/^Measure-[a-z0-9]/i': true,
141+
'/^Compare-[a-z0-9]/i': true,
142+
'/^Format-[a-z0-9]/i': true,
143+
'/^Sort-[a-z0-9]/i': true,
144144
'Write-Host': true,
145145
'Write-Output': true,
146146
'Split-Path': true,
147147
'Join-Path': true,
148148

149149
// Commands that are generally allowed with special cases we block
150150
find: true,
151-
'/find\\b.*-exec(dir)?\\b/': false, // Execute on results
151+
'/^find\\b.*-exec(dir)?\\b/': false, // Execute on results
152152
top: true,
153-
'/top\\b.*-(k|r)\\b/': false, // Kill or renice processes
153+
'/^top\\b.*-(k|r)\\b/': false, // Kill or renice processes
154154

155155
// There are countless dangerous commands available on the command line, the defaults here
156156
// include common ones that the user is likely to want to explicitly approve first. This is

0 commit comments

Comments
 (0)