Skip to content

Commit 3e7e2d9

Browse files
authored
Merge pull request #594 from StackVista/bump-python-3.13.18
Update embedded Python and CA certificates
2 parents 584be8f + 03af30a commit 3e7e2d9

7 files changed

Lines changed: 66 additions & 15 deletions

File tree

‎deps/cpython/SECURITY_PATCHES.md‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
# Embedded CPython security regressions
1+
# Embedded CPython maintenance
22

3-
Python 3.13.16 includes the upstream StringPrep Unicode-table and tarfile
4-
hard-link fixes previously carried as local backports. Their patches remain
5-
in git history.
3+
Update embedded CPython to the 3.13.18 maintenance release.
64

75
Keep `scripts/test_embedded_python_security.py`: package CI runs it with the
8-
installed interpreter on native AMD64 and ARM64. It checks IDNA behavior,
9-
both tarfile extraction filters and the packaged `build.safe_extractall`
10-
wrapper, including unchanged outside-file contents and metadata.
6+
installed interpreter on native AMD64 and ARM64. Run as a non-root user so
7+
all maintained runtime checks execute.
118

129
Omnibus must invoke Bazel even at the same Python version so restored caches
13-
cannot bypass changed source or patch inputs. Existing reviewed VEX and
14-
exception decisions remain separate from these runtime regressions.
10+
cannot bypass changed source or patch inputs.

‎deps/cpython/cpython.MODULE.bazel‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22

3-
PYTHON_VERSION = "3.13.16"
3+
PYTHON_VERSION = "3.13.18"
44

55
http_archive(
66
name = "cpython",
@@ -13,7 +13,7 @@ http_archive(
1313
"//deps/cpython:0001-customize-windows-build-script.patch",
1414
"//deps/cpython:0002-Set-the-install-name-to-use-rpath-instead-of-absolut.patch",
1515
],
16-
sha256 = "cfac63bddf956deafb1172ca131ae5dcaafd6f95056086e233fca205593ed427",
16+
sha256 = "99dbc847fb6a3fb26358370fb4c591215864116ebb584f2b89ab0b74c51dfa2a",
1717
strip_prefix = "Python-{}".format(PYTHON_VERSION),
1818
url = "https://python.org/ftp/python/{0}/Python-{0}.tgz".format(PYTHON_VERSION),
1919
)

‎omnibus/config/software/cacerts.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727

2828
# Pinned to a dated curl release: the moving cacert.pem breaks every build when
2929
# curl publishes a new bundle, and this fork has no monitor for it.
30-
default_version "2026-09-25"
30+
default_version "2026-10-20"
3131
source url: "https://curl.se/ca/cacert-#{version}.pem",
32-
sha256: "a41b5d356aea97a529fe27e0f7316d2f9d946d75927476cf9cf1b90637d00505",
32+
sha256: "796f1389bfea13c0ed78f663b765baaff54a508e5483786bd6ece73c5e3e3cbe",
3333
target_filename: "cacert.pem"
3434

3535
relative_path "cacerts-#{version}"

‎omnibus/config/software/python3.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name "python3"
22

3-
default_version "3.13.16"
3+
default_version "3.13.18"
44

55
# Omnibus does not fingerprint Bazel source patches. Always invoke Bazel so its
66
# own cache validates the CPython inputs, including same-version security fixes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
enhancements:
3+
- |
4+
Bump embedded Python to 3.13.18 and refresh the bundled CA certificates.

‎scripts/test_embedded_python_security.py‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,71 @@
11
"""Check security fixes using the packaged Python interpreter and dependencies."""
22

3+
import contextlib
34
import hashlib
45
import io
6+
import os
57
import platform
8+
import shutil
69
import stringprep
710
import sys
811
import tarfile
912
import tempfile
1013
import unittest
1114
from pathlib import Path
15+
from unittest import mock
1216

1317
import jwt
1418
from build._compat.tarfile import safe_extractall
1519

1620

1721
class EmbeddedPythonSecurityTests(unittest.TestCase):
22+
@unittest.skipUnless(
23+
os.name == "posix" and shutil.rmtree.avoids_symlink_attacks,
24+
"requires POSIX fd-based directory removal",
25+
)
26+
@unittest.skipIf(hasattr(os, "geteuid") and os.geteuid() == 0, "requires a non-root user")
27+
def test_runtime_maintenance(self):
28+
with tempfile.TemporaryDirectory() as outside:
29+
target = Path(outside) / "file1"
30+
target.write_bytes(b"outside")
31+
before = target.stat()
32+
directory = tempfile.TemporaryDirectory()
33+
original = Path(directory.name) / "dir1"
34+
moved = Path(directory.name) / "dir1_moved"
35+
original.mkdir()
36+
(original / "file1").write_bytes(b"inside")
37+
original.chmod(0o500)
38+
unlink = os.unlink
39+
raced = False
40+
41+
def replace_on_permission_error(path, *, dir_fd=None):
42+
nonlocal raced
43+
try:
44+
return unlink(path, dir_fd=dir_fd)
45+
except PermissionError:
46+
if not original.is_symlink():
47+
original.chmod(0o700)
48+
original.rename(moved)
49+
original.symlink_to(outside, target_is_directory=True)
50+
raced = True
51+
raise
52+
53+
try:
54+
with mock.patch("os.unlink", replace_on_permission_error), contextlib.suppress(OSError):
55+
directory.cleanup()
56+
self.assertTrue(raced, "runtime check must execute")
57+
self.assertTrue(target.is_file(), "runtime check must preserve the fixture")
58+
self.assertEqual(target.read_bytes(), b"outside")
59+
after = target.stat()
60+
self.assertEqual((after.st_mode, after.st_mtime_ns), (before.st_mode, before.st_mtime_ns))
61+
finally:
62+
if original.is_symlink():
63+
original.unlink()
64+
moved.rename(original)
65+
if original.exists():
66+
original.chmod(0o700)
67+
directory.cleanup()
68+
1869
def test_jwt_options_reuse_preserves_claim_verification(self):
1970
# CVE-2026-103001: an unsigned inspection must not mutate reusable
2071
# options and disable expiry checking on a later verified decode.

‎test/new-e2e/tests/agent-platform/common/agent_behaviour.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const (
223223
ExpectedPythonVersion2 = "2.7.18"
224224
// ExpectedPythonVersion3 is the expected python 3 version
225225
// Bump this version when deps/cpython/cpython.MODULE.bazel changes
226-
ExpectedPythonVersion3 = "3.13.16"
226+
ExpectedPythonVersion3 = "3.13.18"
227227
// ExpectedUnloadedPython is the status value for uninitialized lazy loaded python runtime
228228
ExpectedUnloadedPython = "unused"
229229
)

0 commit comments

Comments
 (0)