- PR workflow: no secrets/registry login, checkout without persisted credentials, docker build --pull --no-cache, per-run tag shared-httpd:pr-probe-<run_id>, always() cleanup of the image and containers. - build-push.yaml: every docker/build-push-action step gets pull: true and no-cache: true (base is already digest-pinned by the resolve step). - Wiring tests for both; docs: CI trust model. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
3.1 KiB
shared-httpd: mod_whp_symlink (tenant symlink safety)
Source: src/mod_whp_symlink/mod_whp_symlink.c, built in a separate stage of
Dockerfile.shared-httpd against the distribution httpd-devel (the runtime keeps the
stock AlmaLinux httpd RPMs). Defaults: configs/whp-symlink.conf.
What it does
WHPHtaccessOptionsRemap On: rewrites a tenant.htaccessOptionsline before the core parses it, deny-by-default (only known-safe keywords are emitted, a name is only emitted whenAllowOverride Options=permits it):- any FollowSymLinks form becomes
SymLinksIfOwnerMatch; - any
Includesform becomesIncludesNOEXEC, positiveExecCGIis dropped; - bare
Allkeeps Apache semantics (All includes Indexes and excludes MultiViews), so it becomesIndexes SymLinksIfOwnerMatchunder WHP'sOptions=list; - quoted/escaped lines are refused (config error, 500, nothing enabled).
- any FollowSymLinks form becomes
WHPOwnerGuard Off|Log|On(+WHPOwnerGuardRoot): fstat() owner check on the file descriptor actually served; closes the SymLinksIfOwnerMatch check-then-open race and the swapped-public_htmlcase. Ships in Log mode.
The earlier WHPSymlinkWalk prototype (post-walk lstat check) was removed: it is racy by
construction, the owner guard is the race-free mechanism.
Probe test
scripts/tests/whp-symlink-module.test.sh [image] starts the image, creates two tenants and
probes every Options form, nested containers, the module directives, the swapped docroot
and bare Options All (Indexes on, MultiViews off, same-owner symlink followed,
cross-tenant refused).
Run locally (needs docker, about 5 minutes for the build):
docker build -f Dockerfile.shared-httpd -t shared-httpd:symtest .
WHP_SYMTEST_REQUIRE=1 ./scripts/tests/whp-symlink-module.test.sh shared-httpd:symtest
Without WHP_SYMTEST_REQUIRE=1 a missing docker or image is a SKIP (exit 0); with it, a
FAIL. Any failed assertion exits 1.
CI
- Pull requests touching the module, its config,
Dockerfile.shared-httpdor the test:.gitea/workflows/shared-httpd-symlink-pr.yamlbuilds the amd64 image locally (no push, no secrets) and runs the test withWHP_SYMTEST_REQUIRE=1. - Publish:
Build-Shared-httpdinbuild-push.yamlruns the same test against the amd64 image it just pushed by digest, before the arm64 build and the tag-assembly step. A failure publishes no tag. (amd64 only; the arm64 image is not probed.)
CI trust model
Gitea has only shared ubuntu-latest runners (two), used by the publish jobs and by PR jobs
alike; there is no separate label for untrusted code. So:
- The PR workflow runs PR-supplied Dockerfile and C source with no secrets and no registry
login, builds with
--pull --no-cacheunder a per-run tag (shared-httpd:pr-probe-<run_id>), and removes its image and containers in anif: always()step. - Every
docker/build-push-actionstep inbuild-push.yamlsetspull: trueandno-cache: true, on a fresh buildx builder per job and a digest-pinned base image, so no cache or local image from an earlier job on the runner is reused by a publish build. - Repo setting (maintainer's call): require approval for PR workflows from forks.