HomeSoftware Heritage

Uncompress `safe` archive

Description

Uncompress safe archive

Check that, for one archive, no files are uncompressed outside of the
destination folder. If ok, the archive is considered safe.

If there are at least one, a ValueError is raised, thus stopping the
archive loading.

This follows reading the warning footnote in the tarfile.extractall api
https://docs.python.org/3.4/library/tarfile.html#tarfile.TarFile.extractall.

Note that the warning also exists for zipfile.extractall
(https://docs.python.org/3.4/library/zipfile.html#zipfile.ZipFile.extractall)
but is invalidated by the zipfile.extract api doc
(https://docs.python.org/3.4/library/zipfile.html#zipfile.ZipFile.extract)
and its implementation (extractall uses extract).

Details

Provenance
ardumontAuthored on
ardumontPushed on Nov 2 2015, 4:16 PM
Parents
rDLDTAR613ab626f468: Bump to swh-loader-dir 0.0.11
Branches
Unknown
Tags
Unknown