{"record":{"id":"714185de2ff4d54f","repo":"abhigyanpatwari/GitNexus","slug":"oracle-sanitization-requires-a-real-self-contained","errorCode":null,"errorMessage":"oracle sanitization requires a real self-contained clone: {root}","messagePattern":"oracle sanitization requires a real self-contained clone: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":266,"sourceCode":"    commit from the clone's existing index after removing the complete harness,\n    discard every other reference/reflog, and prune unreachable objects before\n    any task asset, setup command, or model session is allowed to run.\n    \"\"\"\n\n    root = clone.expanduser().absolute()\n    try:\n        root_metadata = root.lstat()\n        git_metadata = (root / \".git\").lstat()\n    except OSError as exc:\n        raise ValueError(f\"oracle sanitization requires a self-contained clone: {root}\") from exc\n    if (\n        stat.S_ISLNK(root_metadata.st_mode)\n        or not stat.S_ISDIR(root_metadata.st_mode)\n        or root.resolve(strict=True) != root\n        or stat.S_ISLNK(git_metadata.st_mode)\n        or not stat.S_ISDIR(git_metadata.st_mode)\n    ):\n        raise ValueError(f\"oracle sanitization requires a real self-contained clone: {root}\")\n\n    original_head = _git_checked(root, [\"rev-parse\", \"--verify\", \"HEAD^{commit}\"])\n    if len(original_head) not in {40, 64} or any(\n        character not in \"0123456789abcdefABCDEF\" for character in original_head\n    ):\n        raise ValueError(\"clone HEAD is not an immutable commit\")\n\n    hidden_tree_result = run_managed(\n        [\n            \"git\",\n            \"-C\",\n            str(root),\n            \"ls-tree\",\n            \"-d\",\n            \"--format=%(objectname)\",\n            \"HEAD\",\n            \"--\",\n            HIDDEN_HARNESS_PATH.as_posix(),","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L248-L284","documentation":"Raised by sanitize_clone_for_hidden_oracles when the clone root or its '.git' is a symlink, not a directory, or the resolved root path differs from the lexical path (symlinked root). The sanitizer must operate on a real, non-symlinked clone so it can guarantee no path indirection hides oracle data or reintroduces it after pruning.","triggerScenarios":"clone is a symlink to another directory; '.git' is a symlink (e.g. a gitfile-style worktree pointer rather than a real .git directory); an intermediate path component is a symlink causing resolve() to diverge; clone is a regular file, not a directory.","commonSituations":"Using `git worktree` (which uses a .git file, not directory); a convenience symlink to the real clone; running through a symlinked parent like /tmp on some OSes; a corrupted clone where .git is a file.","solutions":["Use a full `git clone` (not a worktree) so '.git' is a real directory.","Resolve all symlinks in the path and pass the real absolute directory.","Avoid git worktree / gitfile-style repos for the disposable sanitized clone.","Re-clone into a fresh, non-symlinked location."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import stat\nfrom pathlib import Path\n\ndef assert_real_clone(clone: Path) -> None:\n    root = clone.expanduser().absolute()\n    rmd = root.lstat()\n    gmd = (root / \".git\").lstat()\n    if (stat.S_ISLNK(rmd.st_mode) or not stat.S_ISDIR(rmd.st_mode)\n            or root.resolve(strict=True) != root\n            or stat.S_ISLNK(gmd.st_mode) or not stat.S_ISDIR(gmd.st_mode)):\n        raise ValueError(f\"{root} must be a real non-symlink clone with real .git\")","typeGuard":"def is_real_self_contained_clone(clone) -> bool:\n    import stat\n    root = Path(clone).expanduser().absolute()\n    try:\n        rmd = root.lstat(); gmd = (root / \".git\").lstat()\n    except OSError:\n        return False\n    return (not stat.S_ISLNK(rmd.st_mode) and stat.S_ISDIR(rmd.st_mode)\n            and root.resolve(strict=True) == root\n            and not stat.S_ISLNK(gmd.st_mode) and stat.S_ISDIR(gmd.st_mode))","tryCatchPattern":"try:\n    head = sanitize_clone_for_hidden_oracles(clone)\nexcept ValueError as exc:\n    if \"real self-contained clone\" in str(exc):\n        real = clone.resolve(strict=True)\n        head = sanitize_clone_for_hidden_oracles(real)\n    else:\n        raise","preventionTips":["Use `git clone` (full clone), not `git worktree`, for the disposable sanitized repo.","Resolve symlinks in the clone path before passing it in.","Avoid placing clones under symlinked parent directories."],"tags":["python","benchmark","oracle","security","git","sanitization","symlink"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}