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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-24 10:50:35 -08:00
1 parent 15cd30fa3b
commit 0e2a066968
2 files changed
+6 -1

No files matched your search

+1 -1
View File
@@ -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
@@ -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)"