Re-enable backticks in shell tool usage. (#3360)

This commit is contained in:
N. Taylor Mullen 2025-07-07 09:15:10 -07:00 committed by GitHub
parent 48ebd728b3
commit 17dfa267d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 12 deletions

View File

@ -350,17 +350,14 @@ describe('ShellTool', () => {
expect(result.allowed).toBe(true);
});
it('should block a command with command substitution using backticks', async () => {
it('should allow a command with command substitution using backticks', async () => {
const config = {
getCoreTools: () => ['run_shell_command(echo)'],
getExcludeTools: () => [],
} as unknown as Config;
const shellTool = new ShellTool(config);
const result = shellTool.isCommandAllowed('echo `rm -rf /`');
expect(result.allowed).toBe(false);
expect(result.reason).toBe(
'Command substitution using backticks is not allowed for security reasons',
);
expect(result.allowed).toBe(true);
});
it('should block a command with command substitution using $()', async () => {

View File

@ -123,13 +123,6 @@ Process Group PGID: Process group started or \`(none)\``,
'Command substitution using $() is not allowed for security reasons',
};
}
if (command.includes('`')) {
return {
allowed: false,
reason:
'Command substitution using backticks is not allowed for security reasons',
};
}
const SHELL_TOOL_NAMES = [ShellTool.name, ShellTool.Name];