DRAFT, DO NOT MERGE: merging publishes the shared-httpd image to production. Everything below was measured locally in docker (two tenants, different uids, real cac-fpm:php83 backends). No host was touched.
Problem
PR #353 in WHP pins SCRIPT_FILENAME / DOCUMENT_ROOT and drops PHP_VALUE / PHP_ADMIN_VALUE in a per-vhost <Location "/">. A tenant .htaccess section nested inside another <If> is merged after every section a vhost or a server-scope drop-in can use, so those pins can always be overridden. Measured on httpd 2.4.63-13.el10_2.8 (shared-httpd:latest), where the victim's admin.php ran as the victim's uid:
<If><If><If>, <If><If "false"></If><ElseIf "true">, <Files><If><If> SetHandler "proxy:fcgi://b...", nested PATH_TRANSLATED + REDIRECT_URL, and the victim backend's IP address instead of its name
On WHP origin/main (no <If> copy of the pins yet), a single<If>, <ElseIf> and <Files><If> also work, and so does SetEnv PATH_TRANSLATED + REDIRECT_URL.
The same merge-order problem also leaves the following open:
[P] / SetHandler "proxy:http://..." to any host is proxied (SSRF). Measured with http, ws and ajp.
A nested <If>SetHandler balancer-manager serves the balancer manager. mod_proxy_balancer cannot be removed, because multi-container sites use balancers.
[H=server-status] and [H=lua-script] still work.
Root cause: hook order
mod_proxy_fcgi applies ProxyFCGISetEnvIf rules in fix_cgivars(), inside its own scheme handler, right after ap_add_cgi_vars() and immediately before sending the params. It reads them from the merged per-dir config. Its merge function appends the override's rules to the base's (apr_array_append(base, over)). Tenant <If> sections are merged last, so a tenant rule is the last one applied. No server section can come after it. Only code that runs after the merge can decide.
This is a separate module from #60's mod_whp_symlink, so either can merge first. It has its own build stage, modbuild-proxyguard. Both PRs edit Dockerfile.shared-httpd, so whichever lands second needs a trivial rebase.
Proxy allow list. A mod_proxy scheme_handler hook at APR_HOOK_REALLY_FIRST. It runs once per backend attempt, after all per-dir merging, mod_rewrite and balancer member selection (the URL has already been rewritten to the member), and before any scheme handler opens a connection. The target is taken from the same places mod_proxy takes it: the worker's or the request's UDS path, otherwise apr_uri_parse() of the URL. It must be on the vhost's WHPProxyAllow list (scheme://host[:port], scheme://*:port, unix:/path, None); otherwise the request gets a 403. Every scheme is covered.
WHPHtaccessProxyFCGI Deny. The module declares ProxyFCGISetEnvIf / ProxyFCGIBackendType itself, so it is invoked before mod_proxy_fcgi. This is the same mechanism as #60's Options remap. It returns an error in .htaccess context, at any nesting depth, and DECLINE_CMD everywhere else. With no tenant rule left in the array, the vhost's pins are the last word again. The fleet scan of 2026-11-23 found 0 .htaccess files using these directives.
WHPProxyScrubEnv. Unsets PHP_VALUE PHP_ADMIN_VALUE PATH_TRANSLATED from r->subprocess_env in the same hook, so anything a tenant set with SetEnv, SetEnvIf or [E=] is gone. mod_proxy_fcgi then re-adds the real PATH_TRANSLATED for PATH_INFO and applies the server-config rules.
WHPDenyHandler. A handler hook at REALLY_FIRST returns 403 for the listed handler names, whatever chose them. Image list: balancer-manager, server-status, application/x-httpd-status, server-info, lua-script, cgi-script, application/x-httpd-cgi.
Image defaults (configs/whp-proxy-guard.conf):
WHPHtaccessProxyFCGI Deny
the scrub list
WHPProxyAllow fcgi://*:9000 + WHPProxyGuard On. Every WHP-rendered PHP handler is fcgi on port 9000, so old WHP renders keep working.
the deny list
The WHP draft PR renders an exact per-vhost list (WHPProxyAllow "fcgi://<site>-01:9000" ...) inside <IfModule whp_proxy_guard_module>.
Measured matrix (proxy-matrix.sh)
Columns:
before: shared-httpd:latest
image only: this image with old WHP (origin/main)
image + WHP PR: this image with the WHP draft (per-vhost list)
allow list only: the per-vhost list alone, with the refusal and the scrub off
Canary: pull, then recreate shared-httpd-01, then run both harnesses plus the in-repo test. Grep the logs for whp_proxy_guard: (any 403 on legitimate traffic would show there).
Roll out to the fleet. Rollback: retag the previous digest.
The WHP per-vhost list needs a separate WHP release. Without it, every vhost gets the fcgi://*:9000 default, which already closes everything in the table except a tenant [P] to another tenant's fcgi:9000 with pinned params, and that request gets FPM's 404 (no victim code runs).
Update 2026-11-23: port-80 review finding (HIGH), fixed in both PRs
Finding. The per-site :80 vhost redirected only when SERVER_NAME was the primary name. An alias host on :80 was served from the docroot, with the tenant .htaccess evaluated and none of the :443 FastCGI pins or allow list.
Who can reach :80. The edge never sends :80 traffic here: haproxy tlsServers uses shared-httpd on 443 only, and the edge answers ACME http-01 itself. But :80 is reachable from the shared client-net docker network (the container publishes no ports).
Measured on shared-httpd:latest, :80 alias host:
plain, <If> and every nested ProxyFCGISetEnvIf + [P] shape ran tenant B's script
PHP_VALUE poisoned B's workers
SSRF and the handler residuals worked
.php came back as source
Measured on the image from #62, old template, :80: the fcgi://*:9000 default still let [P] run B's index.php. Nothing pins SCRIPT_FILENAME on :80.
Fix:
WHP #362 template. The :80 vhost redirect is now unconditional (no RewriteCond). It is a server-context rewrite in the translate phase, so no .htaccess is ever read on :80. The vhost also gets WHPProxyAllow None inside <IfModule>. Measured: every :80 probe answers 301 on both the old image and the new one. The goldens and isolation_test pin this shape. The docker harness now renders an alias and asserts 301 for the primary and the alias on :80.
#62 module: WHPProxyRequireTLS On (image default). There is no proxying for a request that did not arrive over TLS. This closes :80 for vhosts rendered before the template change. Measured: old template on the new image, every :80 proxy probe is refused.
#62 module: WHPProxyRequireVhostList On|Off gives fail-closed behaviour for vhosts without their own WHPProxyAllow; an inherited list does not count. It is Off in the image and is not set by #362. Hosts carry pre-#362 renders, and the drop-in is converged on every single-site apply, so turning it on now would cut off PHP for every not-yet-re-rendered vhost until the sweep reached it. A follow-up WHP release should switch it On in the drop-in once the fleet re-render has converged everywhere. The default catch-all vhost and the :80 vhosts never proxy, so they are not affected. Until then, the fcgi://*:9000 default applies only to old :443 renders, which still carry the #353 pins: a [P] to another backend gets FPM's 404, and no victim code runs.
DRAFT, DO NOT MERGE: merging publishes the shared-httpd image to production. Everything below was measured locally in docker (two tenants, different uids, real cac-fpm:php83 backends). No host was touched.
## Problem
PR #353 in WHP pins SCRIPT_FILENAME / DOCUMENT_ROOT and drops PHP_VALUE / PHP_ADMIN_VALUE in a per-vhost `<Location "/">`. A tenant `.htaccess` section nested inside another `<If>` is merged after every section a vhost or a server-scope drop-in can use, so those pins can always be overridden. Measured on httpd 2.4.63-13.el10_2.8 (shared-httpd:latest), where the victim's `admin.php` ran as the victim's uid:
- `<If "true"><If "true"> ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/home/b/..." </If></If>` + `RewriteRule ^go$ fcgi://b.test-01:9000/... [P]`
- `<If><If><If>`, `<If><If "false"></If><ElseIf "true">`, `<Files><If><If> SetHandler "proxy:fcgi://b..."`, nested `PATH_TRANSLATED` + `REDIRECT_URL`, and the victim backend's IP address instead of its name
- On WHP **origin/main** (no `<If>` copy of the pins yet), a **single** `<If>`, `<ElseIf>` and `<Files><If>` also work, and so does `SetEnv PATH_TRANSLATED` + `REDIRECT_URL`.
The same merge-order problem also leaves the following open:
- `[P]` / `SetHandler "proxy:http://..."` to any host is proxied (SSRF). Measured with http, ws and ajp.
- A nested `<If>` `SetHandler balancer-manager` serves the balancer manager. mod_proxy_balancer cannot be removed, because multi-container sites use balancers.
- `[H=server-status]` and `[H=lua-script]` still work.
## Root cause: hook order
mod_proxy_fcgi applies `ProxyFCGISetEnvIf` rules in `fix_cgivars()`, inside its own scheme handler, right after `ap_add_cgi_vars()` and immediately before sending the params. It reads them from the merged per-dir config. Its merge function appends the override's rules to the base's (`apr_array_append(base, over)`). Tenant `<If>` sections are merged last, so a tenant rule is the last one applied. No server section can come after it. Only code that runs after the merge can decide.
## Design: `src/mod_whp_proxy_guard/mod_whp_proxy_guard.c`
This is a separate module from #60's mod_whp_symlink, so either can merge first. It has its own build stage, `modbuild-proxyguard`. Both PRs edit `Dockerfile.shared-httpd`, so whichever lands second needs a trivial rebase.
1. **Proxy allow list.** A mod_proxy `scheme_handler` hook at `APR_HOOK_REALLY_FIRST`. It runs once per backend attempt, after all per-dir merging, mod_rewrite and balancer member selection (the URL has already been rewritten to the member), and before any scheme handler opens a connection. The target is taken from the same places mod_proxy takes it: the worker's or the request's UDS path, otherwise `apr_uri_parse()` of the URL. It must be on the vhost's `WHPProxyAllow` list (`scheme://host[:port]`, `scheme://*:port`, `unix:/path`, `None`); otherwise the request gets a 403. Every scheme is covered.
2. **`WHPHtaccessProxyFCGI Deny`.** The module declares `ProxyFCGISetEnvIf` / `ProxyFCGIBackendType` itself, so it is invoked before mod_proxy_fcgi. This is the same mechanism as #60's `Options` remap. It returns an error in `.htaccess` context, at any nesting depth, and `DECLINE_CMD` everywhere else. With no tenant rule left in the array, the vhost's pins are the last word again. The fleet scan of 2026-11-23 found 0 `.htaccess` files using these directives.
3. **`WHPProxyScrubEnv`.** Unsets `PHP_VALUE PHP_ADMIN_VALUE PATH_TRANSLATED` from `r->subprocess_env` in the same hook, so anything a tenant set with SetEnv, SetEnvIf or `[E=]` is gone. mod_proxy_fcgi then re-adds the real PATH_TRANSLATED for PATH_INFO and applies the server-config rules.
4. **`WHPDenyHandler`.** A handler hook at `REALLY_FIRST` returns 403 for the listed handler names, whatever chose them. Image list: balancer-manager, server-status, application/x-httpd-status, server-info, lua-script, cgi-script, application/x-httpd-cgi.
Image defaults (`configs/whp-proxy-guard.conf`):
- `WHPHtaccessProxyFCGI Deny`
- the scrub list
- `WHPProxyAllow fcgi://*:9000` + `WHPProxyGuard On`. Every WHP-rendered PHP handler is fcgi on port 9000, so old WHP renders keep working.
- the deny list
The WHP draft PR renders an exact per-vhost list (`WHPProxyAllow "fcgi://<site>-01:9000" ...`) inside `<IfModule whp_proxy_guard_module>`.
## Measured matrix (`proxy-matrix.sh`)
Columns:
- **before:** shared-httpd:latest
- **image only:** this image with old WHP (origin/main)
- **image + WHP PR:** this image with the WHP draft (per-vhost list)
- **allow list only:** the per-vhost list alone, with the refusal and the scrub off
| probe | before (main) | before (in-flight WHP branch) | image only | image + WHP PR | allow list only |
|---|---|---|---|---|---|
| plain ProxyFCGISetEnvIf SF + [P] to B | closed 404 | closed 404 | 500 | 500 | 403 |
| `<If>` SF + [P] | **victim ran** | closed | 500 | 500 | 403 |
| `<If><If>` SF + [P] | **victim ran** | **victim ran** | 500 | 500 | 403 |
| `<If><If><If>` | **victim ran** | **victim ran** | 500 | 500 | 403 |
| `<If><If false><ElseIf>` | **victim ran** | **victim ran** | 500 | 500 | 403 |
| `<Files><If><If> SetHandler proxy:fcgi://B` | **victim ran** | **victim ran** | 500 | 500 | 403 |
| `<If><If>` PATH_TRANSLATED+REDIRECT_URL | **victim ran** | **victim ran** | 500 | 500 | 403 |
| `<If><If>` SF + [P] to B's IP | **victim ran** | **victim ran** | 500 | 500 | 403 |
| SetEnv/[E=] PHP_VALUE+PHP_ADMIN_VALUE+PATH_TRANSLATED + [P] | **victim ran** | closed | closed 404 | 403 | 403 |
| `<If><If>` ProxyFCGISetEnvIf PHP_VALUE (worker poisoning) | **poisoned** | **poisoned** | 500 | 500 | 403 |
| [P] http / ws / ajp to another host | **reached** | **reached** | 403 | 403 | 403 |
| `<If><If>` SetHandler proxy:http:// | **reached** | **reached** | 403 | 403 | 403 |
| [P] fcgi://B:9999 | attempted | attempted | 403 | 403 | 403 |
| `<If><If>` SetHandler balancer-manager | **served** | **served** | 403 | 403 | (deny list off) |
| [H=server-status] / [H=lua-script] / nested `<If>` cgi-script | **served / ran / ran** | same | 403 | 403 | (deny list off) |
Compat, all 200 on every image-plus-config combination:
- single backend `/index.php` and `/`, alias host, direct PATH_INFO
- WordPress permalink, Laravel route
- static file, uploads idiom (`SetHandler none` / `default-handler`)
- misc FileInfo
- wildcard apex and `*.w.test`
- a balancer site with 3 members, 6 of 6 requests
- the CodeIgniter 4 route: 200 with the in-flight WHP branch, 404 on main both before and after (pre-existing, fixed by that branch)
Other suites, run against this image:
- WHP `test-shared-httpd-tenant-isolation.sh` on the in-flight branch: PASS 69 (every residual note flips to "now closed").
- The same harness on origin/main: PASS 51.
- The same harness with the WHP draft PR: PASS 61, module-aware.
- `scripts/tests/whp-proxy-guard-module.test.sh` (in this PR): PASS 36 on this image, 24 FAIL on shared-httpd:latest.
## Before un-drafting
- wire `scripts/tests/whp-proxy-guard-module.test.sh` into CI
- add an arm64 build check (plain C against the distro headers; only built on amd64 here)
- run a perf sanity check: one `apr_uri_parse` plus a few string compares per proxied request (not measured)
- rebase against #60 / #59, whichever lands first
## Rollout
1. Merge.
2. Run CI.
3. Canary: pull, then recreate shared-httpd-01, then run both harnesses plus the in-repo test. Grep the logs for `whp_proxy_guard:` (any 403 on legitimate traffic would show there).
4. Roll out to the fleet. Rollback: retag the previous digest.
The WHP per-vhost list needs a separate WHP release. Without it, every vhost gets the `fcgi://*:9000` default, which already closes everything in the table except a tenant `[P]` to another tenant's fcgi:9000 with pinned params, and that request gets FPM's 404 (no victim code runs).
## Update 2026-11-23: port-80 review finding (HIGH), fixed in both PRs
**Finding.** The per-site `:80` vhost redirected only when `SERVER_NAME` was the primary name. An alias host on `:80` was served from the docroot, with the tenant `.htaccess` evaluated and none of the `:443` FastCGI pins or allow list.
- **Who can reach `:80`.** The edge never sends `:80` traffic here: haproxy `tlsServers` uses shared-httpd on 443 only, and the edge answers ACME http-01 itself. But `:80` is reachable from the shared `client-net` docker network (the container publishes no ports).
- **Measured on shared-httpd:latest, `:80` alias host:**
- plain, `<If>` and every nested ProxyFCGISetEnvIf + `[P]` shape ran tenant B's script
- PHP_VALUE poisoned B's workers
- SSRF and the handler residuals worked
- `.php` came back as source
- **Measured on the image from #62, old template, `:80`:** the `fcgi://*:9000` default still let `[P]` run B's index.php. Nothing pins SCRIPT_FILENAME on `:80`.
**Fix:**
- **WHP #362 template.** The `:80` vhost redirect is now unconditional (no RewriteCond). It is a server-context rewrite in the translate phase, so no `.htaccess` is ever read on `:80`. The vhost also gets `WHPProxyAllow None` inside `<IfModule>`. Measured: every `:80` probe answers 301 on both the old image and the new one. The goldens and `isolation_test` pin this shape. The docker harness now renders an alias and asserts 301 for the primary and the alias on `:80`.
- **#62 module: `WHPProxyRequireTLS On`** (image default). There is no proxying for a request that did not arrive over TLS. This closes `:80` for vhosts rendered before the template change. Measured: old template on the new image, every `:80` proxy probe is refused.
- **#62 module: `WHPProxyRequireVhostList On|Off`** gives fail-closed behaviour for vhosts without their own `WHPProxyAllow`; an inherited list does not count. It is **Off** in the image and is **not** set by #362. Hosts carry pre-#362 renders, and the drop-in is converged on every single-site apply, so turning it on now would cut off PHP for every not-yet-re-rendered vhost until the sweep reached it. A follow-up WHP release should switch it On in the drop-in once the fleet re-render has converged everywhere. The default catch-all vhost and the `:80` vhosts never proxy, so they are not affected. Until then, the `fcgi://*:9000` default applies only to old `:443` renders, which still carry the #353 pins: a `[P]` to another backend gets FPM's 404, and no victim code runs.
**Re-measured:**
| run | result |
|---|---|
| `:443` matrix, new image + #362 | every probe closed; compat ok (the CI4 404 is pre-existing on main) |
| WHP harness, new image | PASS 67 |
| WHP harness, `:latest` | PASS 54 + loud CRITICAL notes for the `:443` residual that needs the image |
| in-flight branch harness, new image | PASS 69 |
| in-repo test (#62) | PASS 40 |
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
A tenant's NESTED <If> in .htaccess is merged after every section a vhost
or the server-scope drop-in can use, so it overrides any config-only
SCRIPT_FILENAME / DOCUMENT_ROOT / PHP_VALUE pin. Measured on httpd
2.4.63-13.el10_2.8: `<If "true"><If "true"> ProxyFCGISetEnvIf "true"
SCRIPT_FILENAME "/home/<victim>/..." </If></If>` plus `RewriteRule ...
fcgi://<victim>-01:9000/... [P]` ran the other tenant's script as its uid
(also <If><If><If>, <Files><If><If> SetHandler "proxy:fcgi://", a nested
<ElseIf>, a nested PATH_TRANSLATED, the victim's IP); [P] to http/ws/ajp
reached any host (SSRF); a nested <If> `SetHandler balancer-manager` served
the balancer manager.
New loadable module (stock Alma httpd, built against httpd-devel like
mod_whp_symlink in #60, separate source so the two can merge independently):
- mod_proxy scheme_handler hook (APR_HOOK_REALLY_FIRST): after all config
merging, mod_rewrite and balancer member selection, the connection target
(UDS path or scheme://host:port) must be on the vhost's WHPProxyAllow
list, else 403 before a byte is sent. Every proxy scheme is covered.
- WHPHtaccessProxyFCGI Deny: ProxyFCGISetEnvIf / ProxyFCGIBackendType in
.htaccess (any nesting) is a config error, so the vhost's own rules stay
the last word in mod_proxy_fcgi's fix_cgivars.
- WHPProxyScrubEnv: tenant-set PHP_VALUE / PHP_ADMIN_VALUE /
PATH_TRANSLATED removed before the backend params are built.
- WHPDenyHandler: 403 for balancer-manager, server-status, server-info,
lua-script, cgi-script (+ their MIME aliases) whatever selected them.
Image defaults (configs/whp-proxy-guard.conf): Deny, scrub, default allow
list fcgi://*:9000 (every WHP-rendered PHP handler), deny list. WHP renders
a per-vhost exact list inside <IfModule whp_proxy_guard_module>.
scripts/tests/whp-proxy-guard-module.test.sh: 36 assertions, PASS on the
built image, 24 FAIL on the current shared-httpd:latest.
DRAFT - DO NOT MERGE (merging publishes the image).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
Review of WHP #362: the per-site :80 vhost redirected only its PRIMARY name,
so an alias host on :80 (reachable from the shared docker network; the edge
uses :443 only) was served with the tenant .htaccess and none of the :443
FastCGI pins. Measured on the current image: plain, <If> and nested
ProxyFCGISetEnvIf + [P] to another tenant's backend all ran its script there,
and with only the inherited fcgi://*:9000 default a [P] still ran the other
tenant's index.php.
- WHPProxyRequireTLS On (image default): no proxying for a request that did
not arrive over TLS (ap_ssl_conn_is_ssl). Closes :80 for vhosts rendered
before WHP's unconditional redirect.
- WHPProxyRequireVhostList On|Off (image default Off): a vhost without its
OWN WHPProxyAllow may not proxy; an inherited list does not count. Off in
the image because hosts carry pre-#362 renders; WHP turns it on once every
vhost renders its own list.
- `WHPProxyAllow None` now resets the list; clearer refusal log lines.
- In-repo test: 40 assertions (plain-HTTP refusal, RequireVhostList with
and without an own list).
DRAFT - DO NOT MERGE.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
Fork-PR guard request (Josh decision 2026-11-23: PRs from forks require maintainer approval for CI).
If this PR adds or modifies any workflow with a pull_request trigger (for example shared-httpd-symlink-pr.yaml in #60), please add this to every job before merge:
if:github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository\n```\n\n(combine with `(...) && (existing condition)` if a job already has an `if`). Also:no `pull_request_target` with checkout of PR code, and no secrets in PR-triggered jobs. Reference change:whp#365. Maintainers run CI for a fork PR by approving the run on the PR page or by pushing the branch into this repo. If the PR touches no workflow, ignore this.
Fork-PR guard request (Josh decision 2026-11-23: PRs from forks require maintainer approval for CI).
If this PR adds or modifies any workflow with a `pull_request` trigger (for example `shared-httpd-symlink-pr.yaml` in #60), please add this to every job before merge:
```yaml
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository\n```\n\n(combine with `(...) && (existing condition)` if a job already has an `if`). Also: no `pull_request_target` with checkout of PR code, and no secrets in PR-triggered jobs. Reference change: whp #365. Maintainers run CI for a fork PR by approving the run on the PR page or by pushing the branch into this repo. If the PR touches no workflow, ignore this.
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
DRAFT, DO NOT MERGE: merging publishes the shared-httpd image to production. Everything below was measured locally in docker (two tenants, different uids, real cac-fpm:php83 backends). No host was touched.
Problem
PR #353 in WHP pins SCRIPT_FILENAME / DOCUMENT_ROOT and drops PHP_VALUE / PHP_ADMIN_VALUE in a per-vhost
<Location "/">. A tenant.htaccesssection nested inside another<If>is merged after every section a vhost or a server-scope drop-in can use, so those pins can always be overridden. Measured on httpd 2.4.63-13.el10_2.8 (shared-httpd:latest), where the victim'sadmin.phpran as the victim's uid:<If "true"><If "true"> ProxyFCGISetEnvIf "true" SCRIPT_FILENAME "/home/b/..." </If></If>+RewriteRule ^go$ fcgi://b.test-01:9000/... [P]<If><If><If>,<If><If "false"></If><ElseIf "true">,<Files><If><If> SetHandler "proxy:fcgi://b...", nestedPATH_TRANSLATED+REDIRECT_URL, and the victim backend's IP address instead of its name<If>copy of the pins yet), a single<If>,<ElseIf>and<Files><If>also work, and so doesSetEnv PATH_TRANSLATED+REDIRECT_URL.The same merge-order problem also leaves the following open:
[P]/SetHandler "proxy:http://..."to any host is proxied (SSRF). Measured with http, ws and ajp.<If>SetHandler balancer-managerserves the balancer manager. mod_proxy_balancer cannot be removed, because multi-container sites use balancers.[H=server-status]and[H=lua-script]still work.Root cause: hook order
mod_proxy_fcgi applies
ProxyFCGISetEnvIfrules infix_cgivars(), inside its own scheme handler, right afterap_add_cgi_vars()and immediately before sending the params. It reads them from the merged per-dir config. Its merge function appends the override's rules to the base's (apr_array_append(base, over)). Tenant<If>sections are merged last, so a tenant rule is the last one applied. No server section can come after it. Only code that runs after the merge can decide.Design:
src/mod_whp_proxy_guard/mod_whp_proxy_guard.cThis is a separate module from #60's mod_whp_symlink, so either can merge first. It has its own build stage,
modbuild-proxyguard. Both PRs editDockerfile.shared-httpd, so whichever lands second needs a trivial rebase.scheme_handlerhook atAPR_HOOK_REALLY_FIRST. It runs once per backend attempt, after all per-dir merging, mod_rewrite and balancer member selection (the URL has already been rewritten to the member), and before any scheme handler opens a connection. The target is taken from the same places mod_proxy takes it: the worker's or the request's UDS path, otherwiseapr_uri_parse()of the URL. It must be on the vhost'sWHPProxyAllowlist (scheme://host[:port],scheme://*:port,unix:/path,None); otherwise the request gets a 403. Every scheme is covered.WHPHtaccessProxyFCGI Deny. The module declaresProxyFCGISetEnvIf/ProxyFCGIBackendTypeitself, so it is invoked before mod_proxy_fcgi. This is the same mechanism as #60'sOptionsremap. It returns an error in.htaccesscontext, at any nesting depth, andDECLINE_CMDeverywhere else. With no tenant rule left in the array, the vhost's pins are the last word again. The fleet scan of 2026-11-23 found 0.htaccessfiles using these directives.WHPProxyScrubEnv. UnsetsPHP_VALUE PHP_ADMIN_VALUE PATH_TRANSLATEDfromr->subprocess_envin the same hook, so anything a tenant set with SetEnv, SetEnvIf or[E=]is gone. mod_proxy_fcgi then re-adds the real PATH_TRANSLATED for PATH_INFO and applies the server-config rules.WHPDenyHandler. A handler hook atREALLY_FIRSTreturns 403 for the listed handler names, whatever chose them. Image list: balancer-manager, server-status, application/x-httpd-status, server-info, lua-script, cgi-script, application/x-httpd-cgi.Image defaults (
configs/whp-proxy-guard.conf):WHPHtaccessProxyFCGI DenyWHPProxyAllow fcgi://*:9000+WHPProxyGuard On. Every WHP-rendered PHP handler is fcgi on port 9000, so old WHP renders keep working.The WHP draft PR renders an exact per-vhost list (
WHPProxyAllow "fcgi://<site>-01:9000" ...) inside<IfModule whp_proxy_guard_module>.Measured matrix (
proxy-matrix.sh)Columns:
<If>SF + [P]<If><If>SF + [P]<If><If><If><If><If false><ElseIf><Files><If><If> SetHandler proxy:fcgi://B<If><If>PATH_TRANSLATED+REDIRECT_URL<If><If>SF + [P] to B's IP<If><If>ProxyFCGISetEnvIf PHP_VALUE (worker poisoning)<If><If>SetHandler proxy:http://<If><If>SetHandler balancer-manager<If>cgi-scriptCompat, all 200 on every image-plus-config combination:
/index.phpand/, alias host, direct PATH_INFOSetHandler none/default-handler)*.w.testOther suites, run against this image:
test-shared-httpd-tenant-isolation.shon the in-flight branch: PASS 69 (every residual note flips to "now closed").scripts/tests/whp-proxy-guard-module.test.sh(in this PR): PASS 36 on this image, 24 FAIL on shared-httpd:latest.Before un-drafting
scripts/tests/whp-proxy-guard-module.test.shinto CIapr_uri_parseplus a few string compares per proxied request (not measured)Rollout
whp_proxy_guard:(any 403 on legitimate traffic would show there).The WHP per-vhost list needs a separate WHP release. Without it, every vhost gets the
fcgi://*:9000default, which already closes everything in the table except a tenant[P]to another tenant's fcgi:9000 with pinned params, and that request gets FPM's 404 (no victim code runs).Update 2026-11-23: port-80 review finding (HIGH), fixed in both PRs
Finding. The per-site
:80vhost redirected only whenSERVER_NAMEwas the primary name. An alias host on:80was served from the docroot, with the tenant.htaccessevaluated and none of the:443FastCGI pins or allow list.:80. The edge never sends:80traffic here: haproxytlsServersuses shared-httpd on 443 only, and the edge answers ACME http-01 itself. But:80is reachable from the sharedclient-netdocker network (the container publishes no ports).:80alias host:<If>and every nested ProxyFCGISetEnvIf +[P]shape ran tenant B's script.phpcame back as source:80: thefcgi://*:9000default still let[P]run B's index.php. Nothing pins SCRIPT_FILENAME on:80.Fix:
:80vhost redirect is now unconditional (no RewriteCond). It is a server-context rewrite in the translate phase, so no.htaccessis ever read on:80. The vhost also getsWHPProxyAllow Noneinside<IfModule>. Measured: every:80probe answers 301 on both the old image and the new one. The goldens andisolation_testpin this shape. The docker harness now renders an alias and asserts 301 for the primary and the alias on:80.WHPProxyRequireTLS On(image default). There is no proxying for a request that did not arrive over TLS. This closes:80for vhosts rendered before the template change. Measured: old template on the new image, every:80proxy probe is refused.WHPProxyRequireVhostList On|Offgives fail-closed behaviour for vhosts without their ownWHPProxyAllow; an inherited list does not count. It is Off in the image and is not set by #362. Hosts carry pre-#362 renders, and the drop-in is converged on every single-site apply, so turning it on now would cut off PHP for every not-yet-re-rendered vhost until the sweep reached it. A follow-up WHP release should switch it On in the drop-in once the fleet re-render has converged everywhere. The default catch-all vhost and the:80vhosts never proxy, so they are not affected. Until then, thefcgi://*:9000default applies only to old:443renders, which still carry the #353 pins: a[P]to another backend gets FPM's 404, and no victim code runs.Re-measured:
:443matrix, new image + #362:latest:443residual that needs the image🤖 Generated with Claude Code
https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
Fork-PR guard request (Josh decision 2026-11-23: PRs from forks require maintainer approval for CI).
If this PR adds or modifies any workflow with a
pull_requesttrigger (for exampleshared-httpd-symlink-pr.yamlin #60), please add this to every job before merge:View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.