]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-146581: Update docs for dangerous filenames in ZIP files (GH-149994)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 19 May 2026 08:36:12 +0000 (11:36 +0300)
committerGitHub <noreply@github.com>
Tue, 19 May 2026 08:36:12 +0000 (11:36 +0300)
Co-authored-by: Sebastian Gassner <sebastian.gassner@gmail.com>
Doc/library/shutil.rst
Doc/library/zipfile.rst

index d289ba58c2406580faa6c56ad849aaf6bb625621..e0300a38e2f357db72a3e8dbacd83cc7e584a703 100644 (file)
@@ -749,8 +749,8 @@ provided.  They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
 
       Never extract archives from untrusted sources without prior inspection.
       It is possible that files are created outside of the path specified in
-      the *extract_dir* argument, e.g. members that have absolute filenames
-      starting with "/" or filenames with two dots "..".
+      the *extract_dir* argument, for example, members that have absolute filenames
+      or filenames with ".." components.
 
       Since Python 3.14, the defaults for both built-in formats (zip and tar
       files) will prevent the most dangerous of such security issues,
index 9999ac26999910b607ed750aaf313073c62d5823..ebafcb977803d4131813a1d19db0f107080873fc 100644 (file)
@@ -411,9 +411,9 @@ ZipFile objects
    .. warning::
 
       Never extract archives from untrusted sources without prior inspection.
-      It is possible that files are created outside of *path*, e.g. members
-      that have absolute filenames starting with ``"/"`` or filenames with two
-      dots ``".."``.  This module attempts to prevent that.
+      It is possible that files are created outside of *path*, for example, members
+      that have absolute filenames or filenames with ".." components.
+      This module attempts to prevent that.
       See :meth:`extract` note.
 
    .. versionchanged:: 3.6
@@ -590,7 +590,7 @@ Path objects
       The :class:`Path` class does not sanitize filenames within the ZIP archive. Unlike
       the :meth:`ZipFile.extract` and :meth:`ZipFile.extractall` methods, it is the
       caller's responsibility to validate or sanitize filenames to prevent path traversal
-      vulnerabilities (e.g., filenames containing ".." or absolute paths). When handling
+      vulnerabilities (for example, absolute paths or paths with ".." components). When handling
       untrusted archives, consider resolving filenames using :func:`os.path.abspath`
       and checking against the target directory with :func:`os.path.commonpath`.