Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

build: refresh Python base and align scanner policy (#7583)

LearningCircuita0cc78f1ce73
diff --git a/.github/SECURITY_ALERTS.md b/.github/SECURITY_ALERTS.md
index 999954682f..35aad6e1c7 100644
--- a/.github/SECURITY_ALERTS.md
+++ b/.github/SECURITY_ALERTS.md
@@ -47,8 +47,10 @@ the gate.
`expires_on` is an exclusive UTC date: an entry with `2026-10-13` stops applying
at **00:00 UTC on October 13, 2026**. An expired entry with an open matching alert
-blocks release again. An entry for an alert that is no longer open grants
-nothing and should be removed. Extensions require another reviewed policy change.
+blocks release again. An entry for an alert that is no longer open (fixed,
+closed or dismissed) grants nothing: it is dormant, kept only as an expiring
+audit record, and should be removed at expiry. Extensions require another
+reviewed policy change.
The gate retains the earliest **applied** expiry from both the fresh-evidence
check on the release ref and the later default-branch alert check, even if an
@@ -150,7 +152,7 @@ Cover every path that blocks.
### Current exception policy
-The checked-in policy lists every active exception, each with its alert
+The checked-in policy lists each exception entry with its alert
number, rationale, tracking link and expiry; read
[release-security-exceptions.json](release-security-exceptions.json) for the
current set. It grants no release exception for CVE-2026-87910 / alert #8273.
@@ -160,6 +162,33 @@ Any finding without an entry continues to block according to the normal gate
policy; adding or extending an exception requires a separately reviewed
policy change.
+#### Accepted findings also suppressed in the scanner
+
+GHSA-v5mq-3xhg-98m9 / CVE-2026-104250 (unstructured) is also
+suppressed in the scanner configuration. This is an exception to the rule
+above about keeping the finding visible. Every fixed release currently
+requires Python <3.14, while the production image uses Python 3.14.9.
+The existing loader regression contract remains in
+`tests/security/test_unstructured_html_output_tripwire.py` and must be
+retained while these entries are present.
+
+The `.grype.yaml` entries apply to the `unstructured` package. The
+`.trivyignore` entries use Trivy's native `exp:2026-12-19` date. Remove them
+and the related policy entries when a fixed Python 3.14-compatible release
+is locked.
+
+Alerts #9736, #9737 and #9738 were dismissed on 2026-10-18. Dismissal status
+persists independently of scanner suppressions. Their exact-number policy
+entries are dormant audit records and impose no publication deadline while
+the alerts remain dismissed. A scan reporting the same finding does not
+guarantee a new alert number. Any new open alert still requires triage under
+the normal gate policy.
+
+Trivy drops expired ignore lines without failing the scan solely because
+an entry expired. The existing `osv-scanner.toml` `ignoreUntil = 2026-10-31`
+is the enforced review date for this advisory: once it expires, a completed
+release scan fails if the finding remains.
+
---
## DS162092 - Hardcoded URLs
diff --git a/.github/release-security-exceptions.json b/.github/release-security-exceptions.json
index 8959daa593..b19c160817 100644
--- a/.github/release-security-exceptions.json
+++ b/.github/release-security-exceptions.json
@@ -2,17 +2,6 @@
"version": 1,
"repository": "LearningCircuit/local-deep-research",
"exceptions": [
- {
- "alert_number": 9725,
- "rule_id": "CVE-2026-12345-python",
- "tool": "Grype",
- "category": "grype-container",
- "path": "local-deep-research//usr/local/bin/python3.14",
- "severity": "medium",
- "expires_on": "2026-12-15",
- "reason": "CPython gh-157579 (fixed by python/cpython#158430, first in 3.14.9): when tempfile.TemporaryDirectory cleanup works around a permission error it re-resolves paths, so a process that swaps a directory in the tree for a symlink during cleanup can make it delete files outside the tree. Not exploitable in LDR: first-party code never uses TemporaryDirectory (only private 0700 mkdtemp + shutil.rmtree, which on Linux uses the fd-based symlink-safe walk), and the dependencies that do (unstructured, langchain-community, pypdf, huggingface_hub, sentence-transformers) create their own 0700 directories under the default temp dir. Racing the cleanup needs code already running as the same uid, and the image runs the app as its single ldruser, which could delete those files directly; no privilege boundary is crossed. Grype matches CPython on the interpreter version only, so it reports the python:3.14.8-slim base as affected. Remove this entry when the base image is Python 3.14.9 or newer.",
- "tracking_url": "https://github.com/LearningCircuit/local-deep-research/pull/7383"
- },
{
"alert_number": 9736,
"rule_id": "CVE-2026-104250",
diff --git a/.github/workflows/ci-policy-tests.yml b/.github/workflows/ci-policy-tests.yml
index 4b4e4bc4db..bf8e958e4a 100644
--- a/.github/workflows/ci-policy-tests.yml
+++ b/.github/workflows/ci-policy-tests.yml
@@ -17,6 +17,10 @@ on:
- "tests/ci/standalone/test_pytest_scheduling.py"
- "tests/ci/standalone/test_osv_scan.py"
- "tests/ci/standalone/test_library_embedding_fixture.py"
+ - "scripts/refresh_pip_urllib3.py"
+ - "requirements/bootstrap-*.txt"
+ - "requirements/pip-vendor-refresh.txt"
+ - "tests/ci/standalone/test_pip_vendor_refresh.py"
workflow_dispatch:
permissions:
@@ -47,3 +51,5 @@ jobs:
run: python -m unittest discover -s tests/ci/standalone -p 'test_osv_scan.py' -v
- name: Test library model preparation and offline server setup
run: python -m unittest discover -s tests/ci/standalone -p 'test_library_embedding_fixture.py' -v
+ - name: Test reviewed pip refresh inputs and seed boundaries
+ run: python -m unittest discover -s tests/ci/standalone -p 'test_pip_vendor_refresh.py' -v
diff --git a/.grype.yaml b/.grype.yaml
index 9524eb8184..7695e769b3 100644
--- a/.grype.yaml
+++ b/.grype.yaml
@@ -262,13 +262,11 @@ ignore:
# the 2026-07-11 release-gate scan still flagged it with the auto-rule
# active, contrary to the assumption in PR #5032).
# ==========================================================================
- # Fixed in the Python 3.14.8 base image, so their entries were removed:
+ # Fixed in the Python base image, so their entries were removed:
# CVE-2026-4360, CVE-2026-6879, and CVE-2026-15308 (fixed in 3.14.7), and
# CVE-2026-15310, CVE-2026-15806, CVE-2026-17084, and CVE-2026-19672
- # (fixed in 3.14.8). CVE-2026-87910 and CVE-2026-12345 remain visible to
- # the gate: their 3.14 backports landed after the 3.14.8 release tag.
- # CVE-2026-12345 (alert #9725) is accepted until 3.14.9 by an expiring
- # entry in .github/release-security-exceptions.json, not suppressed here.
+ # (fixed in 3.14.8). CVE-2026-12345 is fixed in Python 3.14.9 and is
+ # also unsuppressed. CVE-2026-87910 remains unsuppressed.
# ==========================================================================
# NO FIX AVAILABLE IN DEBIAN TRIXIE
@@ -338,14 +336,13 @@ ignore:
# this file keep them out of the Grype results until it does.
# Python's pyexpat does not link this package: it embeds CPython's bundled
# expat, which Grype cannot see. The builder-base and ldr stages of the
- # Dockerfile fail the build if that bundled copy is older than 2.8.5, the
- # expat that the pinned Python 3.14.8 bundles. BUNDLED_EXPAT in
+ # Dockerfile fail the build if that bundled copy is older than 2.9.0, the
+ # expat that the pinned Python 3.14.9 bundles. BUNDLED_EXPAT in
# tests/deployment/test_deployment_surface_contracts.py maps each CPython
# release to its bundled expat, and the contract test fails while the
# minimum differs from the entry for the release in the base image tag, so
- # a change of that release has to move the minimum with it. Expat 2.8.5 has
- # the fixes of expat 2.8.4 and 2.8.5, but not those of expat 2.9.0:
- # CVE-2026-77214, and CVE-2026-102633, which affects 32-bit platforms only.
+ # a change of that release has to move the minimum with it. The current
+ # minimum is expat 2.9.0, matching CPython 3.14.9's bundled copy.
# No expat release fixes CVE-2025-66382 yet.
- vulnerability: CVE-2025-66382
package: { name: libexpat1, type: deb }
@@ -448,7 +445,7 @@ ignore:
- vulnerability: CVE-2023-37769
reason: "FPE in stress-test tool. Debian: unimportant. Crash in test tool, no security impact."
- # --- python3.14 (base image python:3.14.8-slim) ---
+ # --- python3.14 (base image python:3.14.9-slim) ---
# 3.14.5 fixed CVE-2026-6100, -4786, -1502, -6019; 3.14.6 (2026-06-11)
# fixed CVE-2026-8328, -9669, -7774, -3276 — those entries were removed.
# Also removed: CVE-2025-13462 (tarfile, fixed in 3.14.4), CVE-2025-15366
@@ -510,7 +507,7 @@ ignore:
# partition_md() (fetched via requests.get with no host validation).
# Critical per the advisory. NO LOCKABLE FIX: every fixed release (0.24.0
# through 0.27.6) requires Python <3.14, while this project pins
- # requires-python >=3.12,<3.15 with a Python 3.14.8 production image.
+ # requires-python >=3.12,<3.15 with a Python 3.14.9 production image.
# MITIGATED — the URL sinks are unreachable in this codebase:
# es_utils.index_file calls partition(filename=<PathValidator-vetted local
# path>); every other touchpoint is langchain-community's file-based
@@ -520,10 +517,6 @@ ignore:
# this entry is in force. Mirror entry in .trivyignore.
# Remove both (and the tripwire) when a fixed unstructured release supports
# Python 3.14 and the lock is bumped past it.
- # GHSA-v5mq-3xhg-98m9 (stored XSS in unstructured's HTML output; Grype
- # alerts #9737 and #9738) is accepted by expiring entries in
- # .github/release-security-exceptions.json, not suppressed here: do not
- # copy the SSRF entries below for it.
# ==========================================================================
- vulnerability: GHSA-4mvj-m6j5-pmf7
package: { name: unstructured }
@@ -531,6 +524,25 @@ ignore:
- vulnerability: CVE-2026-71428
package: { name: unstructured }
reason: "CVE alias of GHSA-4mvj-m6j5-pmf7 (unstructured URL-partitioning SSRF). See the GHSA entry above."
+ # GHSA-v5mq-3xhg-98m9 / CVE-2026-104250 (alerts #9737 lockfile, #9738
+ # image): stored XSS in unstructured's HTML output (v2 ontology emitter's
+ # metadata.text_as_html and elements_to_html()). Fixed only in 0.24.1+,
+ # and every fixed release requires Python <3.14. LDR never produces or
+ # reads that HTML: its loaders return element text only. Enforced by
+ # tests/security/test_unstructured_html_output_tripwire.py. Alerts
+ # #9736-#9738 were dismissed on 2026-10-18. Dismissal status persists
+ # independently of scanner suppressions, so their entries in
+ # .github/release-security-exceptions.json are dormant audit records.
+ # The existing osv-scanner.toml ignoreUntil date (2026-10-31) requires
+ # review through the completed release scan.
+ # Mirror entry in .trivyignore. Remove all of them when a fixed release
+ # that supports Python 3.14 is locked.
+ - vulnerability: GHSA-v5mq-3xhg-98m9
+ package: { name: unstructured }
+ reason: "Medium stored XSS in unstructured's HTML output (text_as_html, elements_to_html). No fixed release installs on Python 3.14 (all fixes 0.24.1+ need <3.14). LDR never produces or reads that HTML. Enforced by tests/security/test_unstructured_html_output_tripwire.py. Remove when a 3.14-compatible fixed release is locked."
+ - vulnerability: CVE-2026-104250
+ package: { name: unstructured }
+ reason: "CVE alias of GHSA-v5mq-3xhg-98m9 (unstructured HTML-output stored XSS). See the GHSA entry above."
# --- torch (transitive dep for local embeddings — no fix available) ---
- vulnerability: GHSA-rrmf-rvhw-rf47
@@ -552,6 +564,6 @@ ignore:
- vulnerability: CVE-2026-2219
reason: "High vuln in dpkg 1.22.22. No fix in Trixie yet. Base image python:3.14-slim ships this version."
- # --- sed (GNU sed from Debian base image python:3.14.8-slim) ---
+ # --- sed (GNU sed from Debian base image python:3.14.9-slim) ---
- vulnerability: CVE-2026-5958
reason: "Low CVE in GNU sed from base image. No public info — may be very new, disputed, or not yet indexed. sed not explicitly installed in Dockerfile; comes from the python slim base image. Container does not process untrusted input with sed. No fix in Trixie."
diff --git a/.trivyignore b/.trivyignore
index 89beae6583..102f0baca1 100644
--- a/.trivyignore
+++ b/.trivyignore
@@ -16,7 +16,7 @@
# on Python versions that don't implement PEP 706. Safe versions:
# Python >= 3.9.17, >= 3.10.12, >= 3.11.4, or >= 3.12 (all versions).
# This project requires Python 3.12 or newer and its production image ships
-# Python 3.14.8, so PEP 706 is always implemented and the vulnerable
+# Python 3.14.9, so PEP 706 is always implemented and the vulnerable
# fallback code path is never executed.
#
# Fix available in pip 25.3+, but not needed for PEP 706-compliant Python.
@@ -229,7 +229,7 @@ CVE-2026-27456 exp:2026-10-01
# partition_html()/partition_md() is fetched with no host validation
# (full-read SSRF). Fixed only in unstructured 0.24.0+, and EVERY fixed
# release (0.24.0..0.27.6) declares Requires-Python <3.14 while this project
-# pins requires-python >=3.12,<3.15 with a Python 3.14.8 production image —
+# pins requires-python >=3.12,<3.15 with a Python 3.14.9 production image —
# no lockable fixed version exists until upstream ships 3.14 support.
#
# MITIGATED — the URL sinks are unreachable: es_utils.index_file calls
@@ -245,3 +245,31 @@ CVE-2026-27456 exp:2026-10-01
# is bumped past it.
CVE-2026-71428 exp:2026-12-19
GHSA-4mvj-m6j5-pmf7 exp:2026-12-19
+
+# GHSA-v5mq-3xhg-98m9 / CVE-2026-104250: unstructured HTML-output stored XSS
+# Severity: MEDIUM
+# Review: 2026-12-19
+#
+# UNFIXABLE ON THIS PYTHON: the v2 ontology HTML emitter copies document
+# markup into metadata.text_as_html and the output of elements_to_html()
+# without escaping. Fixed only in unstructured 0.24.1+, and every fixed
+# release declares Requires-Python <3.14, so none can be locked for the
+# Python 3.14.9 production image.
+#
+# MITIGATED: LDR never produces or reads that HTML. Its unstructured-backed
+# loaders run in langchain-community's default "single" mode and return
+# element text only. Enforced by
+# tests/security/test_unstructured_html_output_tripwire.py. Alerts
+# #9736-#9738 were dismissed on 2026-10-18. Dismissal status persists
+# independently of scanner suppressions, so their entries in
+# .github/release-security-exceptions.json are dormant audit records.
+# These exp: lines lapse silently (Trivy drops expired lines without
+# failing), so the existing osv-scanner.toml ignoreUntil date (2026-10-31)
+# requires review through the completed release scan. Mirror entries in
+# .grype.yaml.
+#
+# Tracking: https://github.com/advisories/GHSA-v5mq-3xhg-98m9
+# Remove when a fixed unstructured release supports Python 3.14 and the lock
+# is bumped past it.
+CVE-2026-104250 exp:2026-12-19
+GHSA-v5mq-3xhg-98m9 exp:2026-12-19
diff --git a/Dockerfile b/Dockerfile
index e9bb72a8c8..8ed4428268 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,31 +1,31 @@
####
# Used for building the LDR service dependencies.
####
-FROM python:3.14.8-slim@sha256:a2b82f3c48559aa0a8446d9af49826b6e2b2016f4cd2afabfe6013ec53729170 AS builder-base
+FROM python:3.14.9-slim@sha256:b347e2dcbc7f0b6f9fb7182e9da6a187fb10ae715e0692518c1aed0eec94a700 AS builder-base
# Set shell to bash with pipefail for safer pipe handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
-# Fail the build if the base image's interpreter is older than 3.14.8, the
-# first 3.14 release with the upstream CVE-2026-15310 zipfile fix. Docker
-# pulls a `name:tag@sha256:...` reference by its digest and ignores the tag,
+# Fail the build if the base image's interpreter is older than 3.14.9,
+# the minimum production interpreter version. Docker pulls a
+# `name:tag@sha256:...` reference by its digest and ignores the tag,
# so this checks the interpreter the digest actually contains. It calls
# sys.exit rather than assert: python -O and PYTHONOPTIMIZE strip assert
# statements, and the check must fail the build in either case.
# See .grype.yaml (CPYTHON).
-RUN python3 -c "import sys; v = sys.version.split()[0]; print(f'base image Python {v}'); sys.exit(0 if sys.version_info >= (3, 14, 8) else f'base image Python {v} is older than 3.14.8, the first 3.14 release with the CVE-2026-15310 zipfile fix')"
+RUN python3 -c "import sys; v = sys.version.split()[0]; print(f'base image Python {v}'); sys.exit(0 if sys.version_info >= (3, 14, 9) else f'base image Python {v} is older than the minimum production version 3.14.9')"
ARG DEBIAN_FRONTEND=noninteractive
-# Fail the build if pyexpat embeds an expat older than 2.8.5, the expat that
-# CPython 3.14.8 bundles. The official python images build CPython with its
+# Fail the build if pyexpat embeds an expat older than 2.9.0, the expat that
+# CPython 3.14.9 bundles. The official python images build CPython with its
# bundled expat instead of Debian's libexpat1, so Grype sees libexpat1 but not
# the copy that pyexpat uses. Keep this floor, and the floor of the ldr
# stage's copy of this check, at the bundled expat version of the pinned base
# image. It calls sys.exit rather than assert: python -O and
# PYTHONOPTIMIZE strip assert statements, and the check must fail the build in
# either case. See .grype.yaml (libexpat1).
-RUN python3 -c "import pyexpat, sys; v = pyexpat.version_info; print(f'pyexpat uses expat {v}'); sys.exit(0 if v >= (2, 8, 5) else 'pyexpat embeds an expat older than 2.8.5; expected the CPython-bundled expat 2.8.5 or newer')"
+RUN python3 -c "import pyexpat, sys; v = pyexpat.version_info; print(f'pyexpat uses expat {v}'); sys.exit(0 if v >= (2, 9, 0) else 'pyexpat embeds an expat older than 2.9.0; expected the CPython-bundled expat 2.9.0 or newer')"
# `apt-get upgrade -y` is INTENTIONAL — we want every build to pull the
# latest patched Debian packages so security fixes flow into the image.
@@ -93,7 +93,7 @@ COPY requirements/bootstrap-builder.txt /tmp/bootstrap-builder.txt
RUN pip3 install --no-cache-dir --require-hashes -r /tmp/bootstrap-builder.txt \
&& rm /tmp/bootstrap-builder.txt
-# pip 26.2.1 still vendors urllib3 2.7.0. Refresh it from reviewed wheels,
+# pip 26.2.2 still vendors urllib3 2.7.0. Refresh it from reviewed wheels,
# including ensurepip's seed wheel, until pip ships urllib3 >=2.8.0 (#7094).
COPY requirements/pip-vendor-refresh.txt /tmp/pip-vendor-refresh.txt
COPY scripts/refresh_pip_urllib3.py /tmp/refresh_pip_urllib3.py
@@ -321,20 +321,20 @@ RUN groupadd -r ldruser && useradd -r -g ldruser -u 1000 -m -d /home/ldruser ldr
####
# Runs the LDR service.
###
-FROM python:3.14.8-slim@sha256:a2b82f3c48559aa0a8446d9af49826b6e2b2016f4cd2afabfe6013ec53729170 AS ldr
+FROM python:3.14.9-slim@sha256:b347e2dcbc7f0b6f9fb7182e9da6a187fb10ae715e0692518c1aed0eec94a700 AS ldr
# Set shell to bash with pipefail for safer pipe handling
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Same interpreter check as builder-base: this stage starts from the base
# image again, and its interpreter is the one the image ships.
-RUN python3 -c "import sys; v = sys.version.split()[0]; print(f'base image Python {v}'); sys.exit(0 if sys.version_info >= (3, 14, 8) else f'base image Python {v} is older than 3.14.8, the first 3.14 release with the CVE-2026-15310 zipfile fix')"
+RUN python3 -c "import sys; v = sys.version.split()[0]; print(f'base image Python {v}'); sys.exit(0 if sys.version_info >= (3, 14, 9) else f'base image Python {v} is older than the minimum production version 3.14.9')"
ARG DEBIAN_FRONTEND=noninteractive
# Same pyexpat check as builder-base: this stage starts from the base image
# again, and its interpreter is the one the image ships.
-RUN python3 -c "import pyexpat, sys; v = pyexpat.version_info; print(f'pyexpat uses expat {v}'); sys.exit(0 if v >= (2, 8, 5) else 'pyexpat embeds an expat older than 2.8.5; expected the CPython-bundled expat 2.8.5 or newer')"
+RUN python3 -c "import pyexpat, sys; v = pyexpat.version_info; print(f'pyexpat uses expat {v}'); sys.exit(0 if v >= (2, 9, 0) else 'pyexpat embeds an expat older than 2.9.0; expected the CPython-bundled expat 2.9.0 or newer')"
# Pin pip to 26.2 for the CVE-2026-13346 malicious-index fix and the earlier
# CVE-2026-8643, CVE-2026-1703, and GHSA-jp4c-xjxw-mgf9 fixes.
diff --git a/requirements/bootstrap-builder.txt b/requirements/bootstrap-builder.txt
index 2e874612ef..ef54d50ac1 100644
--- a/requirements/bootstrap-builder.txt
+++ b/requirements/bootstrap-builder.txt
@@ -187,9 +187,9 @@ pdm==2.29.2 \
--hash=sha256:b17dcc9b55b94694d63afc56053afb7d580e963bb038c753df2cd18fda71182d \
--hash=sha256:bad9705e9482e7d877a53380ff25273b01e9c1d313ee6ce7b215a6562a9d8bdd
-pip==26.2.1 \
- --hash=sha256:71138adf1f4ca900cdb7d289c21b7494329f2332b6d85f0e1c42108c0384ed3e \
- --hash=sha256:f6ad667e89a1fe78046c8f13232b247200f5258d7828f3f7883d660878e0813f
+pip==26.2.2 \
+ --hash=sha256:fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70 \
+ --hash=sha256:3a8e5c800492787f33a4114ef54444546c340df428974ebba17e0fd47e11af2f
platformdirs==4.13.0 \
--hash=sha256:1aa0b0d3f224c1f07c295121e312a5a24a180d6ae5a8425ea1784b3e3863e9c0 \
diff --git a/requirements/bootstrap-ci.txt b/requirements/bootstrap-ci.txt
index 5b2331ff28..ea8170d6e5 100644
--- a/requirements/bootstrap-ci.txt
+++ b/requirements/bootstrap-ci.txt
@@ -182,9 +182,9 @@ pdm==2.29.2 \
--hash=sha256:b17dcc9b55b94694d63afc56053afb7d580e963bb038c753df2cd18fda71182d \
--hash=sha256:bad9705e9482e7d877a53380ff25273b01e9c1d313ee6ce7b215a6562a9d8bdd
-pip==26.2.1 \
- --hash=sha256:71138adf1f4ca900cdb7d289c21b7494329f2332b6d85f0e1c42108c0384ed3e \
- --hash=sha256:f6ad667e89a1fe78046c8f13232b247200f5258d7828f3f7883d660878e0813f
+pip==26.2.2 \
+ --hash=sha256:fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70 \
+ --hash=sha256:3a8e5c800492787f33a4114ef54444546c340df428974ebba17e0fd47e11af2f
platformdirs==4.13.0 \
--hash=sha256:1aa0b0d3f224c1f07c295121e312a5a24a180d6ae5a8425ea1784b3e3863e9c0 \
diff --git a/requirements/bootstrap-runtime.txt b/requirements/bootstrap-runtime.txt
index aee55cb3d7..6d94aa0fc8 100644
--- a/requirements/bootstrap-runtime.txt
+++ b/requirements/bootstrap-runtime.txt
@@ -22,6 +22,6 @@
# environments - pins pip itself without constraining application dependencies.
-pip==26.2.1 \
- --hash=sha256:71138adf1f4ca900cdb7d289c21b7494329f2332b6d85f0e1c42108c0384ed3e \
- --hash=sha256:f6ad667e89a1fe78046c8f13232b247200f5258d7828f3f7883d660878e0813f
+pip==26.2.2 \
+ --hash=sha256:fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70 \
+ --hash=sha256:3a8e5c800492787f33a4114ef54444546c340df428974ebba17e0fd47e11af2f
diff --git a/requirements/pip-vendor-refresh.txt b/requirements/pip-vendor-refresh.txt
index 70044190ce..4b1adc71b7 100644
--- a/requirements/pip-vendor-refresh.txt
+++ b/requirements/pip-vendor-refresh.txt
@@ -1,7 +1,7 @@
# Inputs for scripts/refresh_pip_urllib3.py. Download wheels only; the script
# rebuilds pip with upstream urllib3 2.8.0 and retains pip's vendoring changes.
# Remove this refresh when the bootstrap pip release vendors urllib3 >=2.8.0.
-pip==26.2.1 \
- --hash=sha256:71138adf1f4ca900cdb7d289c21b7494329f2332b6d85f0e1c42108c0384ed3e
+pip==26.2.2 \
+ --hash=sha256:fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70
urllib3==2.8.0 \
--hash=sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3
diff --git a/scripts/refresh_pip_urllib3.py b/scripts/refresh_pip_urllib3.py
index 9017e9e025..43922961a9 100644
--- a/scripts/refresh_pip_urllib3.py
+++ b/scripts/refresh_pip_urllib3.py
@@ -1,13 +1,13 @@
"""Refresh pip's bundled urllib3 until pip releases its upstream update.
-Inputs are the unmodified, hash-verified PyPI wheels for pip 26.2.1 and
+Inputs are the unmodified, hash-verified PyPI wheels for pip 26.2.2 and
urllib3 2.8.0. Preserve pip's namespace rewrites and disabled Brotli support,
update its vendor manifest and CycloneDX SBOM, and regenerate wheel RECORD.
The Docker build installs this wheel and also replaces ensurepip's copy so
creating a venv cannot restore the vulnerable vendored urllib3 2.7.0.
Upstream fixes: https://github.com/urllib3/urllib3/releases/tag/2.8.0
-Vendoring baseline: https://github.com/pypa/pip/tree/26.2.1/src/pip/_vendor
+Vendoring baseline: https://github.com/pypa/pip/tree/26.2.2/src/pip/_vendor
Delete this helper and its Docker wiring when a pinned pip release carries
urllib3 >=2.8.0. A changed input or ensurepip layout requires a new review.
"""
@@ -29,12 +29,12 @@ from pathlib import Path
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo
-PIP_VERSION = "26.2.1"
+PIP_VERSION = "26.2.2"
URLLIB3_VERSION = "2.8.0"
PIP_WHEEL = f"pip-{PIP_VERSION}-py3-none-any.whl"
URLLIB3_WHEEL = f"urllib3-{URLLIB3_VERSION}-py3-none-any.whl"
INPUT_HASHES = {
- PIP_WHEEL: "71138adf1f4ca900cdb7d289c21b7494329f2332b6d85f0e1c42108c0384ed3e", # DevSkim: ignore DS173237 - public integrity checksum, not a secret
+ PIP_WHEEL: "fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70", # DevSkim: ignore DS173237 - public integrity checksum, not a secret
URLLIB3_WHEEL: "0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3", # DevSkim: ignore DS173237 - public integrity checksum, not a secret
}
VENDOR = "pip/_vendor/"
diff --git a/tests/ci/standalone/test_pip_vendor_refresh.py b/tests/ci/standalone/test_pip_vendor_refresh.py
new file mode 100644
index 0000000000..27591cbc2d
--- /dev/null
+++ b/tests/ci/standalone/test_pip_vendor_refresh.py
@@ -0,0 +1,166 @@
+"""Check reviewed pip refresh inputs and installation boundaries offline."""
+
+from contextlib import contextmanager
+import hashlib
+import importlib.util
+from pathlib import Path
+import sys
+import tempfile
+from types import SimpleNamespace
+import unittest
+from unittest.mock import patch
+
+
+ROOT = Path(__file__).resolve().parents[3]
+SPEC = importlib.util.spec_from_file_location(
+ "pip_vendor_refresh", ROOT / "scripts/refresh_pip_urllib3.py"
+)
+refresh = importlib.util.module_from_spec(SPEC)
+SPEC.loader.exec_module(refresh)
+
+
+class RefreshInstallationChecks(unittest.TestCase):
+ def setUp(self):
+ temporary = tempfile.TemporaryDirectory()
+ self.addCleanup(temporary.cleanup)
+ self.root = Path(temporary.name)
+ self.bundle = self.root / "ensurepip/_bundled" / refresh.PIP_WHEEL
+ self.bundle.parent.mkdir(parents=True)
+ self.original = b"synthetic reviewed seed wheel"
+ self.rebuilt = b"synthetic refreshed wheel"
+ self.bundle.write_bytes(self.original)
+ self.wheel = self.root / "rebuilt" / refresh.PIP_WHEEL
+ self.wheel.parent.mkdir()
+ self.wheel.write_bytes(self.rebuilt)
+ self.verifier = self.root / "verify.py"
+ self.verifier.write_text("# Synthetic verifier\n", encoding="utf-8")
+ self.pip = SimpleNamespace(__version__="26.2.2")
+ self.ensurepip = SimpleNamespace(
+ __file__=str(self.bundle.parent.parent / "__init__.py"),
+ version=lambda: "26.2.2",
+ _get_pip_whl_path_ctx=self.selected_bundle,
+ )
+
+ @contextmanager
+ def selected_bundle(self):
+ yield self.bundle
+
+ @contextmanager
+ def installation(self):
+ # No package installation or external process executes in these checks.
+ with (
+ patch.dict(
+ sys.modules, {"pip": self.pip, "ensurepip": self.ensurepip}
+ ),
+ patch.dict(
+ refresh.INPUT_HASHES,
+ {refresh.PIP_WHEEL: hashlib.sha256(self.original).hexdigest()},
+ ),
+ patch.object(refresh.subprocess, "run") as run,
+ ):
+ yield run
+
+ def test_reviewed_pair_refreshes_seed_and_checks_fresh_interpreters(self):
+ with self.installation() as run:
+ refresh.install(self.wheel, self.verifier)
+ self.assertEqual(self.bundle.read_bytes(), self.rebuilt)
+ commands = [call.args[0] for call in run.call_args_list]
+ self.assertEqual(len(commands), 5)
+ self.assertEqual(
+ commands[0][:5], [sys.executable, "-I", "-m", "pip", "install"]
+ )
+ for option in ("--no-index", "--no-deps", "--force-reinstall"):
+ self.assertIn(option, commands[0])
+ expected = ["-I", str(self.verifier), refresh.URLLIB3_VERSION]
+ self.assertEqual(commands[1], [sys.executable, *expected])
+ self.assertEqual(commands[-1][1:], expected)
+ self.assertEqual(commands[-2][:4], [sys.executable, "-I", "-m", "venv"])
+ self.assertNotEqual(commands[-1][0], sys.executable)
+ self.assertTrue(
+ all(call.kwargs["check"] for call in run.call_args_list)
+ )
+
+ def test_repeat_refresh_accepts_only_the_same_rebuilt_seed(self):
+ with self.installation() as run:
+ refresh.install(self.wheel, self.verifier)
+ refresh.install(self.wheel, self.verifier)
+ self.assertEqual(self.bundle.read_bytes(), self.rebuilt)
+ self.assertEqual(run.call_count, 10)
+
+ def test_installed_or_seed_version_drift_is_refused_before_install(self):
+ for component in ("pip", "ensurepip"):
+ with self.subTest(component=component):
+ if component == "pip":
+ self.pip.__version__ = "0.0"
+ else:
+ self.pip.__version__ = "26.2.2"
+ self.ensurepip.version = lambda: "0.0"
+ with self.installation() as run:
+ with self.assertRaisesRegex(
+ ValueError, "pip/ensurepip changed"
+ ):
+ refresh.install(self.wheel, self.verifier)
+ run.assert_not_called()
+ self.assertEqual(self.bundle.read_bytes(), self.original)
+
+ def test_alternative_seed_layout_is_refused_before_install(self):
+ @contextmanager
+ def alternative():
+ yield self.root / "another-wheel.whl"
+
+ self.ensurepip._get_pip_whl_path_ctx = alternative
+ with self.installation() as run:
+ with self.assertRaisesRegex(
+ ValueError, "reviewed bundled-wheel layout"
+ ):
+ refresh.install(self.wheel, self.verifier)
+ run.assert_not_called()
+ self.assertEqual(self.bundle.read_bytes(), self.original)
+
+ def test_changed_seed_bytes_are_refused_before_install(self):
+ self.bundle.write_bytes(b"different synthetic seed")
+ with self.installation() as run:
+ with self.assertRaisesRegex(ValueError, "not the reviewed wheel"):
+ refresh.install(self.wheel, self.verifier)
+ run.assert_not_called()
+ self.assertEqual(self.bundle.read_bytes(), b"different synthetic seed")
+
+ def test_changed_input_is_refused_before_reading_zip_members(self):
+ with patch.object(refresh, "ZipFile") as archive:
+ with self.assertRaisesRegex(ValueError, "unreviewed wheel"):
+ refresh.verified_wheel(self.wheel)
+ archive.assert_not_called()
+
+
+class RefreshConfigurationChecks(unittest.TestCase):
+ def test_all_bootstrap_exports_use_the_reviewed_refresh_pip(self):
+ for name in (
+ "bootstrap-builder.txt",
+ "bootstrap-ci.txt",
+ "bootstrap-runtime.txt",
+ "pip-vendor-refresh.txt",
+ ):
+ with self.subTest(manifest=name):
+ lines = (
+ (ROOT / "requirements" / name)
+ .read_text(encoding="utf-8")
+ .splitlines()
+ )
+ entries = [
+ i
+ for i, line in enumerate(lines)
+ if line.startswith("pip==")
+ ]
+ self.assertEqual(len(entries), 1)
+ index = entries[0]
+ self.assertEqual(
+ lines[index].split()[0], f"pip=={refresh.PIP_VERSION}"
+ )
+ self.assertIn(
+ "--hash=sha256:" + refresh.INPUT_HASHES[refresh.PIP_WHEEL],
+ lines[index + 1],
+ )
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tests/deployment/test_deployment_surface_contracts.py b/tests/deployment/test_deployment_surface_contracts.py
index 0d055054a7..fe6fd63adf 100644
--- a/tests/deployment/test_deployment_surface_contracts.py
+++ b/tests/deployment/test_deployment_surface_contracts.py
@@ -2340,10 +2340,10 @@ class TestUnraidTemplate:
# 9. The CPython base image and fixed-vulnerability scan policy
# ---------------------------------------------------------------------------
-# The first CPython 3.14 release with the upstream CVE-2026-15310 zipfile fix.
-# The base image's tag and the floor of each root stage's build-time
-# interpreter check must both be this version or newer.
-PATCHED_PYTHON = (3, 14, 8)
+# The minimum production CPython version. The base image's tag and the floor
+# of each root stage's build-time interpreter check must both be this version
+# or newer.
+PATCHED_PYTHON = (3, 14, 9)
PATCHED_PYTHON_TEXT = ".".join(str(part) for part in PATCHED_PYTHON)
# The build-time interpreter check, matched against a root stage's whole RUN
@@ -3298,7 +3298,7 @@ class TestCPythonBaseImage:
)
assert Version(match.group(1)) >= Version(PATCHED_PYTHON_TEXT), (
f"Python {match.group(1)} predates {PATCHED_PYTHON_TEXT}, the "
- "first 3.14 release with the CVE-2026-15310 fix"
+ "minimum production interpreter version"
)
assert {"builder-base", "ldr"} <= set(rooted), (
"expected builder-base and ldr to be built directly from "
@@ -3583,7 +3583,7 @@ class TestCPythonBaseImage:
def test_fixed_cves_are_not_suppressed(self):
"""CVEs that no longer apply to the pinned Python stay unsuppressed.
- Most are fixed in 3.14.8 or earlier. The CVE records of two others
+ The fixes are included in 3.14.9. The CVE records of two others
list 3.14 as affected only below 3.14.8, although 3.14 keeps the
behaviour they describe.
"""
@@ -3598,6 +3598,7 @@ class TestCPythonBaseImage:
"CVE-2026-19672", # tarfile, fixed in 3.14.8
"CVE-2026-15806", # urllib, fixed in 3.14.8
"CVE-2026-17084", # stringprep, fixed in 3.14.8
+ "CVE-2026-12345", # tempfile, fixed in 3.14.9
}
outside_record_range = {
# base64 altchars: affected below 3.14.1 per the record; the
@@ -3609,59 +3610,62 @@ class TestCPythonBaseImage:
}
assert not ((fixed_in_base_image | outside_record_range) & ignored)
- def test_cve_2026_87910_stays_visible_to_the_release_gate(self):
- """CVE-2026-87910 is not suppressed, although the pinned Python has it.
-
- Python 3.14.8 does not fix it: the 3.14 backport of its tarfile fix
- (gh-157265) merged after the v3.14.8 tag. It is left unsuppressed on
- purpose, so that the release gate keeps reporting it until an
- official python image has the fix. Suppressing it changes that
- policy, so it has to change this test too.
- """
+ def test_cve_2026_87910_is_not_suppressed(self):
+ """Keep this advisory subject to the normal scanner policy."""
assert "CVE-2026-87910" not in suppressed_vulnerabilities()
- def test_cve_2026_12345_is_a_release_exception_not_a_suppression(self):
- """CVE-2026-12345 stays visible; the release gate accepts it until 3.14.9.
-
- Its 3.14 backport (python/cpython#158430) also merged after the
- v3.14.8 tag. The alert-only Grype finding is accepted through an
- expiring release exception (.github/SECURITY_ALERTS.md, "Temporary
- release exceptions") so the alert stays open, and the exception must
- go once the base image reaches the first fixed release.
- """
- assert "CVE-2026-12345" not in suppressed_vulnerabilities()
+ def test_fixed_cpython_release_exception_is_removed(self):
+ """The fixed base image no longer needs the previous alert exception."""
policy = json.loads(
(
REPO_ROOT / ".github" / "release-security-exceptions.json"
).read_text(encoding="utf-8")
)
- entries = [
- entry
+ assert not any(
+ entry["alert_number"] == 9725
+ or entry["rule_id"] == "CVE-2026-12345-python"
for entry in policy["exceptions"]
- if entry["rule_id"] == "CVE-2026-12345-python"
- ]
+ )
+
+
+class TestUnstructuredScannerSuppressions:
+ """The unstructured HTML-output XSS suppressions, pinned line by line.
+
+ GHSA-v5mq-3xhg-98m9 / CVE-2026-104250 (alerts #9736-#9738, dismissed
+ 2026-10-18) is accepted as unreachable; the compensating control lives
+ in tests/security/test_unstructured_html_output_tripwire.py. These
+ tests pin the exact scanner entries — both advisory IDs in .grype.yaml
+ scoped to the unstructured package, and both .trivyignore lines with
+ their shared expiry — so deleting any one rule or line, or rescoping
+ it, fails a named test here instead of passing silently.
+ """
+
+ def test_ghsa_v5mq_3xhg_98m9_is_suppressed_for_unstructured_in_grype(
+ self,
+ ):
+ """.grype.yaml ignores both advisory IDs for unstructured only."""
+ scanner_policy = yaml.safe_load(
+ (REPO_ROOT / ".grype.yaml").read_text(encoding="utf-8")
+ )
assert [
- (
- entry["alert_number"],
- entry["tool"],
- entry["category"],
- entry["path"],
- entry["expires_on"],
- )
- for entry in entries
+ entry.get("package")
+ for entry in scanner_policy["ignore"]
+ if entry.get("vulnerability")
+ in ("GHSA-v5mq-3xhg-98m9", "CVE-2026-104250")
+ ] == [{"name": "unstructured"}, {"name": "unstructured"}]
+
+ def test_ghsa_v5mq_3xhg_98m9_trivyignore_lines_expire_2026_12_19(self):
+ """.trivyignore keeps both advisory lines with the same expiry date."""
+ trivyignore = (REPO_ROOT / ".trivyignore").read_text(encoding="utf-8")
+ assert [
+ line
+ for line in trivyignore.splitlines()
+ if line.split()
+ and line.split()[0] in ("GHSA-v5mq-3xhg-98m9", "CVE-2026-104250")
] == [
- (
- 9725,
- "Grype",
- "grype-container",
- "local-deep-research//usr/local/bin/python3.14",
- "2026-12-15",
- )
+ "CVE-2026-104250 exp:2026-12-19",
+ "GHSA-v5mq-3xhg-98m9 exp:2026-12-19",
]
- assert Version(PATCHED_PYTHON_TEXT) < Version("3.14.9"), (
- "The base image is on 3.14.9+: remove the CVE-2026-12345 release "
- "exception and this test"
- )
# ---------------------------------------------------------------------------
@@ -3726,7 +3730,7 @@ class TestCIMarkerLaneWiring:
# The minimum the Dockerfile's pyexpat checks enforce. It must be the expat
# that the base image's CPython release bundles (BUNDLED_EXPAT). Change it
# together with those RUN lines and the version in their failure message.
-PYEXPAT_MINIMUM = (2, 8, 5)
+PYEXPAT_MINIMUM = (2, 9, 0)
# The expat version that each CPython release bundles, from
# Modules/expat/expat.h (XML_MAJOR_VERSION, XML_MINOR_VERSION and
@@ -3735,6 +3739,7 @@ PYEXPAT_MINIMUM = (2, 8, 5)
BUNDLED_EXPAT = {
(3, 14, 7): (2, 8, 2),
(3, 14, 8): (2, 8, 5),
+ (3, 14, 9): (2, 9, 0),
}
# The build-time pyexpat check, matched against a root stage's whole RUN
@@ -3902,10 +3907,8 @@ REWRITTEN_PYEXPAT_CHECKS = [
OPTIMISATION_FLAGS = ((), ("-O",), ("-OO",))
# The expat versions that pyexpat_check_failures runs a check's code at.
-# With PYEXPAT_MINIMUM at 2.8.5, four of them are below it: 2.8.2, which
-# CPython 3.14.7 bundles, the patch release just below the minimum, and two
-# versions whose minor or micro version alone is not below the minimum's.
-# The other three are at or above it.
+# Include earlier bundled versions and versions on both sides of the current
+# minimum. The expected result always compares the complete version tuple.
EXPAT_PROBE_VERSIONS = (
(1, 99, 99),
(2, 7, 9),
diff --git a/tests/security/test_unstructured_html_output_tripwire.py b/tests/security/test_unstructured_html_output_tripwire.py
index aa6888608c..8357984fa4 100644
--- a/tests/security/test_unstructured_html_output_tripwire.py
+++ b/tests/security/test_unstructured_html_output_tripwire.py
@@ -7,9 +7,13 @@ output of ``elements_to_html()`` without escaping, so a crafted document's
``<img onerror=...>`` runs wherever that HTML is shown. Every fixed release
so far (0.24.1 through 0.27.28, checked 2026-10-17) declares
``Requires-Python: <3.14``, as has every release since 0.20.2, so none can be
-locked. The OSV finding is ignored in osv-scanner.toml, and the Trivy alert
-and both Grype alerts (lockfile and image) are expiring entries in
-.github/release-security-exceptions.json.
+locked. The finding is ignored in osv-scanner.toml, .trivyignore and
+.grype.yaml. The Trivy alert and both Grype alerts (lockfile and image,
+#9736-#9738) were dismissed on 2026-10-18. Dismissal status persists
+independently of scanner suppressions, so their entries in
+.github/release-security-exceptions.json are dormant audit records. The
+existing osv-scanner.toml ignoreUntil date (2026-10-31) requires review
+through the completed release scan.
The compensating control this file pins: LDR never invokes the v2 ontology
HTML emitter and never reads element metadata or ``elements_to_html`` output.
diff --git a/tests/security/test_unstructured_url_partition_tripwire.py b/tests/security/test_unstructured_url_partition_tripwire.py
index edf05fceed..32822edc94 100644
--- a/tests/security/test_unstructured_url_partition_tripwire.py
+++ b/tests/security/test_unstructured_url_partition_tripwire.py
@@ -134,10 +134,14 @@ def test_locked_unstructured_still_needs_suppression() -> None:
f"pdm.lock contains fixed unstructured {versions}: remove the "
"GHSA-4mvj-m6j5-pmf7 .trivyignore/.grype.yaml/osv-scanner.toml "
"suppressions and this temporary tripwire. From 0.24.1 also remove "
- "the GHSA-v5mq-3xhg-98m9 osv-scanner.toml ignore, its three entries "
+ "the GHSA-v5mq-3xhg-98m9 / CVE-2026-104250 osv-scanner.toml, "
+ ".trivyignore and .grype.yaml ignores, its three entries "
"in .github/release-security-exceptions.json (9736 under "
"CVE-2026-104250, 9737 and 9738 under "
- "GHSA-v5mq-3xhg-98m9-unstructured) and "
+ "GHSA-v5mq-3xhg-98m9-unstructured), the 'Accepted findings also "
+ "suppressed in the scanner' subsection in .github/SECURITY_ALERTS.md, "
+ "the TestUnstructuredScannerSuppressions tests in "
+ "tests/deployment/test_deployment_surface_contracts.py and "
"test_unstructured_html_output_tripwire.py"
)