Skip to content

Decide Whether a Quoted Run-Time -C Value Fails Closed in the Write Guard #3382

Closed

Description

@ptr727

Context

Found while closing the run-time GIT_DIR gap, which now fails closed on a mutating git command whose GIT_DIR, GIT_WORK_TREE, --git-dir, or --work-tree value holds a run-time word other than $HOME. Develop's guard shares the case below, and it was confirmed with a classify probe on a constructed command.

A Quoted Run-Time -C Value Still Fails Open

git -C $D reset --hard is denied, since word splitting may split the unquoted value. git -C "$D" reset --hard is allowed. Its quoting reads as one word, so the split check passes, and rule 6 then resolves the literal text $D, which names no checkout. The guard's docstring for _expand_dir records that as the rule's documented fail-open case for a $VAR it cannot resolve. A GIT_DIR="$D" now fails closed, so the two directory channels disagree.

Decision Needed

  • Fail closed on a quoted run-time -C value too, on a subcommand rule 6 denies. The two channels then agree, and git -C "$WT" commit in a worktree is denied until the path is written out.
  • Keep the documented fail-open for -C. A quoted -C "$dir" stays allowed, as the documented stance has it, and the README states that -C and GIT_DIR differ here.

Activity

  1. added
    decisionA question waiting on the maintainer, alone or beside whatever else the issue carries
    pre-existingReview finding classed pre-existing per local-strict-review Disposing of Findings
    scriptA defect in hub tooling
    on Oct 23, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Decided by the maintainer: keep the documented fail-open for a quoted run-time -C value. The guard code does not change. What remains here is the documentation: the guard README states that -C and GIT_DIR differ on a quoted run-time value. The decision label comes off, and this issue stays open as that documentation work.

  3. removed
    decisionA question waiting on the maintainer, alone or beside whatever else the issue carries
    on Oct 23, 2026
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

    pre-existingReview finding classed pre-existing per local-strict-review Disposing of FindingsscriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions