dify/api/core/app/apps
Taranum01 3cfd24557f fix(api): grant EndUser access to file-list input defaults
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.
2026-08-15 03:01:28 +05:30
..
advanced_chat feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
agent_app feat(dify-agent): expand and enforce agent run limits (#40641) 2026-08-14 08:27:19 +00:00
agent_chat refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
chat refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
common chore(api): remove unreachable match suppressions (#39949) 2026-08-04 11:56:37 +00:00
completion refactor: resolve completion model via manager (#40756) 2026-08-14 02:52:42 +00:00
pipeline fix(api): decouple response listeners from execution lifecycle (#39813) 2026-08-13 05:50:43 +00:00
workflow fix(api): decouple response listeners from execution lifecycle (#39813) 2026-08-13 05:50:43 +00:00
__init__.py
base_app_generate_response_converter.py feat(dify-agent): propagate run limit error types (#40116) 2026-08-07 10:37:22 +00:00
base_app_generator.py fix(api): grant EndUser access to file-list input defaults 2026-08-15 03:01:28 +05:30
base_app_queue_manager.py fix(api): decouple response listeners from execution lifecycle (#39813) 2026-08-13 05:50:43 +00:00
base_app_runner.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
draft_variable_saver.py refactor: add missing @override decorator to remaining MCP, Jieba, embeddings, and misc subclasses (#36528) 2026-05-22 13:45:35 +00:00
exc.py
execution_coordinator.py fix(api): decouple response listeners from execution lifecycle (#39813) 2026-08-13 05:50:43 +00:00
message_based_app_generator.py refactor: explicit DB session propagation across backend paths (#38559) 2026-07-15 06:48:28 +00:00
message_based_app_queue_manager.py fix(api): decouple response listeners from execution lifecycle (#39813) 2026-08-13 05:50:43 +00:00
message_generator.py feat: add service api of HITL (#32826) 2026-04-24 06:37:10 +00:00
streaming_utils.py feat: add service api of HITL (#32826) 2026-04-24 06:37:10 +00:00
workflow_app_runner.py refactor(workflow): move AgentNode events out of graphon (#39845) 2026-08-04 03:54:40 +00:00