summaryrefslogtreecommitdiffstats
path: root/container
Commit message (Collapse)AuthorAgeFilesLines
* Only build the access control executableHEADmaindev2026-11-1510-497/+0
| | | | | | | | | | | The container image and all the server configuration (Dockerfile, entrypoint, cgitrc, sshd, lighttpd, create-repo, git-host-key) move to the git-host project. This repo is now just the program: cmd/, src/, test/, the Makefile that builds git-authz and installs it, and the example policy - the same cmd/src/test/obj layout the reference projects use. The CI pipeline keeps the compile-and-test gate (strict, test, sanitizer, install) and drops the container-build job, which belongs to git-host now.
* Three things the removal left behinddev2026-11-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Drop grant/revoke and validate's host-wiring checksdev2026-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two features out, to answer a size target: src/ and cmd/ go from 2,306 non-blank lines to 1,495. `grant` and `revoke` were a convenience wrapper over a file that is a read-only mount in production by design, so they sat outside the enforcement path. src/edit.c is gone; both names now report an unknown command with exit 64. `validate` keeps the policy checks - parse errors with their line numbers, an unreadable policy, the @all-whole-repo and not-readable-by- the-git-account warnings - and stops cross-checking the machine around it. The repository cross-check, hook/hooksPath, sshd, the git account's shell and the key/htpasswd identity checks are deleted, along with --root, --hook-dir, --gitconfig, --sshd-config, --passwd, --keys, --htpasswd and --no-host; plain `validate` is what `validate --no-host` used to be. The container's build gate and the test suite are updated to match, since both called the removed flag. Orphaned by the removals and deleted with them: authz_repo_reachable, and authz_rule_validate's ref_ok parameter, which existed only so grant could interleave its own ref-pattern test. Surviving behaviour is unchanged. A 1,370-invocation differential run against the pre-removal binary - the check matrix, every authorize path, the hook reached through its own name, fake-git ancestry and HEAD, policy-only validate, the failure modes - differs only in the usage text that documented the removed surface. make strict, make test and make sanitizer are all clean, with ASan and UBSan silent. Also folded in from the same effort, since it touched the same files: authz_rule_validate as the single grammar, rule_covers() as the single answer for rule/ref coverage, vmsgv() behind the validate message tags, one kv reader for gitconfig and sshd_config while both were still there, and `sanitizer:` in the Makefile appending to CFLAGS rather than replacing it.
* Comments: cut to what the code cannot saydev2026-11-146-74/+41
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Layout: cmd/, src/, test/, everything built into obj/dev2026-11-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tree had grown sideways: main.c living among the sources it dispatches to, one test binary covering everything, object files left in the source directory because the Makefile put them there and, worse, tracked them. Now the command line is cmd/main.c, the engine is src/ and nothing in it knows about the command line, and each area of the engine has its own program under test/ - glob, norm, parse, need, check - each linking the library and reporting its own count. A failure says which area broke instead of taking the whole run down with a single "unit: 171" line, which is the only thing a per-file split buys and it is worth the small duplication the shared test.h absorbs. Objects go to obj/, test runners to obj/test_runner/, so a build leaves the tree as it found it. The stale src/*.o and tests/unit that were committed earlier are gone; they were build output in a source tree and the .gitignore that should have stopped them arrived after they did. The Makefile follows the same shape as the other C trees here: directories in variables, wildcards for the sources, one pattern rule that makes its own directory, test runners built from the same objects as the binary so they cannot test a different build than ships, and `test` running every runner with a foreach so the first failure stops the line. `strict` is `all` with -Werror, which is what CI now calls instead of passing CFLAGS in from outside; the sanitizer and install targets are unchanged in what they do. Behaviour is unchanged: 171 direct checks and 154 behavioural ones, same as before the move, and make install still stages a working hook symlink.
* container: the host, built from the program's own installdev2026-11-1310-0/+528
The image is two stages: one compiles, runs the suite and installs into a staging root, the other is the host and receives that staging root whole. The reason for the copy-whole is that the paths in the image are then the paths `make install` produces - including the hook symlink and its relative target - rather than a second list of destinations kept in a Dockerfile, which is how an image and a build start to disagree about where the hook is. The build stage is Alpine so the binary is musl-linked like the rest of the runtime image; a glibc binary would fail as "no such file" about a file that is plainly there. `make test` runs in that stage, so an image built from a tree whose tests fail does not get to exist. The lighttpd config, sshd config, CGI shim, cgitrc and the two operator tools come from the shell implementation, with the comments corrected: there is no refcheck any more, and the hook the comments point at is now a symlink to this binary. Nothing about the wiring changed, which is the point - the C program drops into a host that was already built around one hook and one policy file.