diff --git a/server/main.py b/server/main.py index 314088e..3ce6e1e 100644 --- a/server/main.py +++ b/server/main.py @@ -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: