From 13c951aa419b7a79cf138e11e3cd87db081347c3 Mon Sep 17 00:00:00 2001 From: axelray-dev <110029405+axelray-dev@users.noreply.github.com> Date: Thu, 25 Jun 2026 18:54:49 +0800 Subject: [PATCH] fix: change exec login-shell default from true to false (#4518) The exec tool defaults login=True for bash/zsh, which causes the shell to source ~/.bash_profile and similar startup files. This reintroduces secrets from shell startup files into the exec environment, even though _build_env() intentionally starts with a curated environment. Change the default to login=False in both _prepare_command() and _spawn(), and update the schema default accordingly. --- nanobot/agent/tools/shell.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.py index 4da7895d..279e2e77 100644 --- a/nanobot/agent/tools/shell.py +++ b/nanobot/agent/tools/shell.py @@ -93,8 +93,8 @@ class _PreparedCommand: nullable=True, ), login=BooleanSchema( - description="Whether to run bash/zsh with login shell semantics (default true).", - default=True, + description="Whether to run bash/zsh with login shell semantics (default false).", + default=False, nullable=True, ), yield_time_ms=IntegerSchema( @@ -432,7 +432,7 @@ class ExecTool(Tool): env=env, timeout=effective_timeout, shell_program=shell_program, - login=True if login is None else login, + login=False if login is None else login, ) def _compose_path(self, current_path: str) -> str: @@ -461,7 +461,7 @@ class ExecTool(Tool): async def _spawn( command: str, cwd: str, env: dict[str, str], shell_program: str | None = None, - login: bool = True, + login: bool = False, *, stdin: int = asyncio.subprocess.DEVNULL, ) -> asyncio.subprocess.Process: