-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Improve zipfile: add support for symlinks #82102
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
Comments
The module tarfile contains some methods for knowing whether an archive member is a regular file/a directory/a symlink. Apart from an "is_dir()" method, there was nothing alike in the zipfile module. For an on-going project, I needed to know whether an archive member was a symlink or not, to prevent zip symlinks attacks. I thought this could be of used for other people, given I struggled a little to find a way of saying if an archive member is a symlink or not. This is why I think adding support for symlinks in the zipfile module could be a good idea. |
The PR went through review and has been awaiting core review for almost a month, anyone to have a look at it? :) |
If I understand correctly, Please see also https://bugs.python.org/issue27318 for a proposal to support symlinks while *unpacking* ZIP files. Maybe a preserve_symlinks optional argument should be added to the Anyway, I think symlink support should be added for packing *and* unpacking or not at all. |
Adding support of symlinks in ZIP files will make the zipfile module vulnerable to symlink attacks like like with TAR files (see https://en.wikipedia.org/wiki/Tar_(computing)#Duplicates). Until we find a solution to this, adding support of symlinks is dangerous. |
If symlink support is ever added to zipfile, it needs to be off by default for both zipfile creation and zipfile extraction. Getting extraction correct without security problems in the presence of symbolic links is extremely difficult. Even if you think you've done it... For example, see #88189 (comment) |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: