- Remove the WHPSymlinkWalk post-walk lstat prototype (check-then-use race by construction; WHPOwnerGuard is the race-free mechanism): hook, directive, per-dir member, header docs. The directive is now an unknown command. - Probe test: WHP_SYMTEST_REQUIRE=1 turns every SKIP into a FAIL (no docker, no image, container does not start) and a minimum assertion count is enforced. New assertions: bare `Options All` keeps Apache semantics (Indexes on, MultiViews off, same-owner symlink followed, cross-tenant refused) plus None/+MultiViews controls (106 assertions). - CI: new pull_request workflow shared-httpd-symlink-pr.yaml (builds amd64 locally, no push/secrets, runs the probe test); build-push.yaml Build-Shared-httpd runs the probe test against the amd64 digest it just pushed, before the arm64 build and tag assembly, so a failure publishes no tag. Test script added to the shellcheck set; wiring tests added. - docs/shared-httpd-symlink-module.md: behaviour, local run, CI. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2.4 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.)