Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Doc/library/tarfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,8 @@ can be:

* the string ``'tar'``: Honor most *tar*-specific features (i.e. features of
UNIX-like filesystems), but block features that are very likely to be
surprising or malicious. See :func:`tar_filter` for details.
surprising or malicious. Note that this filter does not limit the targets of
symbolic links. See :func:`tar_filter` for details.

* the string ``'data'``: Ignore or block most features specific to UNIX-like
filesystems. Intended for extracting cross-platform data archives.
Expand Down Expand Up @@ -1124,6 +1125,17 @@ reused in custom filters:

Return the modified ``TarInfo`` member.

.. warning::
This filter does not check :attr:`TarInfo.linkname`. This means it does
not limit where a symbolic link member points. An absolute symbolic-link
target will remain absolute, and a relative target may resolve outside the
extraction destination. The destination path protection described above
concerns only where the archive member itself is written, not where a
symbolic link resolves. The stricter :func:`data_filter` rejects these
unsafe link targets, raising :class:`~tarfile.AbsoluteLinkError` for
absolute link targets or :class:`~tarfile.LinkOutsideDestinationError`
for link targets outside the destination.

.. versionchanged:: next

Filenames containing ``..`` components are now normalized.
Expand Down
Loading