review(mod_whp_symlink): no uninitialised uid in the guard log; document guard gaps; container probes
- guard_filter logged fi.user uninitialised when fstat of the served fd failed (refusal itself was already fail-closed); now -1. - Drop the unused guard_ctx.checked_ok. - Header: state what the fd guard cannot see (no FILE bucket): 304 to a conditional request (confirms a wrong-owner target's ETag, measured), mod_autoindex listings (a swapped public_html still lists the other tenant's directory names with guard On and no WHP <Directory /mnt/users> fix, measured), PHP via FPM. - whp-symlink-module.test.sh: Options inside nested <If>, <ElseIf>, <Else>, <Files>+<If>, <FilesMatch>, <IfModule>/<IfDefine>/<IfVersion>, <Limit>, mod_macro expansion, backslash line continuation; and a tenant .htaccess setting WHPOwnerGuard / WHPHtaccessOptionsRemap (also inside <If>) must 500. 100/100 against the rebuilt image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
1 parent
31e42ecbc2
commit
1953a176f5
2 files changed
+45
-1
No files matched your search
@@ -38,6 +38,12 @@
|
||||
* mismatch is logged and (On) answered 404, like the Bluehost patch.
|
||||
* Closes the check-then-open symlink race of SymLinksIfOwnerMatch for
|
||||
* static files (and any other handler that sends FILE buckets).
|
||||
* Not covered, because no FILE bucket is sent: a 304 Not Modified to a
|
||||
* conditional request (its ETag/Last-Modified come from the walk-time
|
||||
* stat, so a wrong-owner target is confirmed, not read), mod_autoindex
|
||||
* listings (names only), and PHP (read by the tenant's own FPM). The
|
||||
* swapped-public_html listing needs WHP's <Directory "/mnt/users">
|
||||
* Options SymLinksIfOwnerMatch; the guard alone does not close it.
|
||||
*
|
||||
* 3. WHPSymlinkWalk Off|Log|On (+ WHPOwnerGuardRoot <prefix>)
|
||||
* Prototype of "re-implement SymLinksIfOwnerMatch after the walk": a
|
||||
@@ -315,7 +321,6 @@ static int under_root(const whp_dir_conf *dc, const char *f)
|
||||
/* 2. Owner guard on the served file descriptor */
|
||||
|
||||
typedef struct {
|
||||
int checked_ok;
|
||||
uid_t owner;
|
||||
int have_owner;
|
||||
} guard_ctx;
|
||||
@@ -353,6 +358,8 @@ static apr_status_t guard_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
||||
if (!APR_BUCKET_IS_FILE(b))
|
||||
continue;
|
||||
fb = b->data;
|
||||
/* logged below even when fstat fails: never print stack garbage */
|
||||
fi.user = (apr_uid_t)-1;
|
||||
if (apr_file_info_get(&fi, APR_FINFO_USER, fb->fd) != APR_SUCCESS
|
||||
|| !ctx->have_owner || fi.user != ctx->owner) {
|
||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||
|
||||
Reference in new issue
Block a user