Skip to content

Enforce --confine-root on destination paths and update confinement tests - #1169

Open
seks99x wants to merge 1 commit into
RsyncProject:masterfrom
seks99x:fix-confine
Open

seks99x wants to merge 1 commit into
RsyncProject:masterfrom
seks99x:fix-confine

Conversation

@seks99x

@seks99x seks99x commented Nov 12, 2026

Copy link
Copy Markdown
Member

util1.c (change_dir): Enforced --confine-root validation when changing directories so a confined server cannot chdir() outside the restricted root via .. traversal or in-tree symlinks pointing to outside directories.

receiver.c (recv_files): Extended the inplace_partial open-failure check from am_daemon to (am_daemon || confine_root) so that if opening the destination file fails under --confine-root, the receiver fails closed immediately rather than falling back or retrying unsafely.

syscall.c: Narrowed the confine_root check on pseudo-paths to confine_root && (operator_path_resolve || filesfrom_owner_walk_active()) so confinement blocks only untrusted paths rather than trusted operator paths.

testsuite/rrsync-merge-file-confine_test.py: Routed confined_pull through a remote shell wrapper (-e alias_rsh) so --confine-root applies only to the server sender instead of leaking into the local client receiver via fork() and blocking writes to the test destination.

testsuite/rsync-pseudo-path.test: Updated Test 2 to assert that --log-file=>(...) succeeds under --confine-root={base_path}, reflecting that operator-supplied kernel pipe pseudo-paths (/dev/fd/N) are trusted and permitted.

testsuite/confine-root-dest-race.test: Added regression coverage verifying that static destination escapes (../, in-tree symlinks) and live parent-swap TOCTOU races are blocked under --confine-root.

Reported-by: karimabisaad@gmail.com

@seks99x

seks99x commented Nov 12, 2026 •

Copy link
Copy Markdown
Member Author

The sender/source is still not confined well. Only enforced under files-from. Confine-root is the same as a daemon tree and source should be also confined. Will push tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant