Skip to content

Commit 8b6ae4a

Browse files
authored
Invoke pyarrow_hotfix to alleviate concerns due to CVE-2023-47248. (#29402)
1 parent 0fdf404 commit 8b6ae4a

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

sdks/python/apache_beam/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494
from apache_beam.pvalue import PCollection
9595
from apache_beam.pvalue import Row
9696
from apache_beam.pvalue import TaggedOutput
97+
98+
try:
99+
# Add mitigation for CVE-2023-47248 while Beam allows affected versions
100+
# of pyarrow. (https://github.com/apache/beam/issues/29392)
101+
import pyarrow_hotfix
102+
except ImportError:
103+
pass
104+
97105
# pylint: enable=wrong-import-position
98106

99107
__version__ = version.__version__

sdks/python/container/py310/base_image_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ proto-plus==1.22.3
101101
protobuf==4.25.0
102102
psycopg2-binary==2.9.9
103103
pyarrow==11.0.0
104+
pyarrow-hotfix==0.4
104105
pyasn1==0.5.0
105106
pyasn1-modules==0.3.0
106107
pycparser==2.21

sdks/python/container/py311/base_image_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ proto-plus==1.22.3
9898
protobuf==4.25.0
9999
psycopg2-binary==2.9.9
100100
pyarrow==11.0.0
101+
pyarrow-hotfix==0.4
101102
pyasn1==0.5.0
102103
pyasn1-modules==0.3.0
103104
pycparser==2.21

sdks/python/container/py38/base_image_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ proto-plus==1.22.3
105105
protobuf==4.25.0
106106
psycopg2-binary==2.9.9
107107
pyarrow==11.0.0
108+
pyarrow-hotfix==0.4
108109
pyasn1==0.5.0
109110
pyasn1-modules==0.3.0
110111
pycparser==2.21

sdks/python/container/py39/base_image_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ proto-plus==1.22.3
102102
protobuf==4.25.0
103103
psycopg2-binary==2.9.9
104104
pyarrow==11.0.0
105+
pyarrow-hotfix==0.4
105106
pyasn1==0.5.0
106107
pyasn1-modules==0.3.0
107108
pycparser==2.21

sdks/python/setup.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ def cythonize(*args, **kwargs):
140140

141141
# [BEAM-8181] pyarrow cannot be installed on 32-bit Windows platforms.
142142
if sys.platform == 'win32' and sys.maxsize <= 2**32:
143-
pyarrow_dependency = ''
143+
pyarrow_dependency = ['']
144144
else:
145-
pyarrow_dependency = 'pyarrow>=3.0.0,<12.0.0'
145+
pyarrow_dependency = [
146+
'pyarrow>=3.0.0,<12.0.0',
147+
# NOTE(https://github.com/apache/beam/issues/29392): We can remove this
148+
# once Beam increases the pyarrow lower bound to a version that fixes CVE.
149+
'pyarrow-hotfix<1'
150+
]
151+
146152

147153
# Exclude pandas<=1.4.2 since it doesn't work with numpy 1.24.x.
148154
# Exclude 1.5.0 and 1.5.1 because of
@@ -308,7 +314,7 @@ def get_portability_package_data():
308314
# Dynamic dependencies must be specified in a separate list, otherwise
309315
# Dependabot won't be able to parse the main list. Any dynamic
310316
# dependencies will not receive updates from Dependabot.
311-
] + [pyarrow_dependency],
317+
] + pyarrow_dependency,
312318
python_requires=python_requires,
313319
# BEAM-8840: Do NOT use tests_require or setup_requires.
314320
extras_require={

0 commit comments

Comments
 (0)