diff options
| author | dev <dev@example> | 2026-11-14 01:05:08 +0000 |
|---|---|---|
| committer | dev <dev@example> | 2026-11-14 01:05:08 +0000 |
| commit | 312ddd4936f09ae27a180ca495cacf2c06faf33e (patch) | |
| tree | 2fa46ab568ad55f7e8fb844c3447b1d296b2e340 /container/git-host-key | |
| parent | e737f3d560de2b8172e6dd83901bc1359283303c (diff) | |
| download | access-control-312ddd4936f09ae27a180ca495cacf2c06faf33e.tar.gz access-control-312ddd4936f09ae27a180ca495cacf2c06faf33e.zip | |
Comments: cut to what the code cannot say
The comments had grown into essays. A file header explaining why the file
exists, then a paragraph above each function restating what the next eight
lines do, then a paragraph above that one explaining why that matters. The
reader gets no further than the first paragraph, and the second is the one that
goes stale: it describes code that has since changed, and nothing fails when it
does.
Cut by about half. What is left is the three things a comment can do that code
cannot: say why the constraint exists (no regex because a hook must not depend
on what might be missing at 3am), say what is not obvious from the shape (a
bare ref name is a branch, never a tag; the seventh field of /etc/passwd is the
shell), and say where it hurts (the NULL in an execvp array, the mode and owner
that have to survive an atomic rewrite, the child that must not keep the hook's
stdin).
Block comments became // lines, which is also what the other C trees here use,
and the file headers went to two or three lines. Section banners stayed: they
are navigation, not prose.
Behaviour is unchanged and the suites prove it: 171 direct checks, 162
behavioural, clean under -Werror and under ASan/UBSan.
Diffstat (limited to 'container/git-host-key')
| -rwxr-xr-x | container/git-host-key | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/container/git-host-key b/container/git-host-key index a7fdfc8..10d8131 100755 --- a/container/git-host-key +++ b/container/git-host-key @@ -1,17 +1,11 @@ #!/bin/sh -# git-host-key - ssh public keys that carry their own identity. -# -# sshd only knows the OS account, and every git user shares the single 'git' -# account. So identity is written into the key's option list: +# ssh public keys that carry their own identity. sshd only knows the OS account, +# which every user shares, so identity goes in the key's option list: # # command="/usr/bin/git-shell",...,environment="GIT_HOST_USER=alice" # -# sshd puts that into the session environment (sshd_config needs -# PermitUserEnvironment yes), git-receive-pack inherits it, and the pre-receive -# hook authorises the push from it. A key without the option is anonymous as -# far as policy is concerned, so its pushes are denied. 'git-authz validate' -# reports keys with no identity, keys that pin something other than git-shell, -# and identities the policy has never heard of. +# A key without it is anonymous to the policy and every push with it is denied. + set -eu KEYS="${GIT_HOST_AUTHORIZED_KEYS:-/etc/git-host/secrets/authorized_keys}" |
