From 0e2a0669685952bec0a94e75be185c8212620f29 Mon Sep 17 00:00:00 2001 From: jknapp Date: Tue, 24 Nov 2026 10:50:35 -0800 Subject: [PATCH] fix(shared-httpd): exec-surface gate pipefail scan (CI 6352) + probe test accepts guard 403 - httpd-exec-surface-gate.sh:131: printf|grep -q under pipefail replaced by a here-string grep; same match, no second exit status for pipefail to prefer. - httpd-exec-surface-probes.test.sh: the ajp/ftp/scgi/uwsgi [P] probes now accept the proxy guard's 403 (secure, refused before handler lookup) as well as the AH01144 log line; any other outcome (502/503/200) still fails. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6 --- scripts/httpd-exec-surface-gate.sh | 2 +- scripts/tests/httpd-exec-surface-probes.test.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/httpd-exec-surface-gate.sh b/scripts/httpd-exec-surface-gate.sh index bafb6a5..e5d6a46 100755 --- a/scripts/httpd-exec-surface-gate.sh +++ b/scripts/httpd-exec-surface-gate.sh @@ -128,7 +128,7 @@ cmd_check() { fi # Positive control: nothing the platform uses may have disappeared with them. for m in $REQUIRED_MODULES; do - if ! printf '%s\n' "$mods" | grep -qE "^ ${m} "; then + if ! grep -qE "^ ${m} " <<<"$mods"; then echo "gate FAIL: required module ${m} is NOT loaded" >&2; fail=1 fi done diff --git a/scripts/tests/httpd-exec-surface-probes.test.sh b/scripts/tests/httpd-exec-surface-probes.test.sh index 1a5e1ef..14f2b33 100755 --- a/scripts/tests/httpd-exec-surface-probes.test.sh +++ b/scripts/tests/httpd-exec-surface-probes.test.sh @@ -124,7 +124,12 @@ for p in pa:ajp pf:ftp ps:scgi pu:uwsgi; do # error log, which names the missing scheme handler only when the module is gone. if [ "$EXPECT_OPEN" = 1 ]; then ok "[P] ${p##*:}:// : not asserted on an unhardened image"; continue; fi l=$(docker exec "$N" sh -c "grep -c 'No protocol handler was valid for the URL /${p%%:*}/' /var/log/httpd/a.test-error.log 2>/dev/null || true") + # The server-scope proxy guard now answers 403 BEFORE mod_proxy picks a handler, so the + # request never reaches the scheme lookup and AH01144 is no longer logged. A 403 is the + # secure outcome (the [P] is refused); AH01144 is the older one (module removed). Anything + # else (502/503/500/200, i.e. a proxy attempt or served content) is a failure. if [ "${l:-0}" -ge 1 ]; then ok "[P] ${p##*:}:// has no protocol handler (AH01144 for /${p%%:*}/)" + elif [ "$(printf %s "${r: -5}" | tr -d '\n')" = "[403]" ]; then ok "[P] ${p##*:}:// refused by the proxy guard (403) before any handler lookup" else bad "[P] ${p##*:}://: no 'No protocol handler' for /${p%%:*}/ in the error log -> ${r: -12}"; fi done echo "== surfaces that must stay (reported, not failed)"