]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multisslte...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 30 Aug 2025 10:49:45 +0000 (12:49 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Aug 2025 10:49:45 +0000 (10:49 +0000)
gh-138158: Use the `"data"` tarfile extraction filter in `Tools/ssl/multissltests.py` (GH-138147)

The `Tools/ssl/multissltests.py` script may extract a possibly untrusted tarball.
Since the script does not necessarily use Python 3.14 or later (where the `"data"`
filter became the default `tarfile` extraction filter), the user may theoretically
suffer from a path traversal attack.

Although the script should not be used in production and usually relies on downloading
trusted sources, the `"data"` extraction filter is now explicitly used wherever relevant.
(cherry picked from commit 31d3836f26096f9503ca68f4e89d927bc1e060cd)

Co-authored-by: Tommaso Bona <piergeolo@gmail.com>
Tools/ssl/multissltests.py

index eae0e0c5e8761f396f11bfd124b96f47d521050f..ea88a43157bdd31bc866ae8276f139f456c1560e 100755 (executable)
@@ -292,7 +292,7 @@ class AbstractBuilder(object):
                 raise ValueError(member.name, base)
             member.name = member.name[len(base):].lstrip('/')
         log.info("Unpacking files to {}".format(self.build_dir))
-        tf.extractall(self.build_dir, members)
+        tf.extractall(self.build_dir, members, filter='data')
 
     def _build_src(self, config_args=()):
         """Now build openssl"""