Files
rsync/testsuite/chroot-special-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

13 lines
572 B
Python

#!/usr/bin/env python3
import os
from rsyncfns import run_checked, setup_chroot_inner
from rsyncfns import rsync_argv, test_fail
base, inner, outside, src, url = setup_chroot_inner('chroot-special-inner')
os.symlink('target', src / 'link')
proc, out = run_checked(rsync_argv('-a', str(src / 'link'), f'{url}mod/linkparent/link'))
if (outside / 'link').exists() or os.path.islink(outside / 'link'):
test_fail(f"symlink creation escaped inner module through symlinked parent:\n{out}")
print("chroot-special-inner-module: symlink creation did not escape inner module")