mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Added warning to avoid command substitution in run_shell_command tool… (#9934)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
@@ -266,6 +266,11 @@ export function detectCommandSubstitution(command: string): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
// >(...) process substitution - works unquoted only (not in double quotes)
|
||||
if (char === '>' && nextChar === '(' && !inDoubleQuotes && !inBackticks) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Backtick command substitution - check for opening backtick
|
||||
// (We track the state above, so this catches the start of backtick substitution)
|
||||
if (char === '`' && !inBackticks) {
|
||||
@@ -319,7 +324,7 @@ export function checkCommandPermissions(
|
||||
allAllowed: false,
|
||||
disallowedCommands: [command],
|
||||
blockReason:
|
||||
'Command substitution using $(), <(), or >() is not allowed for security reasons',
|
||||
'Command substitution using $(), `` ` ``, <(), or >() is not allowed for security reasons',
|
||||
isHardDenial: true,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user