Skip to content

Commit 0812a1b

Browse files
authored
Merge pull request #529 from StackVista/cve/python-15806-scan35310940870
Fix embedded Python StringPrep with one upstream backport
2 parents 13451dc + 9f51215 commit 0812a1b

7 files changed

Lines changed: 995 additions & 0 deletions

File tree

‎.github/workflows/build-deb.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,15 @@ jobs:
320320
set -eo pipefail
321321
docker run --rm --entrypoint /opt/stackstate-agent/bin/agent/agent "${LOCAL_IMAGE}" version
322322
323+
- name: Verify embedded Python security fixes
324+
run: |
325+
set -eo pipefail
326+
docker run --rm -i --entrypoint /opt/stackstate-agent/embedded/bin/python3 "${LOCAL_IMAGE}" - < scripts/test_embedded_python_security.py
327+
323328
- name: Scan agent image, report-only (Trivy and Grype vulnerabilities, VEX-aware, plus Trivy secrets)
324329
uses: StackVista/image-pipeline/.github/actions/scan-image@ab8ac3d608530ee0a295483c973d720230174348
330+
env:
331+
GRYPE_NAME: stackstate-k8s-agent
325332
with:
326333
image: ${{ env.LOCAL_IMAGE }}
327334
mode: inform

‎deps/cpython/0006-CVE-2026-17084-stringprep-unicode.patch‎

Lines changed: 930 additions & 0 deletions
Large diffs are not rendered by default.

‎deps/cpython/SECURITY_PATCHES.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Embedded CPython security patch
2+
3+
CVE-2026-17084 is fixed by the unchanged upstream Python 3.13 backport
4+
[c28b121a](https://github.com/python/cpython/commit/c28b121a4f0b975937c8b5a1b4934bb361d84296).
5+
It corrects StringPrep's Unicode tables used by the shipped IDNA call paths.
6+
Python continues to report 3.13.15; image-specific `fixed` VEX must identify
7+
artifacts containing this patch, never all Python 3.13.15 installations.
8+
9+
The patch includes upstream regression tests. Existing package CI also checks
10+
IDNA behavior using each architecture's packaged interpreter. Remove the patch
11+
when upgrading to a release containing the fix and keep the runtime regression.
12+
Omnibus must invoke Bazel even at the same Python version so restored caches
13+
cannot bypass changed patch inputs.
14+
15+
The other five backports from the original candidate remain in git history.
16+
Four findings already have reviewed image-scoped VEX in
17+
[StackVista/vexhub](https://github.com/StackVista/vexhub/blob/main/pkg/oci/stackstate-k8s-agent/scan.openvex.json).
18+
Tar-link CVE-2026-87910 is handled by a separate image-scoped applicability
19+
assessment; it is not declared fixed by this patch. Existing VEX and exception
20+
decisions outside this change remain intact.

‎deps/cpython/cpython.MODULE.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ http_archive(
1212
patches = [
1313
"//deps/cpython:0001-customize-windows-build-script.patch",
1414
"//deps/cpython:0002-Set-the-install-name-to-use-rpath-instead-of-absolut.patch",
15+
"//deps/cpython:0006-CVE-2026-17084-stringprep-unicode.patch",
1516
],
1617
sha256 = "c28d9d213c09b5b5ab2c29812950e12f746999e099b82894231be954b26baed9",
1718
strip_prefix = "Python-{}".format(PYTHON_VERSION),

‎omnibus/config/software/python3.rb‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
default_version "3.13.15"
44

5+
# Omnibus does not fingerprint Bazel source patches. Always invoke Bazel so its
6+
# own cache validates the CPython inputs, including same-version security fixes.
7+
always_build true
8+
59
# [sts] STAC-24773 Phase D1: Python via Bazel @cpython (replaces omnibus source build).
610
# Mirrors origin/base-7.78.2 with --downloader_config=/dev/null on every bazelisk
711
# invocation (STS runner egress workaround; see datadog-agent-dependencies.rb).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
security:
3+
- |
4+
Backport CVE-2026-17084 to embedded Python 3.13.15 so IDNA string
5+
preparation uses the Unicode 3.2 case-folding rules required by RFC 3454.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Check the StringPrep backport using the packaged Python interpreter."""
2+
3+
import hashlib
4+
import stringprep
5+
import sys
6+
import unittest
7+
from pathlib import Path
8+
9+
10+
class EmbeddedPythonSecurityTests(unittest.TestCase):
11+
def test_idna_uses_unicode_3_2_case_folding(self):
12+
cases = (
13+
("\N{CHEROKEE LETTER A}\N{CHEROKEE LETTER A}", b"xn--58da"),
14+
("\N{GEORGIAN CAPITAL LETTER AN}.", b"xn--7md."),
15+
("\N{CYRILLIC LETTER PALOCHKA}.example", b"xn--d5a.example"),
16+
("\N{ROMAN NUMERAL REVERSED ONE HUNDRED}.example.", b"xn--q5g.example."),
17+
)
18+
for name, encoded in cases:
19+
with self.subTest(name=name):
20+
self.assertEqual(name.encode("idna"), encoded)
21+
self.assertEqual("example.invalid".encode("idna"), b"example.invalid")
22+
23+
24+
if __name__ == "__main__":
25+
print(sys.version)
26+
module = Path(stringprep.__file__)
27+
print(f"{module}: {hashlib.sha256(module.read_bytes()).hexdigest()}")
28+
unittest.main()

0 commit comments

Comments
 (0)