{"record":{"id":"4f5b86768b6d5c20","repo":"abhigyanpatwari/GitNexus","slug":"oracle-source-must-be-a-bounded-regular-non-symlin","errorCode":null,"errorMessage":"oracle source must be a bounded regular non-symlink file: {relative}","messagePattern":"oracle source must be a bounded regular non-symlink file: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/oracle_assets.py","lineNumber":143,"sourceCode":"    return lexical\n\n\ndef _read_oracle_file(root: Path, relative: PurePosixPath) -> bytes:\n    current = root\n    for part in relative.parts[:-1]:\n        current /= part\n        try:\n            metadata = current.lstat()\n        except OSError as exc:\n            raise ValueError(f\"oracle parent is unreadable: {relative}\") from exc\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISDIR(metadata.st_mode):\n            raise ValueError(f\"oracle parents must be real directories: {relative}\")\n\n    path = root.joinpath(*relative.parts)\n    try:\n        before = path.lstat()\n        if stat.S_ISLNK(before.st_mode) or not stat.S_ISREG(before.st_mode):\n            raise ValueError(f\"oracle source must be a bounded regular non-symlink file: {relative}\")\n        descriptor = os.open(path, os.O_RDONLY | getattr(os, \"O_NOFOLLOW\", 0))\n    except ValueError:\n        raise\n    except OSError as exc:\n        raise ValueError(f\"oracle source is unreadable: {relative}\") from exc\n    try:\n        opened = os.fstat(descriptor)\n        if (\n            stat.S_ISLNK(before.st_mode)\n            or not stat.S_ISREG(before.st_mode)\n            or not stat.S_ISREG(opened.st_mode)\n            or before.st_dev != opened.st_dev\n            or before.st_ino != opened.st_ino\n            or opened.st_size > MAX_ORACLE_FILE_BYTES\n        ):\n            raise ValueError(f\"oracle source must be a bounded regular non-symlink file: {relative}\")\n        chunks: list[bytes] = []\n        remaining = MAX_ORACLE_FILE_BYTES + 1","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/oracle_assets.py#L125-L161","documentation":"Raised by _read_oracle_file at the pre-open stage when the oracle source file itself is a symlink or not a regular file (lstat shows S_IFLNK or non-S_IFREG). The harness refuses to read anything that is not a plain regular file before it even calls os.open, as the first line of defense against symlink redirection.","triggerScenarios":"The declared oracle source file is a symbolic link; it is a named pipe, socket, device, or directory rather than a regular file.","commonSituations":"An oracle file was replaced with a symlink for convenience; the path points at a FIFO or device node; the file was accidentally created as a directory.","solutions":["Replace the symlink/special file with a real regular file containing the oracle bytes.","Point the 'source' declaration at an actual regular file in the oracle root.","Re-materialize the oracle asset from its canonical source."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"import stat\nfrom pathlib import Path\n\ndef assert_regular_file(root: Path, relative) -> None:\n    p = root.joinpath(*Path(relative).parts)\n    md = p.lstat()\n    if stat.S_ISLNK(md.st_mode) or not stat.S_ISREG(md.st_mode):\n        raise ValueError(f\"{relative} must be a regular non-symlink file\")","typeGuard":"def is_regular_non_symlink(root, relative) -> bool:\n    import stat\n    try:\n        md = Path(root).joinpath(*Path(relative).parts).lstat()\n    except OSError:\n        return False\n    return not stat.S_ISLNK(md.st_mode) and stat.S_ISREG(md.st_mode)","tryCatchPattern":"try:\n    payload = _read_oracle_file(root, relative)\nexcept ValueError as exc:\n    if \"bounded regular non-symlink\" in str(exc):\n        raise SystemExit(f\"Replace symlink/special file at {relative} with a real file\") from exc\n    raise","preventionTips":["Never replace oracle source files with symlinks.","Audit oracle tree with `find <root> -type l -delete` after materializing."],"tags":["python","benchmark","oracle","security","symlink","filesystem"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}