summaryrefslogtreecommitdiff
path: root/bz2217902-2-aws-awscli-azure-fix-bundled-dateutil-CVE-2007-4559.patch
blob: 9706cecb6605600afa3f63d87a9e3d513761bf56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
--- a/aws/dateutil/zoneinfo/rebuild.py	2023-01-26 16:29:30.000000000 +0100
+++ b/aws/dateutil/zoneinfo/rebuild.py	2023-07-19 10:12:42.277559948 +0200
@@ -21,7 +21,12 @@
     try:
         with TarFile.open(filename) as tf:
             for name in zonegroups:
-                tf.extract(name, tmpdir)
+                if hasattr(tarfile, 'data_filter'):
+                    # Python with CVE-2007-4559 mitigation (PEP 706)
+                    tf.extract(name, tmpdir, filter='data')
+                else:
+                    # Fallback to a possibly dangerous extraction (before PEP 706)
+                    tf.extract(name, tmpdir)
             filepaths = [os.path.join(tmpdir, n) for n in zonegroups]
 
             _run_zic(zonedir, filepaths)

--- a/awscli/dateutil/zoneinfo/rebuild.py	2023-01-26 16:29:30.000000000 +0100
+++ b/awscli/dateutil/zoneinfo/rebuild.py	2023-07-19 10:12:42.277559948 +0200
@@ -21,7 +21,12 @@
     try:
         with TarFile.open(filename) as tf:
             for name in zonegroups:
-                tf.extract(name, tmpdir)
+                if hasattr(tarfile, 'data_filter'):
+                    # Python with CVE-2007-4559 mitigation (PEP 706)
+                    tf.extract(name, tmpdir, filter='data')
+                else:
+                    # Fallback to a possibly dangerous extraction (before PEP 706)
+                    tf.extract(name, tmpdir)
             filepaths = [os.path.join(tmpdir, n) for n in zonegroups]
 
             _run_zic(zonedir, filepaths)

--- a/azure/dateutil/zoneinfo/rebuild.py	2023-01-26 16:29:30.000000000 +0100
+++ b/azure/dateutil/zoneinfo/rebuild.py	2023-07-19 10:12:42.277559948 +0200
@@ -21,7 +21,12 @@
     try:
         with TarFile.open(filename) as tf:
             for name in zonegroups:
-                tf.extract(name, tmpdir)
+                if hasattr(tarfile, 'data_filter'):
+                    # Python with CVE-2007-4559 mitigation (PEP 706)
+                    tf.extract(name, tmpdir, filter='data')
+                else:
+                    # Fallback to a possibly dangerous extraction (before PEP 706)
+                    tf.extract(name, tmpdir)
             filepaths = [os.path.join(tmpdir, n) for n in zonegroups]
 
             _run_zic(zonedir, filepaths)