]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-123726: Document caveats of zipfile.Path around name sanitization (GH-13053...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 8 Mar 2025 21:45:48 +0000 (22:45 +0100)
committerGitHub <noreply@github.com>
Sat, 8 Mar 2025 21:45:48 +0000 (21:45 +0000)
commit552dad169207a6d3b466586646cedab38240d8a3
treeeb658ea0196c083ffe38259d33b79d498f3e1d6d
parenta69107b33587b0fb262063971d7a0794cee613d4
[3.12] gh-123726: Document caveats of zipfile.Path around name sanitization (GH-130537) (#130987)

gh-123726: Document caveats of zipfile.Path around name sanitization (GH-130537)

Add a note to the `zipfile.Path` class documentation clarifying that it does not sanitize filenames. This emphasizes the caller's responsibility to validate or sanitize inputs, especially when handling untrusted ZIP archives, to prevent path traversal vulnerabilities. The note also references the `extract` and `extractall` methods for comparison and suggests using `os.path.abspath` and `os.path.commonpath` for safe filename resolution.
(cherry picked from commit a3990df6121880e8c67824a101bb1316de232898)

Co-authored-by: Affan Shaikhsurab <51104750+AffanShaikhsurab@users.noreply.github.com>
Doc/library/zipfile.rst