It's acceptable for a tarball to have a symlink at a/b/c/foo.txt that points to ../../../foo.txt (see legal_symlink_dots.tar), because that symlink "stays within" the archive. However, it should be illegal for the same symlink to point to ../../../../foo.txt (see illegal_symlink_dots.tar), because that symlink "reaches outside" the archive. Similarly, it should always be illegal for a tarball to hold a symlink pointing to an absolute path.
Add validation and tests cases for these behaviors.
It's acceptable for a tarball to have a symlink at
a/b/c/foo.txt
that points to../../../foo.txt
(seelegal_symlink_dots.tar
), because that symlink "stays within" the archive. However, it should be illegal for the same symlink to point to../../../../foo.txt
(seeillegal_symlink_dots.tar
), because that symlink "reaches outside" the archive. Similarly, it should always be illegal for a tarball to hold a symlink pointing to an absolute path.Add validation and tests cases for these behaviors.
TODO: Can zip archives hold symlinks?