DataDog / guarddog

:snake: :mag: GuardDog is a CLI tool to Identify malicious PyPI and npm packages
https://securitylabs.datadoghq.com/articles/guarddog-identify-malicious-pypi-packages/
Apache License 2.0
585 stars 43 forks source link

Expand allowed tar archive compression algorithms #430

Closed ikretz closed 1 month ago

ikretz commented 1 month ago

This PR changes GuardDog so that bzip2 and xz compression are allowed when sourcing a package from a tar archive. It also permits all common file extensions for these (.bz2, .bzip2, .xz) as well as for gzip (.gz, .gzip), which was already allowed in this context.

For local files, the PR uses the validation functions provided by tarsafe and zipfile to introspect the file contents (as opposed to just looking at the extension) before attempting to extract.

Closes #427