Skip to content

Commit 92d653a

Browse files
gh-146581: Update docs for dangerous filenames in ZIP files
1 parent 18281db commit 92d653a

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/library/shutil.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
750750
Never extract archives from untrusted sources without prior inspection.
751751
It is possible that files are created outside of the path specified in
752752
the *extract_dir* argument, e.g. members that have absolute filenames
753-
starting with "/" or filenames with two dots "..".
753+
or filenames with ".." components.
754754

755755
Since Python 3.14, the defaults for both built-in formats (zip and tar
756756
files) will prevent the most dangerous of such security issues,

Doc/library/zipfile.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ ZipFile objects
412412

413413
Never extract archives from untrusted sources without prior inspection.
414414
It is possible that files are created outside of *path*, e.g. members
415-
that have absolute filenames starting with ``"/"`` or filenames with two
416-
dots ``".."``. This module attempts to prevent that.
415+
that have absolute filenames or filenames with ".." components.
416+
This module attempts to prevent that.
417417
See :meth:`extract` note.
418418

419419
.. versionchanged:: 3.6
@@ -590,7 +590,7 @@ Path objects
590590
The :class:`Path` class does not sanitize filenames within the ZIP archive. Unlike
591591
the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, it is the
592592
caller's responsibility to validate or sanitize filenames to prevent path traversal
593-
vulnerabilities (e.g., filenames containing ".." or absolute paths). When handling
593+
vulnerabilities (e.g., absolute paths or paths with ".." cmponents). When handling
594594
untrusted archives, consider resolving filenames using :func:`os.path.abspath`
595595
and checking against the target directory with :func:`os.path.commonpath`.
596596

0 commit comments

Comments
 (0)