Repository navigation
Conversation
Middle ground between contain_symlinks (default, strict) and
no_contain_symlinks (permissive). Allows relative symlinks whose
target lexically resolves within sshfs.base_path while rejecting
anything that escapes. The motivating case:
share/bar/fizz -> ../foo/yada # allowed: stays inside the share
share/link -> ../../etc/passwd # EPERM: escapes the share
Absolute targets are always rejected: the kernel resolves them on
the local filesystem, not via FUSE, so even an in-base absolute path
could expose local files. Combine with transform_symlinks to handle
absolute in-base remote symlinks safely (transform runs first,
converting them to relative form before the inside check).
sshfs_readlink() has two separate branches for follow_inside_symlinks
and the existing contain_symlinks logic. New tests cover the
motivating case, deep nesting, escapes, and the transform interaction.
Refs: libfuse#378
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Note while I reference #378 this does not exactly implement what that was asking for; this only does "allow symlinks if they resolve to within the same sshfs share". |
|
@h4sh5 requesting a review please, thanks! |
|
I'm not reviewing the implementation details in this comment. I just stumbled across this patch while looking for basically this feature. However, based on the description and consistency with the existing option names, I think this should feature set should be named
Based on those other option names, I would expect that:
|
|
I don't care much what this is called, that said, your suggestions don't make sense to me. How about just The default behavior is to disallow any symlink with a This patch adds the option to permit symlinks that contain Why is
Or |
|
@hlein, I'm not stuck on any particular names. However, I strongly believe that names should use consistent terminology within a project to avoid confusion. sshfs (for better or worse) has an established history of
All that said, I am not an sshfs maintainer and can't sign off on anything. I was just pointing out some likely confusion that I saw when I stumbled across this patch. |
Understood - you talked me out of |
Middle ground between contain_symlinks (default, strict) and no_contain_symlinks (permissive). Allows relative symlinks whose target lexically resolves within sshfs.base_path while rejecting anything that escapes. The motivating case:
Absolute targets are always rejected: the kernel resolves them on the local filesystem, not via FUSE, so even an in-base absolute path could expose local files. Combine with transform_symlinks to handle absolute in-base remote symlinks safely (transform runs first, converting them to relative form before the inside check).
sshfs_readlink() has two separate branches for follow_inside_symlinks and the existing contain_symlinks logic. New tests cover the motivating case, deep nesting, escapes, and the transform interaction.
Refs: #378