On this page
tarfile.tar_filter
Prev: tarfile.StreamError | Up: tarfile | Next: tarfile.TarError
Rel: tarfile.AbsoluteLinkError, tarfile.AbsolutePathError, tarfile.CompressionError, tarfile.data_filter
Ref: docs.python.org — tarfile.tar_filter
Tags: #public #python3 #stdlib #tarfile
Import
import tarfile
from tarfile import tar_filter
Signature & Overview
tarfile.tar_filter(member, dest_path)
tarfile.tar_filter() function.
Usage
import tarfile
# Python 3.12+: preserves Unix permissions/timestamps while blocking path traversal
assert callable(tarfile.tar_filter)
Gotchas
- Middle ground between
data_filterandfully_trusted_filter: Blocks path-traversal attacks while preserving more Unix archive metadata.
REPL Inspect
from tarfile import tar_filter
help(tar_filter)
Linked from
Related notes
- tuts/python3/stdlib_module/tarfile/StreamError Linked here; links to this page; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/TarError Linked here; links to this page; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/AbsoluteLinkError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/AbsolutePathError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/CompressionError Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/data_filter Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/TarFile Linked here; shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/tarfile/ExtractError shared tags: #stdlib, #tarfile
- tuts/python3/stdlib_module/tarfile/FilterError shared tags: #stdlib, #tarfile