review(mod_whp_proxy_guard): None clears scrub/deny lists; probe test is a CI publish gate

Independent review of PR #62 (adversarial probes, combined #59+#60+#61+#62 image):
- WHPProxyScrubEnv None / WHPDenyHandler None now empty the list set so far
  in that context, as WHPProxyAllow None already did. Before, None was only
  skipped, so a later file (the WHP drop-in) could not switch an image
  default off at server scope.
- build-push.yaml: shellcheck the probe test and run it as a fatal publish
  gate against the amd64 shared-httpd image by digest (before arm64 and tag
  assembly), like #60 does for mod_whp_symlink. WHP_PGTEST_REQUIRE=1 turns
  the local SKIPs (no docker / no image) into failures there.
- probe test: `<If><If> SetHandler proxy:http://` accepts "not proxied"
  (static served) as well as 403: on the #59 image mod_proxy_http is gone and
  mod_proxy cannot canonicalise the URL; the SSRF-target hit counter still
  asserts that nothing reached the target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-23 17:28:27 -08:00
1 parent 5f8597363e
commit c83e4d847f
3 files changed
+32 -5

No files matched your search

+15
View File
@@ -91,6 +91,7 @@ jobs:
scripts/tests/index-platforms.test.sh \
scripts/tests/lsphp-abi-gate.test.sh \
scripts/tests/lsphp-src-upload-progress.test.sh \
scripts/tests/whp-proxy-guard-module.test.sh \
.gitea/scripts/resolve-base-image.sh \
.gitea/scripts/plan-legs.sh
@@ -960,6 +961,20 @@ jobs:
PKG_CACHE=${{ steps.pkgcache.outputs.url }}
outputs: type=image,name=repo.anhonesthost.net/cloud-hosting-platform/shared-httpd,push-by-digest=true,name-canonical=true,push=true
# Publish gate for mod_whp_proxy_guard: the live probe test against the
# amd64 image that was just pushed (pulled by digest). Fatal and before the
# arm64 build and the tag-assembly step, so a failed assertion (or a missing
# docker/image: WHP_PGTEST_REQUIRE=1 turns the local SKIP into a FAIL)
# publishes no tag. Only the untagged by-digest blob exists at that point.
- name: Probe test (mod_whp_proxy_guard, amd64 image by digest)
env:
AMD64_DIGEST: ${{ steps.amd64.outputs.digest }}
run: |
set -euo pipefail
ref="repo.anhonesthost.net/cloud-hosting-platform/shared-httpd@${AMD64_DIGEST}"
docker pull "$ref"
WHP_PGTEST_REQUIRE=1 ./scripts/tests/whp-proxy-guard-module.test.sh "$ref"
# arm64: best effort, built under QEMU on this same trusted x86 runner (no
# secret ever leaves it). Same Dockerfile, same build-args (incl. the php.net
# EXPECT_PHP_MIN gate, which runs `php -r` on the arm64 binary). Must never
+9 -3
View File
@@ -6,7 +6,8 @@
# Env: WHP_FPM_IMAGE a cac-fpm image for the FastCGI environment section
# (default repo.anhonesthost.net/cloud-hosting-platform/cac-fpm:php83;
# that section is SKIPPED, not failed, when it is absent)
# SKIPs (exit 0) without docker or without the image.
# SKIPs (exit 0) without docker or without the image; with WHP_PGTEST_REQUIRE=1
# (the CI publish gate) those are failures instead.
#
# Tenant vhosts a.test / b.test / l.test on a private docker network, an HTTP
# "target" (this image's httpd, counted in its access log) and, with
@@ -18,7 +19,9 @@ ID="whp-pg-$$"; NET="$ID-net"; H="$ID-httpd"; TG="$ID-tgt"; FP="$ID-fpm"
pass=0; fail=0
ok() { pass=$((pass + 1)); printf ' ok %s\n' "$*"; }
bad() { fail=$((fail + 1)); printf ' FAIL %s\n' "$*"; }
skip() { printf 'SKIP whp-proxy-guard-module: %s\n' "$*"; exit 0; }
skip() { # WHP_PGTEST_REQUIRE=1 (CI publish gate): a missing prerequisite FAILS
if [ "${WHP_PGTEST_REQUIRE:-0}" = 1 ]; then printf 'FAIL whp-proxy-guard-module: %s (WHP_PGTEST_REQUIRE=1)\n' "$*"; exit 1; fi
printf 'SKIP whp-proxy-guard-module: %s\n' "$*"; exit 0; }
command -v docker >/dev/null 2>&1 || skip "no docker"
docker image inspect "$IMAGE" >/dev/null 2>&1 || skip "image $IMAGE not available"
T="$(mktemp -d)"
@@ -157,7 +160,10 @@ code "[P] http:// SSRF" a.test /t4/go 403
code "[P] ws:// SSRF" a.test /t5/go 403
code "[P] ajp:// SSRF" a.test /t6/go 403
code "[P] backend by IP address" a.test /t7/go 403
code "<If><If> SetHandler proxy:http://" a.test /t8/f.txt 403
# 403 from the guard; on an image without mod_proxy_http (cac #59) mod_proxy
# cannot canonicalise http:// and the static file is served instead. Both are
# fine as long as the target sees nothing (checked right below).
r="$(get a.test /t8/f.txt)"; case "$r" in 403*|"200 F"*) ok "<If><If> SetHandler proxy:http:// -> ${r:0:3} (refused or not proxied)" ;; *) bad "<If><If> SetHandler proxy:http:// -> ${r:0:40}" ;; esac
[ "$(hits)" = "$h0" ] && ok "the SSRF target saw no request" || bad "the SSRF target was reached"
r="$(get a.test /t9/f.txt)"; case "$r" in 403*|"200 F"*) ok "SetHandler proxy:unix: -> ${r:0:3} (refused or not proxied)" ;; *) bad "proxy:unix: -> ${r:0:40}" ;; esac
code "vhost without a list inherits the image default: [P] http://" b.test /t4/go 404 # no /t4 under /srv/b
@@ -255,7 +255,11 @@ static const char *cmd_scrub(cmd_parms *cmd, void *d, const char *arg)
&whp_proxy_guard_module);
if (!c->scrub)
c->scrub = apr_array_make(cmd->pool, 4, sizeof(const char *));
if (strcasecmp(arg, "none"))
/* `None` empties the list set so far in this context (same as
* WHPProxyAllow None), so a later file can switch the image default off. */
if (!strcasecmp(arg, "none"))
apr_array_clear(c->scrub);
else
*(const char **)apr_array_push(c->scrub) = arg;
return NULL;
}
@@ -266,7 +270,9 @@ static const char *cmd_deny_handler(cmd_parms *cmd, void *d, const char *arg)
&whp_proxy_guard_module);
if (!c->deny_handler)
c->deny_handler = apr_array_make(cmd->pool, 8, sizeof(const char *));
if (strcasecmp(arg, "none"))
if (!strcasecmp(arg, "none")) /* see cmd_scrub */
apr_array_clear(c->deny_handler);
else
*(const char **)apr_array_push(c->deny_handler) = arg;
return NULL;
}