dify/api/tests/integration_tests/workflow/nodes
Devbyteai 26444d8b6c fix(template-transform): use base64 encoding for Jinja2 templates
When Jinja2 templates containing special characters (quotes, newlines)
were embedded directly in the generated Python script using triple-quoted
strings, the script would break. This fix encodes the template as base64
before embedding, then decodes it at runtime.

Root cause: Templates were inserted via string replacement into a Python
script like `jinja2.Template('''...''')`. If the template contained `'''`,
the generated script had a syntax error.

Solution: Add serialize_code() method to base64-encode templates, then
override assemble_runner_script() in Jinja2TemplateTransformer to use
the encoded template with runtime decoding.

This specifically affects Jinja2 templates - Python3 and JavaScript
transformers insert user code at the top level (not inside strings),
so they don't have this vulnerability.

Fixes #26818
2025-12-26 20:08:12 +02:00
..
__mock remove bare list, dict, Sequence, None, Any (#25058) 2025-09-06 03:32:23 +08:00
code_executor fix(template-transform): use base64 encoding for Jinja2 templates 2025-12-26 20:08:12 +02:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
test_code.py Refactor: centralize node data hydration (#27771) 2025-11-27 15:41:56 +08:00
test_http.py fix: validate API key is not empty in HTTPRequest node (#29950) 2025-12-21 17:04:07 +08:00
test_llm.py Refactor: centralize node data hydration (#27771) 2025-11-27 15:41:56 +08:00
test_parameter_extractor.py Refactor: centralize node data hydration (#27771) 2025-11-27 15:41:56 +08:00
test_template_transform.py Refactor: centralize node data hydration (#27771) 2025-11-27 15:41:56 +08:00
test_tool.py Refactor: centralize node data hydration (#27771) 2025-11-27 15:41:56 +08:00