Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix(api): reject trailing newlines in user_input_form variable names (#42029)
Harsh Kashyapcc44574543c4
diff --git a/api/core/app/app_config/easy_ui_based_app/variables/manager.py b/api/core/app/app_config/easy_ui_based_app/variables/manager.pyindex ddb500cccf5..d7730948516 100644--- a/api/core/app/app_config/easy_ui_based_app/variables/manager.py+++ b/api/core/app/app_config/easy_ui_based_app/variables/manager.py@@ -139,7 +139,7 @@ class BasicVariablesConfigManager:raise ValueError("variable in user_input_form must be of string type")pattern = re.compile(r"^(?!\d)[\u4e00-\u9fa5A-Za-z0-9_\U0001F300-\U0001F64F\U0001F680-\U0001F6FF]{1,100}$")- if pattern.match(form_item["variable"]) is None:+ if pattern.fullmatch(form_item["variable"]) is None:raise ValueError("variable in user_input_form must be a string, and cannot start with a number")variables.append(form_item["variable"])diff --git a/api/tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py b/api/tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.pyindex b82417cfedb..77aaeb0a501 100644--- a/api/tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py+++ b/api/tests/unit_tests/core/app/app_config/easy_ui_based_app/test_variables_manager.py@@ -285,3 +285,27 @@ class TestValidateAndSetDefaultsIntegration:assert "user_input_form" in keysassert "external_data_tools" in keysassert updated == config+++class TestBasicVariablesConfigManagerValidateVariables:+ def test_validate_variables_rejects_trailing_newline(self):+ # re.match with a "$" anchor still matches just before a trailing+ # newline, so "name\n" used to pass validation even though "\n" is+ # not in the allowed character set. fullmatch rejects it.+ config = {+ "user_input_form": [+ {"text-input": {"label": "Name", "variable": "name\n"}},+ ]+ }+ with pytest.raises(ValueError, match="cannot start with a number"):+ BasicVariablesConfigManager.validate_variables_and_set_defaults(config)++ def test_validate_variables_accepts_valid_name(self):+ config = {+ "user_input_form": [+ {"text-input": {"label": "Name", "variable": "name"}},+ ]+ }+ validated, keys = BasicVariablesConfigManager.validate_variables_and_set_defaults(config)+ assert keys == ["user_input_form"]+ assert validated["user_input_form"][0]["text-input"]["required"] is False