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(trigger): keep webhook form/query integers exact and reject non-finite numbers (#44706)
Temitope Kadri2a99ac015e8f
diff --git a/api/services/trigger/webhook_service.py b/api/services/trigger/webhook_service.pyindex 78a67caa3a3..0c9f6f8473f 100644--- a/api/services/trigger/webhook_service.py+++ b/api/services/trigger/webhook_service.py@@ -1,5 +1,6 @@import jsonimport logging+import mathimport mimetypesimport secretsfrom collections.abc import Callable, Mapping, Sequence@@ -620,6 +621,11 @@ class WebhookService:case SegmentType.NUMBER:if not cls._can_convert_to_number(value):raise ValueError(f"Cannot convert '{value}' to number")+ try:+ # float() rounds integers above 2**53, so parse integers exactly first.+ return int(value)+ except ValueError:+ passnumeric_value = float(value)return int(numeric_value) if numeric_value.is_integer() else numeric_valuecase SegmentType.BOOLEAN:@@ -775,10 +781,9 @@ class WebhookService:@classmethoddef _can_convert_to_number(cls, value: str) -> bool:- """Check if a string can be converted to a number."""+ """Check if a string can be converted to a finite number."""try:- float(value)- return True+ return math.isfinite(float(value))except ValueError:return Falsediff --git a/api/tests/unit_tests/services/trigger/test_webhook_service.py b/api/tests/unit_tests/services/trigger/test_webhook_service.pyindex 9aa4af9dcad..7e5ac49b18e 100644--- a/api/tests/unit_tests/services/trigger/test_webhook_service.py+++ b/api/tests/unit_tests/services/trigger/test_webhook_service.py@@ -1139,6 +1139,26 @@ class TestWebhookServiceAdditionalCases:result = WebhookService._convert_form_value("param", raw_value, param_type)assert result == expected+ @pytest.mark.parametrize(+ ("raw_value", "expected"),+ [+ ("1234567890123456789", 1234567890123456789),+ ("9007199254740993", 9007199254740993),+ ("-9007199254740993", -9007199254740993),+ ("1e3", 1000),+ ],+ )+ def test_convert_form_value_should_keep_integers_exact(self, raw_value: str, expected: int) -> None:+ result = WebhookService._convert_form_value("param", raw_value, SegmentType.NUMBER)++ assert result == expected+ assert isinstance(result, int)++ @pytest.mark.parametrize("raw_value", ["nan", "NaN", "inf", "-Infinity", "1e400"])+ def test_convert_form_value_should_reject_non_finite_numbers(self, raw_value: str) -> None:+ with pytest.raises(ValueError, match="to number"):+ WebhookService._convert_form_value("param", raw_value, SegmentType.NUMBER)+def test_convert_form_value_should_raise_for_unsupported_type(self) -> None:with pytest.raises(ValueError, match="Unsupported type"):WebhookService._convert_form_value("p", "x", SegmentType.FILE)