Skip to content

Commit 6c0e9c0

Browse files
committed
Check expat version/checksum in SBOM with refresh.sh
1 parent bc7b511 commit 6c0e9c0

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SBOM generation tool didn't cross-check the version and checksum values
2+
against the ``Modules/expat/refresh.sh`` script, leading to the values
3+
becoming out-of-date during routine updates.

Misc/sbom.spdx.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/build/generate_sbom.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Tool for generating Software Bill of Materials (SBOM) for Python's dependencies"""
2-
32
import glob
43
import hashlib
54
import json
@@ -242,14 +241,14 @@ def check_sbom_packages(sbom_data: dict[str, typing.Any]) -> None:
242241
)
243242

244243
# libexpat specifies its expected rev in a refresh script.
245-
if package["name"] == "libexpat":
244+
if package["name"] == "expat":
246245
libexpat_refresh_sh = (CPYTHON_ROOT_DIR / "Modules/expat/refresh.sh").read_text()
247246
libexpat_expected_version_match = re.search(
248247
r"expected_libexpat_version=\"([0-9]+\.[0-9]+\.[0-9]+)\"",
249248
libexpat_refresh_sh
250249
)
251250
libexpat_expected_sha256_match = re.search(
252-
r"expected_libexpat_sha256=\"[a-f0-9]{40}\"",
251+
r"expected_libexpat_sha256=\"([a-f0-9]{64})\"",
253252
libexpat_refresh_sh
254253
)
255254
libexpat_expected_version = libexpat_expected_version_match and libexpat_expected_version_match.group(1)

0 commit comments

Comments
 (0)