mirror of
https://github.com/langgenius/dify.git
synced 2026-09-10 17:10:34 +08:00
Fixes #40411 Workflows that set a default value on a File List (or single File) input break under WebApp runs: the form defaults are uploaded by the studio account, but WebApp runs execute as EndUser, and the file access controller filters out files the EndUser does not own. The result is `ValueError("Invalid upload file")` raised from `factories.file_factory.builders._build_from_local_file` before the workflow can read the default value. Preview works fine because Account runs bypass the ownership filter. The grant mechanism (added in #36175) already allows the runtime to allowlist specific upload file IDs during execution. The same grant fits here: input default files are studio-uploaded, but they are trusted by the form author, so the active execution scope should be allowed to read them. Changes: 1. Extract upload_file_id / reference / related_id from FILE and FILE_LIST input mappings before `build_from_mapping` runs. 2. Add the IDs to the active file access scope via `grant_upload_file_access` so the access controller treats them as already-vetted for the current EndUser. 3. Regression test exercising the EndUser path with three file IDs (single FILE + FILE_LIST default) and asserting the scope grants the correct set. This is the same class of bug as #36175/#36195 for retrieval attachments, but for the input-default path. |
||
|---|---|---|
| .. | ||
| advanced_chat | ||
| agent_app | ||
| agent_chat | ||
| chat | ||
| common | ||
| completion | ||
| pipeline | ||
| workflow | ||
| __init__.py | ||
| base_app_generate_response_converter.py | ||
| base_app_generator.py | ||
| base_app_queue_manager.py | ||
| base_app_runner.py | ||
| draft_variable_saver.py | ||
| exc.py | ||
| execution_coordinator.py | ||
| message_based_app_generator.py | ||
| message_based_app_queue_manager.py | ||
| message_generator.py | ||
| streaming_utils.py | ||
| workflow_app_runner.py | ||