Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Doc/library/shutil.rst
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the *extract_dir* argument, e.g. members that have absolute filenames
the *extract_dir* argument, for example, members that have absolute filenames

Can we fix this while we're here please. We should not have latin abbreviations.

starting with "/" or filenames with two dots "..".
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,
Expand Down
6 changes: 3 additions & 3 deletions Doc/library/zipfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ ZipFile objects

Never extract archives from untrusted sources without prior inspection.
It is possible that files are created outside of *path*, e.g. members
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It is possible that files are created outside of *path*, e.g. members
It is possible that files are created outside of *path*, for example, members

that have absolute filenames starting with ``"/"`` or filenames with two
dots ``".."``. This module attempts to prevent that.
that have absolute filenames or filenames with ".." components.
This module attempts to prevent that.
See :meth:`extract` note.

.. versionchanged:: 3.6
Expand Down Expand Up @@ -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 (e.g., absolute paths or paths with ".." cmponents). When handling
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vulnerabilities (e.g., absolute paths or paths with ".." cmponents). When handling
vulnerabilities (for example, absolute paths or paths with ".." components). When handling

Latin abbreviation here too, and a typo.

untrusted archives, consider resolving filenames using :func:`os.path.abspath`
and checking against the target directory with :func:`os.path.commonpath`.

Expand Down
Loading