fix(exec): resolve relative working_dir from workspace
This commit is contained in:
1 parent
3548aec576
commit
7aaff4f66b
3 files changed
+62
-2
No files matched your search
@@ -411,8 +411,15 @@ class ExecTool(Tool):
|
||||
sandbox_restricts_workspace=bool(self.sandbox),
|
||||
)
|
||||
workspace_root = str(access.project_path) if access.project_path is not None else self.working_dir
|
||||
cwd = working_dir or workspace_root or os.getcwd()
|
||||
|
||||
if working_dir:
|
||||
requested_dir = Path(working_dir).expanduser()
|
||||
cwd = str(
|
||||
requested_dir
|
||||
if requested_dir.is_absolute()
|
||||
else Path(workspace_root or os.getcwd()) / requested_dir
|
||||
)
|
||||
else:
|
||||
cwd = workspace_root or os.getcwd()
|
||||
# Prevent an LLM-supplied working_dir from escaping the configured
|
||||
# workspace when restrict_to_workspace is enabled (#2826). Without
|
||||
# this, a caller can pass working_dir="/etc" and then all absolute
|
||||
|
||||
Reference in new issue
Block a user