Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xvol allows symlinks to escape the root #24

Closed
seanmcveigh opened this issue Apr 29, 2023 · 4 comments
Closed

xvol allows symlinks to escape the root #24

seanmcveigh opened this issue Apr 29, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@seanmcveigh
Copy link

not sure if this is design intent or not, but I am able to escape from a volume root via symlinks...

I created a symlink in ~/test pointing to ../../../backup.
cd ~/test && ln -s ../../../backup backup

Then I started copyparty in ~/test using the following args:
copyparty -a foo:bar -v .::r:rwdm,foo:c,xvol

I am able to see the backup folder in my root and can follow the symlink and escape from the volume root. This is also reproducible with absolute symlinks like:
cd ~/test && ln -s /backup backup

version info:
running on ubuntu 18.04 LTS
copyparty v1.6.15 "cors k" (2023-04-26)
CPython v3.6.9 on Linux64 [GCC 8.4.0]
sqlite v3.22.0*1 | jinja2 v3.0.3 | pyftpd v(None)

@seanmcveigh seanmcveigh added the bug Something isn't working label Apr 29, 2023
@seanmcveigh
Copy link
Author

as an addendum, xdev does not stop me from following a link to another device as well:
cd ~/test && ln -s /mnt/another/disk disk

I can see disk/ in my root, and can navigate into it.

@9001
Copy link
Owner

9001 commented Apr 29, 2023

Good call -- both xvol and xdev currently only affect the filesystem indexer, which I notice is not very well documented. Sorry!

The reason they don't apply at runtime was mostly due to performance, but in hindsight it would be worth it in exchange for much more intuitive behavior. So that will probably change :>

However, symlinks by default being permitted to leave volumes is intentional, as a common usecase is people sharing folders in their home by symlinking them from /var/www or similar. Maybe it would make sense to have an allowlist/denylist of filesystem locations to permit access to... I'll think about it for a bit 👍

@9001 9001 closed this as completed in 544e054 Apr 29, 2023
@9001
Copy link
Owner

9001 commented Apr 29, 2023

Alright -- version 1.7.0 is up, hopefully fixing both this and #23 -- let me know if you run into any issues :>

Ended up not adding the allowlist/denylist after all; those usecases can probably be covered well enough with volumes as it is.

@seanmcveigh
Copy link
Author

thanks for the quick attention :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants