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): cover the Grype unstructured XSS alerts with release exceptions (#7485)

LearningCircuit9baec41ce615
diff --git a/.github/SECURITY_ALERTS.md b/.github/SECURITY_ALERTS.md
index 6250a12e71..d3c4102a99 100644
--- a/.github/SECURITY_ALERTS.md
+++ b/.github/SECURITY_ALERTS.md
@@ -117,10 +117,10 @@ a tracking link beside the entry, and remove the entry once the fix ships.
fail, while the same advisory in a new package does. Add an
`[[IgnoredVulns]]` entry with `id`, `ignoreUntil`, and `reason`
to the `osv-scanner.toml` in the affected lockfile's directory. `ignoreUntil`
- is a native expiry: afterwards the finding fails the scan again. The two v2
+ is a native expiry: afterwards the finding fails the scan again. The three v2
release entries in [osv-scanner.toml](../osv-scanner.toml)
- (`GHSA-8mgp-746c-j5xp` and `GHSA-4mvj-m6j5-pmf7`, `ignoreUntil = 2026-10-31`)
- are the model.
+ (`GHSA-8mgp-746c-j5xp`, `GHSA-4mvj-m6j5-pmf7` and `GHSA-v5mq-3xhg-98m9`,
+ `ignoreUntil = 2026-10-31`) are the model.
- **Trivy during Docker publication**: the `Security Scan` job in
`prerelease-docker.yml` and the digest rescan in `docker-publish.yml` fail on
fixable critical or high image findings, after release approval. Both read
diff --git a/.github/release-security-exceptions.json b/.github/release-security-exceptions.json
index 19e0a6ee00..aa3997f6e7 100644
--- a/.github/release-security-exceptions.json
+++ b/.github/release-security-exceptions.json
@@ -21,7 +21,29 @@
"path": "install/.venv/lib/python3.14/site-packages/unstructured-0.18.32.dist-info/METADATA",
"severity": "medium",
"expires_on": "2026-12-19",
- "reason": "GHSA-v5mq-3xhg-98m9 stored XSS in unstructured's HTML output (metadata.text_as_html, elements_to_html). The only fix, 0.24.1, requires Python <3.14 like every release since 0.24.0, so it cannot be locked. LDR never produces or reads that HTML: unstructured-backed loaders run in langchain's single mode (joined element text, no element metadata) and extracted text is escaped when rendered. Enforced by tests/security/test_unstructured_html_output_tripwire.py. Lock a 3.14-compatible fixed release, rescan and remove this entry.",
+ "reason": "GHSA-v5mq-3xhg-98m9 stored XSS in unstructured's HTML output (metadata.text_as_html, elements_to_html). Every fixed release so far (0.24.1 through 0.27.28, checked 2026-10-17) requires Python <3.14, as has every release since 0.20.2, so none can be locked. LDR never invokes the v2 ontology HTML emitter and never reads element metadata or elements_to_html output (single-mode loaders still compute an escaped v1 text_as_html that langchain discards). Guarded for the direct forms by tests/security/test_unstructured_html_output_tripwire.py. Lock a 3.14-compatible fixed release, rescan and remove this entry.",
+ "tracking_url": "https://github.com/LearningCircuit/local-deep-research/pull/7467"
+ },
+ {
+ "alert_number": 9737,
+ "rule_id": "GHSA-v5mq-3xhg-98m9-unstructured",
+ "tool": "Grype",
+ "category": "grype-filesystem",
+ "path": "/pdm.lock",
+ "severity": "medium",
+ "expires_on": "2026-12-19",
+ "reason": "GHSA-v5mq-3xhg-98m9 stored XSS in unstructured's HTML output (metadata.text_as_html, elements_to_html), as reported by Grype for the lockfile. Same advisory and compensating control as the Trivy entry 9736: every fixed release so far (0.24.1 through 0.27.28, checked 2026-10-17) requires Python <3.14, as has every release since 0.20.2, and LDR never invokes the v2 ontology HTML emitter and never reads element metadata or elements_to_html output (single-mode loaders still compute an escaped v1 text_as_html that langchain discards). Guarded for the direct forms by tests/security/test_unstructured_html_output_tripwire.py. Lock a 3.14-compatible fixed release, rescan and remove this entry.",
+ "tracking_url": "https://github.com/LearningCircuit/local-deep-research/pull/7467"
+ },
+ {
+ "alert_number": 9738,
+ "rule_id": "GHSA-v5mq-3xhg-98m9-unstructured",
+ "tool": "Grype",
+ "category": "grype-container",
+ "path": "local-deep-research//install/.venv/lib/python3.14/site-packages/unstructured-0.18.32.dist-info/METADATA",
+ "severity": "medium",
+ "expires_on": "2026-12-19",
+ "reason": "GHSA-v5mq-3xhg-98m9 stored XSS in unstructured's HTML output (metadata.text_as_html, elements_to_html), as reported by Grype for the container image. Same advisory and compensating control as the Trivy entry 9736: every fixed release so far (0.24.1 through 0.27.28, checked 2026-10-17) requires Python <3.14, as has every release since 0.20.2, and LDR never invokes the v2 ontology HTML emitter and never reads element metadata or elements_to_html output (single-mode loaders still compute an escaped v1 text_as_html that langchain discards). Guarded for the direct forms by tests/security/test_unstructured_html_output_tripwire.py. Lock a 3.14-compatible fixed release, rescan and remove this entry.",
"tracking_url": "https://github.com/LearningCircuit/local-deep-research/pull/7467"
}
]
diff --git a/.grype.yaml b/.grype.yaml
index 6467d1db32..9524eb8184 100644
--- a/.grype.yaml
+++ b/.grype.yaml
@@ -520,6 +520,10 @@ 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 }
diff --git a/tests/security/test_unstructured_html_output_tripwire.py b/tests/security/test_unstructured_html_output_tripwire.py
index 488a305c31..aa6888608c 100644
--- a/tests/security/test_unstructured_html_output_tripwire.py
+++ b/tests/security/test_unstructured_html_output_tripwire.py
@@ -4,16 +4,20 @@ unstructured 0.18.32 — the newest release that installs on Python 3.14 — is
affected by GHSA-v5mq-3xhg-98m9 / CVE-2026-104250 (Medium): the v2 ontology
HTML emitter copies document markup into ``metadata.text_as_html`` and the
output of ``elements_to_html()`` without escaping, so a crafted document's
-``<img onerror=...>`` runs wherever that HTML is shown. The fix (0.24.1)
-declares ``Requires-Python: <3.14``, like every release since 0.24.0, so it
-cannot be locked. The OSV finding is ignored in osv-scanner.toml and the
-Trivy alert is an expiring entry in .github/release-security-exceptions.json.
-
-The compensating control this file pins: LDR never produces or reads
-unstructured's HTML output. Every unstructured-backed loader is a
-langchain-community ``Unstructured*Loader`` in its default ``"single"`` mode,
-which returns ``"\\n\\n".join(str(element))`` with only ``{"source": path}``
-as metadata, and ``es_utils.index_file`` uses element text the same way.
+``<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.
+
+The compensating control this file pins: LDR never invokes the v2 ontology
+HTML emitter and never reads element metadata or ``elements_to_html`` output.
+Every unstructured-backed loader is a langchain-community
+``Unstructured*Loader`` in its default ``"single"`` mode, which returns
+``"\\n\\n".join(str(element))`` with only ``{"source": path}`` as metadata, and
+``es_utils.index_file`` uses element text the same way. Single-mode loaders
+still compute an escaped v1 ``text_as_html`` that langchain discards.
Element text is not markup-free: a document whose text literally reads
``<img onerror=...>`` keeps those characters. Escaping at render time
diff --git a/tests/security/test_unstructured_url_partition_tripwire.py b/tests/security/test_unstructured_url_partition_tripwire.py
index 5a7ed28975..edf05fceed 100644
--- a/tests/security/test_unstructured_url_partition_tripwire.py
+++ b/tests/security/test_unstructured_url_partition_tripwire.py
@@ -134,8 +134,10 @@ 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 entry in "
- ".github/release-security-exceptions.json and "
+ "the GHSA-v5mq-3xhg-98m9 osv-scanner.toml ignore, its three entries "
+ "in .github/release-security-exceptions.json (9736 under "
+ "CVE-2026-104250, 9737 and 9738 under "
+ "GHSA-v5mq-3xhg-98m9-unstructured) and "
"test_unstructured_html_output_tripwire.py"
)