@@ -189,24 +189,24 @@ export class ExecuteBash {
189189 if ( cmdArgs . length === 0 ) {
190190 return { requiresAcceptance : true }
191191 }
192-
192+ let hasOutsideWorkspacePath = false
193193 // For each command, validate arguments for path safety within workspace
194194 for ( const arg of cmdArgs ) {
195195 if ( this . looksLikePath ( arg ) ) {
196- // If not absolute, resolve using workingDirectory if available.
197196 let fullPath = arg
198197 if ( ! path . isAbsolute ( arg ) && this . workingDirectory ) {
199198 fullPath = path . join ( this . workingDirectory , arg )
200199 }
201200 const workspaceFolders = vscode . workspace . workspaceFolders
202201 if ( ! workspaceFolders || workspaceFolders . length === 0 ) {
203- return { requiresAcceptance : true }
202+ hasOutsideWorkspacePath = true
203+ continue
204204 }
205205 const isInWorkspace = workspaceFolders . some ( ( folder ) =>
206206 isInDirectory ( folder . uri . fsPath , fullPath )
207207 )
208208 if ( ! isInWorkspace ) {
209- return { requiresAcceptance : true }
209+ hasOutsideWorkspacePath = true
210210 }
211211 }
212212 }
@@ -216,10 +216,19 @@ export class ExecuteBash {
216216
217217 switch ( category ) {
218218 case CommandCategory . Destructive :
219- return { requiresAcceptance : true , warning : destructiveCommandWarningMessage }
219+ return {
220+ requiresAcceptance : true ,
221+ warning : destructiveCommandWarningMessage ,
222+ }
220223 case CommandCategory . Mutate :
221- return { requiresAcceptance : true , warning : mutateCommandWarningMessage }
224+ return {
225+ requiresAcceptance : true ,
226+ warning : mutateCommandWarningMessage ,
227+ }
222228 case CommandCategory . ReadOnly :
229+ if ( hasOutsideWorkspacePath ) {
230+ return { requiresAcceptance : true }
231+ }
223232 continue
224233 default :
225234 return { requiresAcceptance : true }
0 commit comments