summaryrefslogtreecommitdiffstats
path: root/container/git-http-backend.cgi
diff options
context:
space:
mode:
authordev <dev@example>2026-11-13 21:32:38 +0000
committerdev <dev@example>2026-11-13 21:32:38 +0000
commit47c9b98ea3fb91833d6d0847fa4345fa23593a97 (patch)
tree3b68994aa774e9b758f8cb2296770a49adef87d7 /container/git-http-backend.cgi
parent2b53cf54acd3d84bd6edfd0b98cf58794e30ec7d (diff)
downloadaccess-control-47c9b98ea3fb91833d6d0847fa4345fa23593a97.tar.gz
access-control-47c9b98ea3fb91833d6d0847fa4345fa23593a97.zip
container: the host, built from the program's own install
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.
Diffstat (limited to 'container/git-http-backend.cgi')
-rw-r--r--container/git-http-backend.cgi20
1 files changed, 20 insertions, 0 deletions
diff --git a/container/git-http-backend.cgi b/container/git-http-backend.cgi
new file mode 100644
index 0000000..e086525
--- /dev/null
+++ b/container/git-http-backend.cgi
@@ -0,0 +1,20 @@
+#!/bin/sh
+# git-http-backend.cgi - a .cgi-named door to the stock git-http-backend.
+#
+# There is no policy in here. Reads are open, and writes are decided by the
+# global pre-receive hook, which is a symlink to git-authz and is reached by
+# every repository through core.hooksPath in /etc/gitconfig.
+#
+# This file exists for one reason: lighttpd's mod_cgi dispatches by extension,
+# and the alias in lighttpd.conf needs something named *.cgi in front of it.
+#
+# REMOTE_USER is set by mod_auth on push requests (auth.conf) and the receive
+# hooks authorise the push from it, so this script must stay a plain exec:
+# unsetting or rewriting the environment here turns every push into "no
+# identity" and denies them all.
+set -eu
+
+BACKEND="${GIT_HOST_HTTP_BACKEND:-/usr/libexec/git-core/git-http-backend}"
+[ -x "$BACKEND" ] || { printf 'Status: 500 Internal Server Error\r\n\r\n' >&2; exit 1; }
+
+exec "$BACKEND"