Skip to main content
# Tarsafe
![Unit Tests](https://github.com/beatsbears/tarsafe/workflows/Unit%20Tests/badge.svg)

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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tarsafe-0.0.6-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

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

Hashes for tarsafe-0.0.6.tar.gz
Algorithm Hash digest
SHA256 1636ed0a0ae4995862dbc647cf6e4ba49724d045f125f9d952216089a4bd6c79
MD5 9828fe0076dcddced831e47b78568fce
BLAKE2b-256 50636597b324a5709a6363e11850d2935a54fa9f926c50719a4060aca2229427

See more details on using hashes here.

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

Hashes for tarsafe-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f6724cd2482c574933db91b5edf2fe13bb5accafed686c2874d95ccef01d3f34
MD5 b0fe2c001821ed239d3f4b37aa91438e
BLAKE2b-256 76b2fd3baf55fbffda1d9ce1219acf91104a869d31ce55b2ecbf744c03f1aa55

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page