Repository navigation
fix(trigger): keep webhook form/query integers exact and reject non-finite numbers - #44706
Merged
wylswz merged 1 commit intoOct 28, 2026
Merged
Conversation
…inite numbers Number parameters from query strings and form bodies went through float(), so integers above 2**53 (64-bit IDs) were silently rounded, and nan/inf were accepted. Parse integers exactly first and treat non-finite values as invalid, matching the JSON body path, which already rejects NaN. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-24 12:42:30.835335192 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-24 12:42:20.759311978 +0000
@@ -6227,11 +6227,11 @@
ERROR Argument `dict[str, dict[str, list[dict[str, bool | str]] | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.extract_and_validate_webhook_data` [bad-argument-type]
--> tests/unit_tests/services/trigger/test_webhook_service.py:952:95
ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService._validate_http_metadata` [bad-argument-type]
- --> tests/unit_tests/services/trigger/test_webhook_service.py:1212:61
+ --> tests/unit_tests/services/trigger/test_webhook_service.py:1232:61
ERROR Argument `dict[str, dict[str, int] | dict[str, str]]` is not assignable to parameter `webhook_data` with type `RawWebhookDataDict` in function `services.trigger.webhook_service.WebhookService.build_workflow_inputs` [bad-argument-type]
- --> tests/unit_tests/services/trigger/test_webhook_service.py:1224:59
+ --> tests/unit_tests/services/trigger/test_webhook_service.py:1244:59
ERROR Argument `dict[str, dict[str, int | str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.webhook_service.WebhookService.generate_webhook_response` [bad-argument-type]
- --> tests/unit_tests/services/trigger/test_webhook_service.py:1235:69
+ --> tests/unit_tests/services/trigger/test_webhook_service.py:1255:69
ERROR Cannot find module `dify_graph.enums` [missing-import]
--> tests/unit_tests/services/workflow/test_workflow_converter.py:36:5
ERROR Cannot find module `dify_graph.model_runtime.entities.llm_entities` [missing-import]
|
Contributor
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #44706 +/- ##
=======================================
Coverage 89.30% 89.30%
=======================================
Files 5983 5984 +1
Lines 375012 375029 +17
Branches 76053 76053
=======================================
+ Hits 334898 334915 +17
Misses 34078 34078
Partials 6036 6036
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wylswz
approved these changes
Oct 28, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Fixes #<issue number>.Summary
Fixes #44705
Webhook Number parameters from query strings and form bodies (
x-www-form-urlencoded/multipart/form-data) were converted withfloat()and thenint(). That had two effects:1234567890123456789became1234567890123456768. So 64-bit IDs (snowflakes, bigints) reached the workflow as a different number than the caller sent._convert_form_valuenow parses integers exactly withint()first, and only falls back tofloat()for decimals and exponents (19.99,1e3).nan,infand overflowing values like1e400were accepted as numbers._can_convert_to_numbernow requires a finite value, so these get the existing "Cannot convert ... to number" error. This matches the JSON body path, whereorjsonalready rejectsNaN; before, a formnanended up asnullonce serialized.The change is limited to
api/services/trigger/webhook_service.py. Strings, booleans and the JSON body path are unchanged.Screenshots
123456789012345678912345678901234567681234567890123456789900719925474099390071992547409929007199254740993nan/inf42,19.99,1e342,19.99,1000Checklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint godsTests: added parametrized cases to
api/tests/unit_tests/services/trigger/test_webhook_service.py. Eight of the new cases fail onmainand pass with this change, and1e3guards the existing behavior. The whole file passes (85 passed, 1 skipped), andruff check/ruff format --checkare clean.🤖 Generated with Claude Code
From Claude Code