{"record":{"id":"a88c9ffb28780a04","repo":"abhigyanpatwari/GitNexus","slug":"unsafe-git-metadata-blocks-oracle-sanitization-p","errorCode":null,"errorMessage":"unsafe Git metadata blocks oracle sanitization: {pseudo_ref}","messagePattern":"unsafe Git metadata blocks oracle sanitization: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":401,"sourceCode":"    git_dir = root / \".git\"\n    for pseudo_ref in (\n        \"AUTO_MERGE\",\n        \"BISECT_START\",\n        \"CHERRY_PICK_HEAD\",\n        \"FETCH_HEAD\",\n        \"MERGE_HEAD\",\n        \"ORIG_HEAD\",\n        \"REBASE_HEAD\",\n        \"REVERT_HEAD\",\n        \"shallow\",\n    ):\n        path = git_dir / pseudo_ref\n        try:\n            metadata = path.lstat()\n        except FileNotFoundError:\n            continue\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):\n            raise ValueError(f\"unsafe Git metadata blocks oracle sanitization: {pseudo_ref}\")\n        path.unlink()\n\n    logs = git_dir / \"logs\"\n    if logs.exists() or logs.is_symlink():\n        logs_metadata = logs.lstat()\n        if stat.S_ISLNK(logs_metadata.st_mode) or not stat.S_ISDIR(logs_metadata.st_mode):\n            raise ValueError(\"unsafe Git reflog metadata blocks oracle sanitization\")\n        shutil.rmtree(logs)\n\n    _git_checked(root, [\"repack\", \"-A\", \"-d\"], timeout=600)\n    _git_checked(root, [\"prune\", \"--expire=now\"], timeout=600)\n    _git_checked(root, [\"prune-packed\"], timeout=600)\n\n    remaining_refs = _git_checked(root, [\"for-each-ref\", \"--format=%(refname)\"], timeout=60)\n    if remaining_refs:\n        raise ValueError(\"oracle sanitization left clone references recoverable\")\n    fsck = run_checked(\n        [\"git\", \"-C\", str(root), \"fsck\", \"--full\", \"--no-progress\", \"--no-reflogs\", \"--unreachable\"],","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L383-L419","documentation":"The harness iterates pseudo-ref files under .git/ (AUTO_MERGE, MERGE_HEAD, ORIG_HEAD, REBASE_HEAD, FETCH_HEAD, shallow, etc.). Any that exists must be a regular non-symlink file or it is refused; a regular file is then unlinked. A symlink or directory pseudo-ref could redirect writes or escape .git, so the harness treats it as unsafe.","triggerScenarios":"Triggered when one of the enumerated .git pseudo-ref paths is a symbolic link or a directory rather than a regular file at sanitization time.","commonSituations":"A crafted clone that symlinks .git/MERGE_HEAD elsewhere; a leftover in-progress merge/rebase state from a reused clone; an aborted rebase that left REBASE_HEAD as a symlink on a broken FS.","solutions":["Inspect `ls -la <clone>/.git/{MERGE_HEAD,ORIG_HEAD,REBASE_HEAD,FETCH_HEAD,shallow}` for symlinks/dirs.","Abort any in-progress git operation: `git -C <clone> merge --abort`, `git -C <clone> rebase --abort`, etc., then delete the pseudo-ref file.","Re-clone from a clean source if the pseudo-ref looks crafted."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import stat\nfrom pathlib import Path\n\n_PSEUDO = (\"AUTO_MERGE\",\"BISECT_START\",\"CHERRY_PICK_HEAD\",\"FETCH_HEAD\",\"MERGE_HEAD\",\"ORIG_HEAD\",\"REBASE_HEAD\",\"REVERT_HEAD\",\"shallow\")\ndef pseudo_refs_are_regular(clone: Path) -> bool:\n    for name in _PSEUDO:\n        p = clone / \".git\" / name\n        try:\n            st = p.lstat()\n        except FileNotFoundError:\n            continue\n        if stat.S_ISLNK(st.st_mode) or not stat.S_ISREG(st.st_mode):\n            return False\n    return True\n","typeGuard":"def is_unsafe_pseudo_ref(exc: BaseException) -> bool:\n    return isinstance(exc, ValueError) and \"unsafe Git metadata blocks\" in str(exc)\n","tryCatchPattern":"try:\n    oracle_assets.sanitize_clone_for_hidden_oracles(clone)\nexcept ValueError as exc:\n    quarantine(clone)\n    raise AbortTask(str(exc)) from exc\n","preventionTips":["Do not sanitize a clone mid-merge/rebase/cherry-pick; abort those states first.","Start from a fresh clone so no operation pseudo-refs exist."],"tags":["git","pseudo-ref","symlink","toctou","security","oracle","sanitization","invariant"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}