diff options
| author | dev <dev@example> | 2026-11-14 00:21:48 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-14 00:21:48 +0000 |
| commit | 4dfb9a5787b1554280807aaa28687f6c1a0d2db6 (patch) | |
| tree | ca56b31548f69c1a07822b263a0d2990a2a4f895 /tests | |
| parent | bc7f4da406fbd802b08985ba583e52f040bdba85 (diff) | |
| download | access-control-4dfb9a5787b1554280807aaa28687f6c1a0d2db6.tar.gz access-control-4dfb9a5787b1554280807aaa28687f6c1a0d2db6.zip | |
The two git calls were missing their NULL, so every push cost one level too much
execvp walks argv until it finds a NULL. head_ref built a four-element array
and fast_forward a five-element one, filled every slot, and never wrote the
terminator - so the fifth and sixth entries were whatever the stack happened to
be holding, and the exec either failed or ran something that was not the
argument list anybody meant.
Both answers were load-bearing, and both failures were silent:
symbolic-ref fails the hook cannot tell which branch HEAD is, so it charges
every deletion the most: admin
merge-base fails the update cannot be shown to be a fast-forward, so it
costs force
Together that meant a user with write could create a branch and then never
update it, and nobody but an admin could delete anything - with the refusal
pointing at the policy, which was fine, and at a level the user did not hold,
which looked deliberate. It was not. It was the shape of a C array.
Fixed by writing the arrays out with their NULL visible, and commented, because
the compiler will not catch this one: the array is big enough, the types are
right, and the bug is in the element that is not there.
The core suite could not see this, and that was the real problem - it passes
--ff and --head precisely so that it needs no git, which leaves the asking
itself untested. So there is now a stand-in named git in the suite, and the
real one kept out of PATH: it answers symbolic-ref to order and exits merge-base
either way, which covers fast-forward and non-fast-forward, HEAD's branch and
not, and the case with no git at all, where the hook must fail toward denying
rather than toward guessing. Eight checks, all of which failed before the fix.
The container suite caught this by being the only suite that runs the real
thing, which is worth noting for the next time someone suggests the integration
suite is the slow one that can be skipped.
Diffstat (limited to 'tests')
0 files changed, 0 insertions, 0 deletions
