mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-09-15 06:41:28 -04:00
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>
13 lines
572 B
Python
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")
|