safezipfile: A safe zipfile extract library for python
Summary
This library simply overrides the extractall method of the python ZipFile class
with additional checks to prevent zip-slip and zip-bomb attacks. It can be used the same
way as the usual extractall method but also accepts additional arguments to limit the number
of allowed files in the archive, limit the size of each extract file, the total extracted file
size and also the maximum allowed compression ratio (zip bombs have a very high compression ratio).
To make the base use case safe it already starts with some quite relaxed limits of:
- 500 files in a zip
- 1GB extracted file size
- 10GB total extracted file size
But they can all be configured:
import safezipfile
# Base use case
with safezipfile.ZipFile("test.zip", "r") as zf:
zf.extractall("./outdir")
# Or configure the limits
with safezipfile.ZipFile("test.zip", "r") as zf:
zf.extractall(
"./outdir",
max_files = 500,
max_file_size = 1 * 1024 * 1024 * 1024,
max_total_size = 10 * 1024 * 1024 * 1024,
max_compression_ratio = 150.0
)
Metadata
Release files for safezipfile 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| safezipfile-0.1.5.tar.gz | 5.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| safezipfile-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / safezipfile-0.1.5.tar.gz
| Download URL | safezipfile-0.1.5.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28d48ed22a72aac9144a720ed662d80be1f36f0eebf9230d65c563d62bb1fdc0
|
|
BLAKE2b-256 checksum How to use checksums |
2ec2ed54fbaaa9d9a454293403297b7916a55ed9a2184a3c0dd4880c732a6ed9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / safezipfile-0.1.5-py3-none-any.whl
| Download URL | safezipfile-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cc8ca7d71fa45a463d601d4423a30e3ca2c1684e3b9921c888c817950194cd72
|
|
BLAKE2b-256 checksum How to use checksums |
39890f12aef62a773a4703ca3bd4c06e3a5f7d4972f0725339e2596df86c8e3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for safezipfile 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.