remove path traversal restriction from file tools

Container isolation is sufficient — agents can access the full
filesystem. Absolute paths are passed through as-is.
This commit is contained in:
Sidney Marvin Fricke
2026-06-24 12:37:36 +02:00
parent f7af92a10e
commit c9ca78d9f1
+2 -5
View File
@@ -483,11 +483,8 @@ def _get_pty(session_id: str) -> PtySession:
def _workspace_path(rel: str) -> pathlib.Path: def _workspace_path(rel: str) -> pathlib.Path:
"""Resolve a relative path inside WORKSPACE, reject path traversal.""" p = pathlib.Path(rel)
p = (pathlib.Path(WORKSPACE) / rel).resolve() return p if p.is_absolute() else pathlib.Path(WORKSPACE) / rel
if not str(p).startswith(str(pathlib.Path(WORKSPACE).resolve())):
raise ValueError(f"Path escapes workspace: {rel}")
return p
def _get_job(job_id: str) -> BackgroundJob: def _get_job(job_id: str) -> BackgroundJob: