Skip to content

Commit 508aba1

Browse files
aaronmaxlevycopybara-github
authored andcommitted
Updating setuptools to patch CVE-2025-47273 (#22094)
Updating setuptools to patch CVE-2025-47273 Also updated Bazel to 7.4.0 due to bazelbuild/bazel#4327 Fixes #22165 Closes #22094 COPYBARA_INTEGRATE_REVIEW=#22094 from aaronmaxlevy:aaron_update_setuptools e1278ab PiperOrigin-RevId: 780701752
1 parent 5777d3b commit 508aba1

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

python/dist/BUILD.bazel

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,24 +299,28 @@ pkg_tar(
299299
}),
300300
)
301301

302+
sh_binary(
303+
name = "setup_wrapper",
304+
srcs = ["setup_wrapper.sh"],
305+
data = [requirement("setuptools")],
306+
visibility = ["//visibility:private"],
307+
)
308+
302309
genrule(
303310
name = "source_wheel",
304311
srcs = [":source_tarball"],
305312
outs = ["protobuf-%s.tar.gz" % PROTOBUF_PYTHON_VERSION],
306313
cmd = """
307-
export PYTHONPATH=$$PWD/external/protobuf_pip_deps_setuptools/site-packages
308314
set -eux
309315
tar -xzvf $(location :source_tarball)
310-
cd protobuf/
311-
python3 setup.py sdist
312-
cd ..
316+
$(location :setup_wrapper) sdist
313317
mv protobuf/dist/*.tar.gz $@
314318
""",
315319
target_compatible_with = select({
316320
"@system_python//:none": ["@platforms//:incompatible"],
317321
"//conditions:default": [],
318322
}),
319-
tools = [requirement("setuptools")],
323+
tools = [":setup_wrapper"],
320324
)
321325

322326
py_wheel(

python/dist/setup_wrapper.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# Find the setuptools directory and add it to PYTHONPATH
5+
SETUPTOOLS_PATH=$(find $PWD -name "setuptools" -type d | grep site-packages | head -1)
6+
if [ -z "$SETUPTOOLS_PATH" ]; then
7+
echo "Warning: Could not find setuptools directory"
8+
else
9+
SITE_PACKAGES_DIR=$(dirname "$SETUPTOOLS_PATH")
10+
echo "Using setuptools from: $SITE_PACKAGES_DIR"
11+
export PYTHONPATH="$SITE_PACKAGES_DIR"
12+
fi
13+
14+
# Run setup.py with the arguments passed to this script
15+
cd protobuf/
16+
python3 setup.py "$@"

python/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
numpy<=2.1.0
2-
setuptools<=70.3.0
2+
setuptools<=78.1.1
33
absl-py==2.*

0 commit comments

Comments
 (0)