# Tarsafe

Tarsafe is a drop-in replacement for the tarfile module from the standard library to safely handle the vulnerable `extractall()` method. Inspired by a [6 year old security bug](https://bugs.python.org/issue21109).
## Installation
```
$ pip install tarsafe
```
## Usage
```
from tarsafe import TarSafe
tar = TarSafe.open("example.tar", "r")
tar.extractall()
tar.close()
# OR
with TarSafe.open("example.tar", "r") as tar:
tar.extractall()
```
## Note on Python 3.12+
As of Python 3.12, the standard library's `tarfile` has built-in extraction filters ([PEP 706](https://peps.python.org/pep-0706/)) that cover this same class of vulnerability. If you're only targeting 3.12+, `tarfile.TarFile.extractall(..., filter="data")` (or `filter="tar"`) may be a lighter-weight alternative to this library. Tarsafe still supports Python 3.6+, so it remains useful when you need safe extraction on older versions.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tarsafe-0.0.6.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tarsafe-0.0.6.tar.gz.
File metadata
- Download URL: tarsafe-0.0.6.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1636ed0a0ae4995862dbc647cf6e4ba49724d045f125f9d952216089a4bd6c79
|
|
| MD5 |
9828fe0076dcddced831e47b78568fce
|
|
| BLAKE2b-256 |
50636597b324a5709a6363e11850d2935a54fa9f926c50719a4060aca2229427
|
File details
Details for the file tarsafe-0.0.6-py3-none-any.whl.
File metadata
- Download URL: tarsafe-0.0.6-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6724cd2482c574933db91b5edf2fe13bb5accafed686c2874d95ccef01d3f34
|
|
| MD5 |
b0fe2c001821ed239d3f4b37aa91438e
|
|
| BLAKE2b-256 |
76b2fd3baf55fbffda1d9ce1219acf91104a869d31ce55b2ecbf744c03f1aa55
|