Repository navigation
fix(cli): route --*clude-from and merge-file opens through the ownership walk - #7426
Merged
Merged
Conversation
…hip walk
upstream exclude.c:1683 opens every filter file named by a rule or by
--exclude-from/--include-from with open_no_attacker_symlinks(), which walks
each component with O_NOFOLLOW and follows a symlink only when its owner is
root or our euid (syscall.c:406). oc's two CLI-side filter-file opens used a
plain File::open, so a component symlink planted by another uid was followed.
Both sites are fatal on open failure upstream (exclude.c:1587 passes
XFLG_FATAL_ERRORS), so a refusal needs no new arm - it reports through the
existing "failed to open {in,ex}clude file" path, exactly as any other
fp == NULL does.
The cfg(unix) split stays at the call site rather than moving behind a
cross-platform fast_io export: an implicit File::open fallback would make the
absence of this control on non-Unix invisible to a reader of the function.
Flips excludefrom-symlink to pass in the root pipe manifest. The nonroot leg
records it skip (the cell needs root to plant a cross-uid symlink) and the TCP
legs do not carry it, so those manifests are unchanged.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…7477) The docs were last refreshed at #7423; 55 PRs have merged since, and the testsuite figures they quote had drifted far enough to understate the current state by roughly half. CHANGELOG: fill in Unreleased for everything merged since #7423. The dominant theme is routing every operator-named auxiliary file open onto the ownership walk - upstream's open_no_attacker_symlinks() applied at the call sites upstream applies it - plus a daemon hardening batch and an alt-dest correctness batch. README and SECURITY: the per-leg outcome tables were re-derived from the committed expect manifests rather than carried forward. Failures fell and the corpus grew, so every figure moved: non-root pipe 43 -> 21 fail (345 -> 349 corpus) root pipe 62 -> 29 fail (345 -> 349 corpus) non-root tcp 42 -> 29 fail (155 -> 158 corpus) root tcp 55 -> 38 fail (155 -> 158 corpus) Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55 across all four. SECURITY, two CVE rows that had gone stale: - CVE-2026-53790 said "under audit". The refusal has since been applied at the live sink - oc-rsync's own single-character config expander, which upstream does not have, so an upstream-shaped port alone would have been inert (#7465, #7430, #7445). - CVE-2026-53795 listed only the staging family. The auxiliary-file family followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459, #7463); what remains is the per-option-family confinement.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…hip walk (#7426) upstream exclude.c:1683 opens every filter file named by a rule or by --exclude-from/--include-from with open_no_attacker_symlinks(), which walks each component with O_NOFOLLOW and follows a symlink only when its owner is root or our euid (syscall.c:406). oc's two CLI-side filter-file opens used a plain File::open, so a component symlink planted by another uid was followed. Both sites are fatal on open failure upstream (exclude.c:1587 passes XFLG_FATAL_ERRORS), so a refusal needs no new arm - it reports through the existing "failed to open {in,ex}clude file" path, exactly as any other fp == NULL does. The cfg(unix) split stays at the call site rather than moving behind a cross-platform fast_io export: an implicit File::open fallback would make the absence of this control on non-Unix invisible to a reader of the function. Flips excludefrom-symlink to pass in the root pipe manifest. The nonroot leg records it skip (the cell needs root to plant a cross-uid symlink) and the TCP legs do not carry it, so those manifests are unchanged.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…7477) The docs were last refreshed at #7423; 55 PRs have merged since, and the testsuite figures they quote had drifted far enough to understate the current state by roughly half. CHANGELOG: fill in Unreleased for everything merged since #7423. The dominant theme is routing every operator-named auxiliary file open onto the ownership walk - upstream's open_no_attacker_symlinks() applied at the call sites upstream applies it - plus a daemon hardening batch and an alt-dest correctness batch. README and SECURITY: the per-leg outcome tables were re-derived from the committed expect manifests rather than carried forward. Failures fell and the corpus grew, so every figure moved: non-root pipe 43 -> 21 fail (345 -> 349 corpus) root pipe 62 -> 29 fail (345 -> 349 corpus) non-root tcp 42 -> 29 fail (155 -> 158 corpus) root tcp 55 -> 38 fail (155 -> 158 corpus) Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55 across all four. SECURITY, two CVE rows that had gone stale: - CVE-2026-53790 said "under audit". The refusal has since been applied at the live sink - oc-rsync's own single-character config expander, which upstream does not have, so an upstream-shaped port alone would have been inert (#7465, #7430, #7445). - CVE-2026-53795 listed only the staging family. The auxiliary-file family followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459, #7463); what remains is the per-option-family confinement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream opens every filter file through
open_no_attacker_symlinks()(
exclude.c:1683), which walks each path component withO_NOFOLLOWandfollows a symlink only when its owner is root or our euid (
syscall.c:406).oc's two CLI-side filter-file opens used a plain
File::open, so a componentsymlink planted by another uid was followed. That is the
excludefrom-symlinkcell of the upstream 3.5.0 testsuite.
Change
Both sites in
crates/cli/src/frontend/filter_rules/sources.rsnow openthrough one seam backed by
fast_io::operator_open_read(oc's existing,already-tested port of the upstream primitive):
load_filter_file_patterns---exclude-from/--include-fromread_merge_file- amerge/.rule's fileUpstream fidelity notes
A refusal needs no new error arm. Upstream reaches one
if (!fp)block forevery open failure, and this call site passes
XFLG_FATAL_ERRORS(
exclude.c:1587), so the failure is fatal either way. A refused open reportsthrough the existing "failed to open {in,ex}clude file" path unchanged. This is
deliberately unlike the per-directory merge loaders, which upstream runs
without
XFLG_FATAL_ERRORSand therefore skips silently.Confinement is a separate, non-uniform decision - not applied here. Upstream
has two orthogonal protections, and
syscall.c:185-240is explicit that theycover different option sets: the ownership walk applies to all aux files, while
operator_path_resolveroot-confinement covers only--partial-dir/--backup-dir/alt-basis/merge paths ---log-file,--*-from,lock and motd "may legitimately live elsewhere". This PR ships the walk only.
Composing the module-root half is tracked separately; a blanket application
would create a new divergence.
The
cfg(unix)split stays at the call site.fast_io::owner_walkisUnix-only. Hiding the fallback behind a cross-platform export would turn a
security control into a silent
File::openon Windows; spelling thecfgherekeeps that visible.
Verification
clifilter/merge suite 26/26 green.cargo fmt --all -- --checkclean;clippy -p cli --all-targets --all-features -D warningsclean.excludefrom-symlinkfail->passin the root pipe leg, in thiscommit. Row count still 345. The nonroot leg records the cell
skip(it needsroot to plant a cross-uid symlink) and the TCP legs do not carry it, so those
three manifests are untouched.
Limit of the local test, stated plainly. The added test
(
a_self_owned_symlink_to_a_filter_file_is_still_read) pins the over-refusaldirection - a symlink we own must still be followed. It does not
discriminate the fix: mutating the seam back to
File::openleaves it green,because on a single-uid non-root machine the two are behaviourally identical for
every constructible fixture. The refusal itself is proven only by the root
testsuite leg in CI, which plants the cross-uid symlink. Recording this rather
than implying the unit test proves the routing.