Haystack patches a critical injection vulnerability in ChatPromptBuilder template rendering. Your prompt variables are now sanitized by default - but verify your current deployments.

Automatic template variable sanitization removes a real injection risk in production RAG systems without requiring code changes.
Signal analysis
Here at Lead AI Dot Dev, we tracked this release closely because it addresses a real attack surface in production systems. Haystack's ChatPromptBuilder was processing template variables without proper sanitization, meaning specially crafted input could be interpreted as structured content - specifically images and tool calls - rather than plain text. This isn't a theoretical issue. If you're building RAG systems or agents that accept user input and pass it through prompt templates, an attacker could inject image tags, tool invocations, or other structured directives that bypass your intended prompt logic.
The root cause: variable interpolation happened before content-type validation. Your template variables were treated as potentially rich content rather than strings. This matters because modern LLM frameworks like Haystack support multiple content types in prompts - text, images, tool calls. Without sanitization at the right stage, user-controlled data could masquerade as these types.
The fix enforces automatic sanitization during template rendering, converting all variables to plain text representations before they're processed as structured content. This is the correct defensive layer - at the variable injection point, not downstream.
If you're running Haystack in production with user-facing RAG or agent systems, this is a patch priority. Template injection vulnerabilities sit at the intersection of your input layer and your LLM calls - exactly where you need defense. The vulnerability isn't in Haystack's core design; it's in the specific rendering logic of ChatPromptBuilder, which many teams rely on for flexible prompt construction.
The secondary fix for DocumentCleaner's malformed log format strings is lower-severity but still worth noting. Malformed logging can mask other issues in production - you want clean logs when debugging failures. This patch tightens that observability layer.
The RC status matters: this is release candidate, not stable. You should test v2.26.1-rc1 in staging environments first, verify backward compatibility with your prompt templates, and plan your rollout. Sanitization is generally safe, but any changes to how variables are processed could reveal edge cases in your specific usage.
The sanitization logic converts template variables to string representations before they're evaluated as potential structured content. This means if you're dynamically building prompts with user input, you're now protected by default. The implementation sits in the ChatPromptBuilder's render method, so it applies everywhere you use that component.
For teams using Haystack's pipeline abstraction, this change is transparent - you don't need code modifications. But if you have custom components that directly instantiate ChatPromptBuilder, verify that your template patterns still work. Edge cases to test: variables containing special characters, variables used in tool definition strings, variables in system prompts versus user messages.
The DocumentCleaner fix addresses logging stability. If you have monitoring or log aggregation that depends on specific formatting, verify that your parsing rules still work with the corrected format. This is typically a non-breaking fix, but malformed logs can sometimes trick parsers.
Thank you for listening, Lead AI Dot Dev
Best use cases
Open the scenarios below to see where this shift creates the clearest practical advantage.
One concise email with the releases, workflow changes, and AI dev moves worth paying attention to.
More updates in the same lane.
Mistral Forge allows organizations to convert proprietary knowledge into custom AI models, enhancing enterprise capabilities.
Version 8.1 of the MongoDB Entity Framework Core Provider brings essential updates. This article analyzes the implications for builders.
The latest @composio/core update enhances Toolrouter with custom tool integration, expanding flexibility for developers.