Skip to content

fix(git-read): reject NUL bytes in repository paths #612

Description

@outlier27-cell

Problem

On current main (43cd2e94cc584f81cc1f27512ae99c9a4099b231), the read-only Git path validator accepts a NUL byte:

isSafeRepoPath("src\0secret.ts") // true
buildShowArgs({ revision: "HEAD", path: "src\0secret.ts" }) // returns argv

Node rejects that argv before spawning Git with TypeError [ERR_INVALID_ARG_VALUE]: The argument 'args[2]' must be a string without null bytes. The model therefore receives a host-level runtime failure rather than OpenPI's bounded InvalidPathError contract.

Expected behavior

Paths containing a NUL byte are rejected by isSafeRepoPath and all public Git argv builders throw InvalidPathError before process execution.

Actual behavior

The path pattern excludes path syntax and whitespace, but not \0, so the invalid value reaches the spawn boundary.

Scope

This is input diagnosis and contract hardening only. It is not a command-injection claim, does not alter Git command capability, and does not broaden accepted paths.

I would like to take this issue. I will add a failing argument-builder regression, make the smallest shared validator change, then run focused Git-read tests plus repository checks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions