Repository navigation
dev-shell-hook: never auto-allow a HEAD off every origin branch - #35
Merged
Merged
Conversation
A session rooted at an outside contributor's fork PR head, or at an unpushed local commit, was auto-approved whenever its .envrc, flake.nix, and flake.lock matched origin/HEAD. Require HEAD to be contained in some last-fetched origin branch before running `direnv allow`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
added a commit
to moq-dev/quest
that referenced
this pull request
Nov 3, 2026
The maintainer judged the auto-allow risk narrow and picked one check: HEAD must be on an origin branch, shipped in kixelated/dotfiles#35. Record the decision in the epic, delete the allow-rule quest it settles, and drop kixtop from repo-config's wait since it has no direnv or Nix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bin/dev-shell-hook(from kixelated/dotfiles#33) auto-approved any checkout whose.envrc,flake.nix, andflake.lockmatchedorigin/HEAD. That included a fork PR head fetched from a contributor remote, as the review in moq-dev/quest#458 pointed out.The hook now runs
direnv allowonly whengit for-each-ref --contains HEAD refs/remotes/origin/finds some branch. Otherwise it refuses through the existingrefuse()path with one stderr line, "HEAD isn't on any origin branch", and exits 1. Everything else is unchanged: it still compares files againstorigin/HEAD, never fetches, and adds no owner allowlist or clean-tree check. Checkouts direnv has already approved keep loading after new local commits, because direnv keys approval on the.envrcpath and contents, not onHEAD.The docstring and
docs/dev-shell.mddescribe the new condition.Tests (
python3 -m unittest discover -s tests, 17 pass):contributorremote and the reviewed files still match, is refused.Both refusal tests fail when the guard is disabled.
🤖 Generated with Claude Code
(Written by Claude Opus 5.5)