diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index c73ef1d9a..0300f7bec 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -37,7 +37,6 @@ import { getCommandRoots, splitCommands, stripShellWrapper, - detectCommandSubstitution, } from '../utils/shell-utils.js'; import { createDebugLogger } from '../utils/debugLogger.js'; import { @@ -92,18 +91,12 @@ export class ShellToolInvocation extends BaseToolInvocation< /** * AST-based permission check for the shell command. - * - Command substitution → 'deny' (security) * - Read-only commands (via AST analysis) → 'allow' * - All other commands → 'ask' */ override async getDefaultPermission(): Promise { const command = stripShellWrapper(this.params.command); - // Security: command substitution ($(), ``, <(), >()) → deny - if (detectCommandSubstitution(command)) { - return 'deny'; - } - // AST-based read-only detection try { const isReadOnly = await isShellCommandReadOnlyAST(command); @@ -598,18 +591,10 @@ ${processGroupNote} } function getCommandDescription(): string { - const cmd_substitution_warning = - '\n*** WARNING: Command substitution using $(), `` ` ``, <(), or >() is not allowed for security reasons.'; if (os.platform() === 'win32') { - return ( - 'Exact command to execute as `cmd.exe /c `' + - cmd_substitution_warning - ); + return 'Exact command to execute as `cmd.exe /c `'; } else { - return ( - 'Exact bash command to execute as `bash -c `' + - cmd_substitution_warning - ); + return 'Exact bash command to execute as `bash -c `'; } } @@ -662,9 +647,9 @@ export class ShellTool extends BaseDeclarativeTool< protected override validateToolParamValues( params: ShellToolParams, ): string | null { - // NOTE: Permission checks (command substitution, read-only detection, PM rules) - // are now handled at L3 (getDefaultPermission) and L4 (PM override) in - // coreToolScheduler. This method only performs pure parameter validation. + // NOTE: Permission checks (read-only detection, PM rules) are handled at + // L3 (getDefaultPermission) and L4 (PM override) in coreToolScheduler. + // This method only performs pure parameter validation. if (!params.command.trim()) { return 'Command cannot be empty.'; }