<feed xmlns='http://www.w3.org/2005/Atom'>
<title>access-control/authz.conf, branch main</title>
<subtitle>Unnamed repository
</subtitle>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/access-control/'/>
<entry>
<title>Three things the removal left behind</title>
<updated>2026-11-15T11:32:51+00:00</updated>
<author>
<name>dev</name>
<email>dev@example</email>
</author>
<published>2026-11-15T11:32:51+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/access-control/commit/?id=2e6dd4a8e9e5302efae6b7532f7f4609882fc21d'/>
<id>2e6dd4a8e9e5302efae6b7532f7f4609882fc21d</id>
<content type='text'>
The shipped example policy still told operators that `git-authz grant`
and `revoke` edit a source copy. Both exit 64 now, so the header says
why the deployed copy is read-only instead - the hook must not be able
to change who can push - and stops short of naming a command that no
longer exists.

container/git-host-key made the same claim from the other side: that
`validate` cross-checks keys and the rest of the wiring. It does not
any more. The text now says what git-host-key itself guarantees, the
option prefix it writes onto each key, and what it does not: a key
edited in by hand can still lose the identity, and the name still needs
a rule.

sb_init/sb_add/sb_addf/sb_free and strbuf_t were orphaned when edit.c
went - nothing else ever built a string buffer - so they are gone, with
the stdarg.h include that only sb_addf needed. 64 lines.

src/ and cmd/ are 1,431 non-blank lines. make strict, make test and
make sanitizer are clean, sanitizers silent, and the example policy
still parses to its 7 rules.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The shipped example policy still told operators that `git-authz grant`
and `revoke` edit a source copy. Both exit 64 now, so the header says
why the deployed copy is read-only instead - the hook must not be able
to change who can push - and stops short of naming a command that no
longer exists.

container/git-host-key made the same claim from the other side: that
`validate` cross-checks keys and the rest of the wiring. It does not
any more. The text now says what git-host-key itself guarantees, the
option prefix it writes onto each key, and what it does not: a key
edited in by hand can still lose the identity, and the name still needs
a rule.

sb_init/sb_add/sb_addf/sb_free and strbuf_t were orphaned when edit.c
went - nothing else ever built a string buffer - so they are gone, with
the stdarg.h include that only sb_addf needed. 64 lines.

src/ and cmd/ are 1,431 non-blank lines. make strict, make test and
make sanitizer are clean, sanitizers silent, and the example policy
still parses to its 7 rules.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove protected-refs: a rule covers what it names, and nothing else</title>
<updated>2026-11-13T22:28:22+00:00</updated>
<author>
<name>dev</name>
<email>dev@example</email>
</author>
<published>2026-11-13T22:28:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/access-control/commit/?id=50f296cf7609ce77d41b9fb3df51d6aeec8330d6'/>
<id>50f296cf7609ce77d41b9fb3df51d6aeec8330d6</id>
<content type='text'>
`set protected-refs` raised the price of a listed ref by one level: write
needed force on main, force needed admin.  It was a second, invisible list, and
it was the one part of the model that could not be read off the rules.  The
question it was supposed to answer - "who can move main?" - stopped having an
answer in the file: you had to hold both the rules and the protection list in
your head and combine them, and the combination was where surprises lived.
Giving someone force so they could rewrite their own branches quietly let them
fast-forward main, because a fast-forward costs write, protection raised it to
force, and there it was.

Now a rule says what it says.  An unscoped rule covers main; a rule that means
to leave main alone names what it covers instead, and the refusal says "bob
holds write on team, but not on refs/heads/main" rather than blaming a list
nobody remembered.  Excluding one person from one branch is a matter of what
their lines name, which is the same mechanism as everything else here.

The setting is refused by name rather than ignored.  A policy that still carries
one would otherwise mean "everyone with write can fast-forward main" while
looking like it said the opposite, and the operator would learn that from a push
rather than from the parser; so `set protected-refs` is now an error that says
what to write instead, and the suite asserts both halves - that it is refused,
and that cleaning it out makes the file valid again.

What stays: refs outside refs/heads and refs/tags still need admin whatever a
rule appears to grant about them.  That one the policy genuinely cannot name in
advance, because it is the part of the namespace no policy was written with in
mind.

`protect` goes with it, so the editing commands are grant and revoke.  The
example policy now names frank, whose two refs are main and the release tags,
because that is the shape the file is now meant to be written in.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`set protected-refs` raised the price of a listed ref by one level: write
needed force on main, force needed admin.  It was a second, invisible list, and
it was the one part of the model that could not be read off the rules.  The
question it was supposed to answer - "who can move main?" - stopped having an
answer in the file: you had to hold both the rules and the protection list in
your head and combine them, and the combination was where surprises lived.
Giving someone force so they could rewrite their own branches quietly let them
fast-forward main, because a fast-forward costs write, protection raised it to
force, and there it was.

Now a rule says what it says.  An unscoped rule covers main; a rule that means
to leave main alone names what it covers instead, and the refusal says "bob
holds write on team, but not on refs/heads/main" rather than blaming a list
nobody remembered.  Excluding one person from one branch is a matter of what
their lines name, which is the same mechanism as everything else here.

The setting is refused by name rather than ignored.  A policy that still carries
one would otherwise mean "everyone with write can fast-forward main" while
looking like it said the opposite, and the operator would learn that from a push
rather than from the parser; so `set protected-refs` is now an error that says
what to write instead, and the suite asserts both halves - that it is refused,
and that cleaning it out makes the file valid again.

What stays: refs outside refs/heads and refs/tags still need admin whatever a
rule appears to grant about them.  That one the policy genuinely cannot name in
advance, because it is the part of the namespace no policy was written with in
mind.

`protect` goes with it, so the editing commands are grant and revoke.  The
example policy now names frank, whose two refs are main and the release tags,
because that is the shape the file is now meant to be written in.
</pre>
</div>
</content>
</entry>
<entry>
<title>Install: the hook is a relative symlink, and the policy is configuration</title>
<updated>2026-11-13T20:34:47+00:00</updated>
<author>
<name>dev</name>
<email>dev@example</email>
</author>
<published>2026-11-13T20:34:47+00:00</published>
<link rel='alternate' type='text/html' href='http://git.jnsn.dev/cgit/access-control/commit/?id=19a3eb704479fa01c383960ca21a057e8c5fbaf7'/>
<id>19a3eb704479fa01c383960ca21a057e8c5fbaf7</id>
<content type='text'>
The hook is a symlink named pre-receive, because that name is what
core.hooksPath looks for and what selects authorize mode inside the binary.
It was built by cd'ing into the hook directory first, which left the awk
script writing the relative path out of reach, and the recipe failed with the
link never created.  The path is computed where the script is, and the link is
made from there.

Relative rather than absolute for the reason that matters during an install: a
staged tree under DESTDIR, an unpacked prefix, or an image assembled somewhere
else must point at the binary that came with them, not at whatever lives at the
same absolute path on the machine reading the link.  relpath.awk walks both
paths component by component - it is not a string-prefix operation, because
/usr/local/share and /usr/local/bin share a prefix only up to the point where
".." starts - and falls back to the absolute path when a component cannot be
named from where it stands.

authz.conf is the example policy, and the installer treats it as
configuration: an existing file is an operator's, so it is kept and the new
example lands beside it as authz.conf.new rather than over the rules someone
wrote down.  `make sanitizer' builds both suites under AddressSanitizer and
UBSan, which is how the editing bugs in the previous commit were found.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The hook is a symlink named pre-receive, because that name is what
core.hooksPath looks for and what selects authorize mode inside the binary.
It was built by cd'ing into the hook directory first, which left the awk
script writing the relative path out of reach, and the recipe failed with the
link never created.  The path is computed where the script is, and the link is
made from there.

Relative rather than absolute for the reason that matters during an install: a
staged tree under DESTDIR, an unpacked prefix, or an image assembled somewhere
else must point at the binary that came with them, not at whatever lives at the
same absolute path on the machine reading the link.  relpath.awk walks both
paths component by component - it is not a string-prefix operation, because
/usr/local/share and /usr/local/bin share a prefix only up to the point where
".." starts - and falls back to the absolute path when a component cannot be
named from where it stands.

authz.conf is the example policy, and the installer treats it as
configuration: an existing file is an operator's, so it is kept and the new
example lands beside it as authz.conf.new rather than over the rules someone
wrote down.  `make sanitizer' builds both suites under AddressSanitizer and
UBSan, which is how the editing bugs in the previous commit were found.
</pre>
</div>
</content>
</entry>
</feed>
