Skip to content

test: pin hostname ACL resolution before chroot per GHSA-rjfm-3w2m-jf4f - #5533

Merged
oferchen merged 2 commits into
masterfrom
fix/uts-22b-chroot-hostname-acl
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/uts-22b-chroot-hostname-acl

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Adds a single regression test pinning Scenario B of upstream's
testsuite/daemon-chroot-acl.test for GHSA-rjfm-3w2m-jf4f /
CVE-2026-43617: a daemon module with use chroot = yes and a
hostname-based hosts allow rule must refuse a connection whose
reverse DNS fails post-chroot, instead of falling through to an
allowed-by-default state.

Why this is just a test

The GHSA fix landed in #5524 (commit 50f389f50), which targets the
hosts deny direction with an explicit fail-closed guard in
ModuleDefinition::permits(). The hosts allow direction is already
structurally fail-closed because HostPattern::Hostname(_)::matches
returns false when the peer hostname is None, so a hostname-only
allow list cannot be satisfied by an unresolvable peer and permits()
returns false on the empty-allow-match branch.

The existing chunk module_peer_hostname_resolution_before_chroot_denies_unknown
covers the same property, but it is named for the CVE rather than for
the upstream-testsuite scenario, and pairs poorly with
module_hostname_deny_fails_closed_when_dns_unresolved, which is
explicitly named after Scenario A. This PR adds a Scenario B mirror so
the two upstream-test scenarios are pinned with matching names and
matching docblock structure; future refactors of permits() cannot
accidentally introduce an allowed-by-default path for the allow-side
without flipping a clearly-labeled regression test.

Upstream reference

  • clientserver.c (upstream rsync 3.4.3, commit
    c38f20c5)
    moves reverse DNS before chroot/setuid so client_name() returns a
    real hostname at ACL evaluation time. oc-rsync's module-access path
    (module_access::request.rs::process_module_request()) resolves the
    hostname before apply_module_privilege_restrictions() enters
    the per-module chroot; the matcher returns false whenever the
    hostname is None, so a hostname-only hosts allow rule refuses
    the connection.
  • testsuite/daemon-chroot-acl.test Scenario B: use chroot = yes +
    hosts allow = <hostname> + DNS fail -> refuse.

Scope

  • Test-only addition. No production code changes.
  • No wire-protocol changes.
  • No crates/branding/ changes.
  • No effect on parallel-receive-delta, io_uring, IOCP, flat-flist,
    daemon-tls, DirSandbox, SEND_ZC, or flat arena flist.
  • Daemon #![deny(unsafe_code)] preserved; no clippy waivers.

Test plan

  • CI fmt + clippy green
  • CI nextest green (Linux GNU, Linux musl, macOS, Windows)

Adds a regression test mirroring Scenario B of upstream's
`testsuite/daemon-chroot-acl.test`: with `use chroot = yes` and a
hostname-pattern `hosts allow` rule, a connection whose reverse DNS
fails post-chroot must be refused (not admitted by default).

The deny-side bypass (Scenario A) was fixed and pinned by the
fail-closed guard in `permits()` (commit 50f389f); the allow-side is
already structurally fail-closed because a `Hostname(_)` pattern
returns `false` when the peer hostname is `None`, so a hostname-only
allow list cannot be satisfied by an unresolvable peer. This test
locks that property in so future refactors of `permits()` cannot
accidentally introduce an allowed-by-default path for the allow-side.
@github-actions github-actions Bot added the test label Jun 10, 2026
@oferchen
oferchen merged commit fd6cc51 into master Jun 10, 2026
69 checks passed
@oferchen
oferchen deleted the fix/uts-22b-chroot-hostname-acl branch June 10, 2026 10:29
oferchen added a commit that referenced this pull request Aug 24, 2026
… (#5533)

* test: pin hostname ACL resolution before chroot per GHSA-rjfm-3w2m-jf4f

Adds a regression test mirroring Scenario B of upstream's
`testsuite/daemon-chroot-acl.test`: with `use chroot = yes` and a
hostname-pattern `hosts allow` rule, a connection whose reverse DNS
fails post-chroot must be refused (not admitted by default).

The deny-side bypass (Scenario A) was fixed and pinned by the
fail-closed guard in `permits()` (commit 23f97c7); the allow-side is
already structurally fail-closed because a `Hostname(_)` pattern
returns `false` when the peer hostname is `None`, so a hostname-only
allow list cannot be satisfied by an unresolvable peer. This test
locks that property in so future refactors of `permits()` cannot
accidentally introduce an allowed-by-default path for the allow-side.

* fix: drop needless Option::as_deref in hostname ACL chroot test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant