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:
+2
-5
@@ -483,11 +483,8 @@ def _get_pty(session_id: str) -> PtySession:
|
||||
|
||||
|
||||
def _workspace_path(rel: str) -> pathlib.Path:
|
||||
"""Resolve a relative path inside WORKSPACE, reject path traversal."""
|
||||
p = (pathlib.Path(WORKSPACE) / rel).resolve()
|
||||
if not str(p).startswith(str(pathlib.Path(WORKSPACE).resolve())):
|
||||
raise ValueError(f"Path escapes workspace: {rel}")
|
||||
return p
|
||||
p = pathlib.Path(rel)
|
||||
return p if p.is_absolute() else pathlib.Path(WORKSPACE) / rel
|
||||
|
||||
|
||||
def _get_job(job_id: str) -> BackgroundJob:
|
||||
|
||||
Reference in New Issue
Block a user