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.

fix(security): correct CVE-2026-6653 rationale (lxml bundles patched libxml2) + build guard (#4785)

LearningCircuite30bf6aae0f7
diff --git a/.grype.yaml b/.grype.yaml
index 9bb5fc9919..38ec0f5955 100644
--- a/.grype.yaml
+++ b/.grype.yaml
@@ -255,16 +255,18 @@ ignore:
# --- libxml2 ---
# CVE-2026-6653 (high): UAF in xmlParseInternalSubset (XML internal-DTD
- # parameter entities), affects 2.9.11-2.11.0. Trixie's 2.9.14 base is
- # vulnerable with no backport (fixed only in sid/forky 2.15.x) — nothing to
- # apt-upgrade to. The vulnerable XML parser is reached only by authenticated
- # per-user document uploads: .xml via unstructured/lxml and Office formats
- # (.docx/.odt/.pptx/.xlsx) via python-docx/python-pptx/openpyxl/lxml.
- # Untrusted scraped web HTML uses libxml2's HTML parser, which never calls
- # xmlParseInternalSubset; arXiv/PubMed XML is TLS-fetched from trusted
- # upstreams. DoS-primary (crash), CVSS 4.0 7.0, AC:H.
+ # parameter entities), affects 2.9.11-2.11.0; Trixie's 2.9.14 base is
+ # vulnerable with no backport (fixed only in sid/forky 2.15.x). NOT REACHABLE
+ # in this image: the flagged system libxml2 (2.9.14) is present but UNUSED.
+ # All XML/HTML parsing goes through lxml, which statically bundles its own
+ # libxml2 2.14.x — past the 2.11.0 fix (verified: etree.LIBXML_VERSION is
+ # (2,14,6) and lxml's etree.so has no libxml2.so in `ldd`; pdm.lock pins
+ # manylinux lxml wheels). The Python stdlib XML uses expat, not libxml2.
+ # A build-time assertion in the Dockerfile (after `pdm install`) fails the
+ # build if lxml ever ends up linked against a pre-2.11 libxml2 (e.g. an sdist
+ # fallback against the system lib), so a vulnerable parser can never ship.
- vulnerability: CVE-2026-6653
- reason: "High UAF in xmlParseInternalSubset (XML internal-DTD param entities); affects 2.9.11-2.11.0. Trixie 2.9.14-base vulnerable, no backport (fixed only in sid/forky 2.15.x). libxml2's XML parser is reached only by authenticated per-user uploads (.xml + Office .docx/.odt/.pptx/.xlsx via lxml); scraped HTML uses the HTML parser, not xmlParseInternalSubset. DoS-primary, CVSS 4.0 7.0, AC:H."
+ reason: "High UAF in xmlParseInternalSubset (libxml2 2.9.11-2.11.0); Trixie 2.9.14 vulnerable, no backport (fixed in sid/forky 2.15.x). NOT reachable: system libxml2 present but unused — all XML parsing uses lxml's bundled libxml2 2.14.x (verified; manylinux wheels), stdlib uses expat. A Dockerfile assertion blocks any pre-2.11 lxml. DoS-primary, CVSS 4.0 7.0."
- vulnerability: CVE-2026-1757
reason: "Memory leak in xmllint CLI shell. Negligible impact. Debian: unimportant. No xmllint usage."
- vulnerability: CVE-2025-8732
diff --git a/Dockerfile b/Dockerfile
index 2bde00f32d..25929f6909 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -115,6 +115,15 @@ RUN for i in 1 2 3; do \
fi; \
done
+# Fail the build if lxml is not using a patched libxml2. lxml's manylinux
+# wheels statically bundle their own libxml2 (>= 2.14), so the document loaders
+# never touch the system libxml2 (Trixie's 2.9.14, vulnerable to CVE-2026-6653).
+# If a future Python ever outruns lxml's wheel coverage, `pdm install` could
+# build lxml from an sdist linked against that system libxml2 — this assertion
+# makes such a build fail loudly instead of shipping a vulnerable parser.
+# See .grype.yaml (CVE-2026-6653).
+RUN /install/.venv/bin/python -c "from lxml import etree; v = etree.LIBXML_VERSION; assert v >= (2, 11, 0), f'lxml is linked against vulnerable libxml2 {v} (the CVE-2026-6653 fix is in 2.11.0); expected a wheel-bundled libxml2'; print(f'lxml uses libxml2 {v} (>= 2.11.0 CVE-2026-6653 fix) OK')"
+
####
# Container for running tests.