Git guard: the shim (seam b) never reads GIT_DIR from its environment, so an export in one shell call and a push in the next reaches the clone #86

Open
opened 2026-11-23 04:47:40 +00:00 by uranus · 0 comments
Member

Purpose (defect): the git shim (seam b) judges a call at the repository git will really use. Today it never reads a GIT_DIR or GIT_WORK_TREE from its own environment.

Refs macula-io/martha#68 (found while building it; this was split out by the dispatcher, since #68 does only what was ruled, at seam a), #53 and #67 (the same class at seam a), and #48.

The class

A repository named through the environment, rather than in the shell line, is judged at the place the line was typed. The shim sends the launcher only cwd and args (judge_a_git_call.ts: gitCallBody(process.cwd(), args)), so the GIT_DIR that git will use is never part of the question.

The instance

Typed in a member's worktree, in two separate shell calls of one session:

export GIT_DIR=<clone>/.git
git push origin HEAD
  • In the second line, seam (a) sees no GIT_DIR. #53 reads an export only within the line it carries.
  • Seam (b) judges at the worktree's cwd, so it reads this as a push of the member's own branch.
  • git writes the clone, whose HEAD is main.

Whether a host carries an export from one shell call to the next is the host's business. Wherever it does, nothing judges the push. The same holds for an inline GIT_DIR=~/x git push: the shell expands the tilde before git runs, while the seam (a) reader reads it as a wrong path (see the reader issue filed beside this one).

What it touches (four guard files)

  • src/guard_the_git_a_member_runs/judge_a_git_call.ts: send GIT_DIR and GIT_WORK_TREE from process.env with the call.
  • src/guard_the_git_a_member_runs/guard_protocol.ts: gitCallBody carries them.
  • src/guard_the_git_a_member_runs/judge_a_guards_question.ts: read them, absolute paths only.
  • src/guard_the_git_a_member_runs/a_call_the_guards_seams_ask_about.ts: hand them to the reader as the call's gitDirectory and workTree, so ask_git and guard_workspace judge at that repository, as they already do for --git-dir.

Threat model first (guard code), then red first, then a mutant on the guard. It is NOT a new refusal: the existing default-branch rule then sees the right repository.

Purpose (defect): the git shim (seam b) judges a call at the repository git will really use. Today it never reads a `GIT_DIR` or `GIT_WORK_TREE` from its own environment. Refs macula-io/martha#68 (found while building it; this was split out by the dispatcher, since #68 does only what was ruled, at seam a), #53 and #67 (the same class at seam a), and #48. ## The class A repository named through the environment, rather than in the shell line, is judged at the place the line was typed. The shim sends the launcher only `cwd` and `args` (`judge_a_git_call.ts`: `gitCallBody(process.cwd(), args)`), so the `GIT_DIR` that git will use is never part of the question. ## The instance Typed in a member's worktree, in two separate shell calls of one session: export GIT_DIR=<clone>/.git git push origin HEAD - In the second line, seam (a) sees no `GIT_DIR`. #53 reads an export only within the line it carries. - Seam (b) judges at the worktree's cwd, so it reads this as a push of the member's own branch. - git writes the clone, whose HEAD is main. Whether a host carries an export from one shell call to the next is the host's business. Wherever it does, nothing judges the push. The same holds for an inline `GIT_DIR=~/x git push`: the shell expands the tilde before git runs, while the seam (a) reader reads it as a wrong path (see the reader issue filed beside this one). ## What it touches (four guard files) - `src/guard_the_git_a_member_runs/judge_a_git_call.ts`: send `GIT_DIR` and `GIT_WORK_TREE` from `process.env` with the call. - `src/guard_the_git_a_member_runs/guard_protocol.ts`: `gitCallBody` carries them. - `src/guard_the_git_a_member_runs/judge_a_guards_question.ts`: read them, absolute paths only. - `src/guard_the_git_a_member_runs/a_call_the_guards_seams_ask_about.ts`: hand them to the reader as the call's `gitDirectory` and `workTree`, so ask_git and guard_workspace judge at that repository, as they already do for `--git-dir`. Threat model first (guard code), then red first, then a mutant on the guard. It is NOT a new refusal: the existing default-branch rule then sees the right repository.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#86
No description provided.