{"record":{"id":"61592cc6fe293a1f","repo":"abhigyanpatwari/GitNexus","slug":"sandbox-copy-target-cannot-traverse-a-symlink-pa","errorCode":null,"errorMessage":"sandbox_copy target cannot traverse a symlink: {parent}","messagePattern":"sandbox_copy target cannot traverse a symlink: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"critical","filePath":"eval/workflow_bench/task_assets.py","lineNumber":733,"sourceCode":"                raise SandboxError(f\"sandbox_copy target parent has an unsupported type: {relative}\")\n            next_descriptor = os.open(part, flags, dir_fd=current)\n            os.close(current)\n            current = next_descriptor\n    finally:\n        os.close(current)\n\n\ndef _open_publish_parent(clone: Path, parent: PurePosixPath) -> int:\n    flags = os.O_RDONLY | os.O_DIRECTORY | getattr(os, \"O_CLOEXEC\", 0) | getattr(os, \"O_NOFOLLOW\", 0)\n    current = os.open(clone, flags)\n    try:\n        for part in parent.parts:\n            try:\n                mode = os.stat(part, dir_fd=current, follow_symlinks=False).st_mode\n            except FileNotFoundError:\n                mode = None\n            if mode is not None and stat.S_ISLNK(mode):\n                raise SandboxError(f\"sandbox_copy target cannot traverse a symlink: {parent}\")\n            if mode is not None and not stat.S_ISDIR(mode):\n                if not stat.S_ISREG(mode):\n                    raise SandboxError(f\"sandbox_copy target parent has an unsupported type: {parent}\")\n                os.unlink(part, dir_fd=current)\n                mode = None\n            if mode is None:\n                os.mkdir(part, mode=0o700, dir_fd=current)\n            next_descriptor = os.open(part, flags, dir_fd=current)\n            os.close(current)\n            current = next_descriptor\n        return current\n    except BaseException:\n        os.close(current)\n        raise\n\n\ndef _open_existing_parent(root: Path, parent: PurePosixPath) -> int:\n    flags = os.O_RDONLY | os.O_DIRECTORY | getattr(os, \"O_CLOEXEC\", 0) | getattr(os, \"O_NOFOLLOW\", 0)","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/task_assets.py#L715-L751","documentation":"_open_publish_parent creates or opens each parent component of the publish destination and refuses to cross a symlink. Unlike the read-only _preflight_exact_root, this is the creation path — it must not follow a symlink when opening the directory that will receive the atomic rename.","triggerScenarios":"A symlink appears at an intermediate parent component in the clone during the publish phase (between preflight and publish, or on a path preflight did not cover); a concurrent mutator planted it.","commonSituations":"Concurrent mutator sharing the clone; a clone shared with another process between preflight and publish.","solutions":["Quiesce concurrent writers during the entire materialize call","Remove the symlink at the reported parent path","Use a private clone per run so no cross-process mutation can occur"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from eval.workflow_bench.proposer_sandbox import SandboxError\n\ntry:\n    snapshot.materialize(clone)\nexcept SandboxError as exc:\n    if \"cannot traverse a symlink\" in str(exc):\n        raise SystemExit(f\"symlink appeared on a parent path during publish; isolate the clone: {exc}\") from exc\n    raise","preventionTips":["Do not share the clone with concurrent mutators during materialize","Use a private clone per run","Run preflight-style symlink checks immediately before materialize"],"tags":["sandbox","sandbox-copy","symlinks","toctou"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}