mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-18 05:50:30 -07:00
fix(core): prevent SIGHUP kills in PTY environments (WSL2/Kitty/Alacritty) (#27267)
This commit is contained in:
@@ -56,7 +56,11 @@ export async function getCommandName(req: SandboxRequest): Promise<string> {
|
||||
const roots = getCommandRoots(stripped).filter(
|
||||
(r) => r !== 'shopt' && r !== 'set',
|
||||
);
|
||||
if (roots.length > 0) {
|
||||
// Single-root enforcement: only grant named-command permissions when the
|
||||
// command is unambiguous. Multi-root chains fall back to basename so that
|
||||
// a chained command like `git; malicious_cmd` never inherits `git`'s
|
||||
// sandbox policy for the entire chain.
|
||||
if (roots.length === 1) {
|
||||
return roots[0];
|
||||
}
|
||||
return path.basename(req.command);
|
||||
|
||||
Reference in New Issue
Block a user