Skip to content

fix(policy): refuse a pushed HEAD command as a funny refname - #16

Closed
dumontg wants to merge 1 commit into
imports/09-store-retriesfrom
imports/10-head-refname
Closed

dumontg wants to merge 1 commit into
imports/09-store-retriesfrom
imports/10-head-refname

Conversation

@dumontg

@dumontg dumontg commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Stacked on #15.

Imports tobi/walgit#93 by @jonasgrosch, unchanged. A receive-pack command naming HEAD moved the branch HEAD points at past every protect rule.

Verified on the top of this stack: cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check, the crate test suites, and the Azure harness (just test-azure: store contract plus git push, clone, pull and cold restart on Azurite) pass. Known unrelated failures: the runtime stall timing tests in e2e (also intermittent on main) and the web UI asset tests that need pnpm run build.

A receive-pack command naming `HEAD` (e.g. `<old> <new> HEAD`) was
accepted and moved HEAD's branch through the symref, under a name that
no `protect` rule on refs/heads/* matches. Any principal with write
could therefore move a protected branch that HEAD points at. git's own
receive-pack refuses such commands as a funny refname; walgit now does
the same under every policy, including none.

Reproduced against a running server: with HEAD -> refs/heads/production
and production protected, a push to refs/heads/production is rejected
by the rule while a raw `HEAD` command answered `ok HEAD` and moved
production. Plain `git push` cannot send it (the client wants a full
refname), but any HTTP client can.

Symbolic HEAD updates (import) are not pushed commands and still pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 689d96e)
@dumontg

dumontg commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

Landed on main in 8347913 (merge of the stack top 59b206f), so this PR's changes are on main.

@dumontg dumontg closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants