Files
rsync/testsuite/chroot-receiver-write-inner-module_test.py
Andrew TridgellandOmar Elsayed 4705b6fb92 testsuite: symlink-race and operator/peer path-resolution coverage
The TOCTOU / symlink-race suite for the secure resolver and operator-supplied
paths: chdir/chmod/rename/mknod/source/dest symlink races, relative make_path and
symlinked-parent cases, the operator-path matrix (--temp/partial/backup-dir,
alt-dest basis, files-from, log-file, insecure-links), and the admin-file opens
(--password-file / daemon secrets / config / log-file / early-input symlinks),
plus the daemon module-confinement and chroot inner-module cases.

Co-authored-by: Omar Elsayed <omarelsayed161@gmail.com>
2026-07-20 14:05:31 +10:00

11 lines
537 B
Python

#!/usr/bin/env python3
from rsyncfns import run_checked, setup_chroot_inner
from rsyncfns import rsync_argv, test_fail
base, inner, outside, src, url = setup_chroot_inner('chroot-write-inner')
(src / 'pwn').write_text('payload\n')
proc, out = run_checked(rsync_argv('-a', str(src / 'pwn'), f'{url}mod/linkparent/pwn'))
if (outside / 'pwn').exists():
test_fail(f"receiver write escaped inner module through symlinked parent:\n{out}")
print("chroot-receiver-write-inner-module: symlinked parent did not publish outside inner module")