Immutable solution version
ConditionalRouter output type is not working anymore
Complete solution
Haystack: Intentional breaking change in the 2.3.1 security patch: ConditionalRouter can now only return Python literal types (str, bytes, numbers, tuples, lists, dicts, sets, bools, None) because rendering arbitrary types via Jinja was a remote-code-execution risk. Contributor silvanocerza: to opt back into the old behavior, build ConditionalRouter/OutputAdapter with unsafe=True (shipped in 2.4.0) - safe as long as you don't let end users write
The problem
Issue deepset-ai/haystack#8161 (closed, 13 comments): Describe the bug We tried to update the Haystack version to 2.3.1 due to the security update and our code stopped working. We identified that the ConditionalRouter is returning a string instead of the type assigned in output_type Error message We are getting errors related to the fact that a string is now being returned. Here is an example of the error when running the provided code: AttributeError: 'str' object has no attribute 'content' Expected behavior We expected that the output_type provided in the route wo
The verified fix
Intentional breaking change in the 2.3.1 security patch: ConditionalRouter can now only return Python literal types (str, bytes, numbers, tuples, lists, dicts, sets, bools, None) because rendering arbitrary types via Jinja was a remote-code-execution risk. Contributor silvanocerza: to opt back into the old behavior, build ConditionalRouter/OutputAdapter with unsafe=True (shipped in 2.4.0) - safe as long as you don't let end users write the Jinja templates themselves - or write a custom routing component; otherwise pin to 2.3.0.
Evidence
In gh:deepset-ai/haystack#8161 (https://github.com/deepset-ai/haystack/issues/8161), someone reported: Issue deepset-ai/haystack#8161 (closed, 13 comments): Describe the bug We tried to update the Haystack version to 2.3.1 due to the security update and our code stopped working. We identified that the ConditionalRouter is returning a string instead of the type assigned in output_type Error message We are getting errors related to the fact that a string is now being returned. Here is an example of the error when running the provided code: AttributeError: 'str' object has no attribute 'content' Expected behavior We expected that the output_type provided in the route wo The verified resolution from the thread: Intentional breaking change in the 2.3.1 security patch: ConditionalRouter can now only return Python literal types (str, bytes, numbers, tuples, lists, dicts, sets, bools, None) because rendering arbitrary types via Jinja was a remote-code-execution risk. Contributor silvanocerza: to opt back into the old behavior, build ConditionalRouter/OutputAdapter with unsafe=True (shipped in 2.4.0) - safe as long as you don't let end users write the Jinja templates themselves - or write a custom routing component; otherwise pin to 2.3.0.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_XIr4wp7fouIoLQcgLwen1Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ConditionalRouter output type is not working anymore <span>— Vectle</span></a>