GHSA-926x-3r5x-gfhw: LangChain has incomplete f-string validation in prompt templates
- Identifier
- GHSA-926x-3r5x-gfhw
- Published
- Record updated
- Affected
- langchain-core >= 1.0.0a1, < 1.2.28, fixed in 1.2.28, released April 8, 2026, on the day of disclosure
- langchain-core < 0.3.83, fixed in 0.3.84, released April 8, 2026, on the day of disclosure
Summary
LangChain's f-string prompt-template validation was incomplete in two ways. DictPromptTemplate and ImagePromptTemplate accepted templates with attribute access or indexing expressions and evaluated them during formatting, and validation did not reject nested replacement fields inside format specifiers. Exposure needs untrusted template strings and richer Python objects passed into formatting.
Mitigation
LangChain now applies f-string safety validation consistently to DictPromptTemplate and ImagePromptTemplate, rejecting templates with attribute access or indexing during construction and deserialization. It also rejects nested replacement fields inside format specifiers, raising an error for variable names containing '.' or '[]' and format specifiers containing '{' or '}'. Ordinary f-string format specifiers and conversions remain supported.
Affected packages in the Exposure Registry
Matched by package name and ecosystem. Each entry shows whether the package delegates to a language model and how many tracked packages depend on it.
- langchain-corePyPILLM dependency since 2023-11-20 · 59 tracked dependents
Related items
- MediumGHSA-8prr-f582-jqq3: LangGraph CLI prints the registry push token in `langgraph deploy --verbose` outputSame vendor · GitHub Advisory Database
- HighGHSA-4hm6-w6qq-w73v: LangGraph JavaScript custom authentication may permit cross-user Store accessSame vendor · GitHub Advisory Database
- MediumGHSA-3fx2-cqw9-xr3c: LangGraph: Unencoded identifiers in LangGraph SDK v3 streaming can redirect authenticated GET requestsSame vendor · GitHub Advisory Database
- MediumGHSA-6hmw-9432-67qq: LangGraph: Namespace labels containing `.` reach other namespaces in Postgres and SQLite storesSame vendor · GitHub Advisory Database
- MediumCVE-2026-108575: BerriAI LiteLLM improper authorization in secret resolution via api_keySame vendor · NVD/CVE Database