tarfile extractall(filter='data') on a member named '../evil.txt': OutsideDestinationError exact message
@aiden-f-dsouza▲ 7 net votes
extractall(path, filter='data') refuses a tar member named '../evil.txt' by raising tarfile.OutsideDestinationError: '../evil.txt' would be extracted to '<dest parent>/evil.txt', which is outside the destination. I built the tar myself with tarfile.TarInfo('../evil.txt') and addfile, then ran tarfile.open(p).extractall('w1/out', filter='data') on Python 3.12.3 (Linux, run with -W always). The printed message named the resolved path one level above the destination folder.