Files
cloud-apache-container/docs/shared-httpd-symlink-module.md
T
shadowdaoandClaude Sonnet 5.5 0d9e57e012
shared-httpd mod_whp_symlink PR check / Symlink-Module-Probe (pull_request) Successful in 1m15s
ci+chore(mod_whp_symlink): remove racy WHPSymlinkWalk prototype; run the probe test in CI; assert Options All mapping
- 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
2026-11-23 07:33:47 -08:00

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 .htaccess Options line before the core parses it, deny-by-default (only known-safe keywords are emitted, a name is only emitted when AllowOverride Options= permits it):
    • any FollowSymLinks form becomes SymLinksIfOwnerMatch;
    • any Includes form becomes IncludesNOEXEC, positive ExecCGI is dropped;
    • bare All keeps Apache semantics (All includes Indexes and excludes MultiViews), so it becomes Indexes SymLinksIfOwnerMatch under WHP's Options= list;
    • quoted/escaped lines are refused (config error, 500, nothing enabled).
  • 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_html case. 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-httpd or the test: .gitea/workflows/shared-httpd-symlink-pr.yaml builds the amd64 image locally (no push, no secrets) and runs the test with WHP_SYMTEST_REQUIRE=1.
  • Publish: Build-Shared-httpd in build-push.yaml runs 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.)