Preserve nosymfollow across bind-mount flag fixups - #770
Conversation
Add a nosymfollow entry to decode_mountoptions so the flag is not dropped on a fixup remount. Added a regression test, binding a `nosymfollow` tmpfs read-only (therefore forcing a fixup remount) that fails if symlink is followed. Signed-off-by: Tomas Junnonen <tomas1@gmail.com>
1ab2a54 to
3579e14
Compare
|
This should be partially solved already by #756: if I understand correctly, we'll now preserve |
|
To force the test onto the fallback code path, you could do it twice, with and without Because of the way you've structured the test, if bubblewrap is compiled to require a modern kernel and not fall back if |
When bubblewrap binds a host mount that was mounted
nosymfollow(for example systemd credential mounts), the flag is silently cleared inside the sandbox whenever the bind triggers bubblewrap's flag-fixup remount.Example:
Expected: the sandbox refuses to follow the symlink (
ELOOP), just like the host.Actual: the sandbox prints
secret, asnosymfollowwas dropped.This happens because
decode_mountoptionsparses the mount's flags from/proc/self/mountinfothrough a table that has nonosymfollowentry. The fixup remount then passes only the decoded flags andnosymfollowis cleared. The fix is to add the table entry. A test entry for the case is also added to test-run.sh for good measure.