# 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.
Metadata
Release files for tarsafe 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tarsafe-0.0.6.tar.gz | 6.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tarsafe-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / tarsafe-0.0.6.tar.gz
| Download URL | tarsafe-0.0.6.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1636ed0a0ae4995862dbc647cf6e4ba49724d045f125f9d952216089a4bd6c79
|
|
BLAKE2b-256 checksum How to use checksums |
50636597b324a5709a6363e11850d2935a54fa9f926c50719a4060aca2229427
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / tarsafe-0.0.6-py3-none-any.whl
| Download URL | tarsafe-0.0.6-py3-none-any.whl |
|---|---|
| Size | 8.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f6724cd2482c574933db91b5edf2fe13bb5accafed686c2874d95ccef01d3f34
|
|
BLAKE2b-256 checksum How to use checksums |
76b2fd3baf55fbffda1d9ce1219acf91104a869d31ce55b2ecbf744c03f1aa55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|