Repository navigation
fix(trigger): reject multipart webhooks missing a required file - #44901
Open
TemitopeKadri wants to merge 1 commit into
Open
TemitopeKadri wants to merge 1 commit into
TemitopeKadri wants to merge 1 commit into
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-10-27 15:48:18.482050502 +0000
+++ /tmp/pyrefly_pr.txt 2026-10-27 15:47:55.549881182 +0000
@@ -6379,13 +6379,17 @@
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:934:90
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
+ --> tests/unit_tests/services/trigger/test_webhook_service.py:953:90
+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:974:99
+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:994: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:1268: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:1280: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:1291: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 #44901 +/- ##
=======================================
Coverage 90.39% 90.39%
=======================================
Files 6534 6534
Lines 409459 409466 +7
Branches 82225 82228 +3
=======================================
+ Hits 370116 370124 +8
+ Misses 32944 32942 -2
- Partials 6399 6400 +1
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:
|
TemitopeKadri
force-pushed
the
fix/webhook-required-file-params
branch
from
November 23, 2026 21:01
770797b to
5a2e029
Compare
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 #44900
In a
multipart/form-datawebhook, a File body parameter marked as required was never enforced._process_body_parametersskips file configs because "multipart file validation is handled separately in the extraction phase", but nothing in the extract phase checkedrequired. A request without the file returned 200 and ran the workflow.This adds
WebhookRequestParser._validate_required_files(incontrollers/trigger/webhook_request.py, where #45912 moved the parsing), called from_process_and_validate_dataafter the body is processed. For form-data webhooks it raisesRequired file missing: <name>when a required File parameter is not among the uploaded files. It raisesWebhookRequestValidationError, so it becomes a 400, the same as the existing required header, query and body checks. A file whose upload failed to process is also absent fromfiles, so it now gets the same 400 instead of silently running without it.Optional file parameters and the other content types are unchanged. This doesn't overlap with #41072, which changes what the node outputs for a missing optional file.
Screenshots
invoice)Required file missing: invoicereceipt)Required file missing: invoiceinvoiceuploadedChecklist
make lint && make type-check(backend) andvp staged(frontend) to appease the lint godsTests: rebased onto
mainafter #45912, so the tests now live intests/unit_tests/controllers/trigger/test_webhook_request.py.test_extract_and_validate_webhook_request_missing_required_fileasserted the old behavior (files == {}), so it now expects the 400 error. I added cases for a present required file, a missing optional file, a different file uploaded in place of the required one, and a non-form content type. Three of these fail onmain.tests/unit_tests/controllers/triggerandtests/unit_tests/services/triggerpass (337 passed).ruff checkandruff format --checkon the changed files are clean.🤖 Generated with Claude Code
From Claude Code