Skip to content

fix(api): grant WebApp access to file input default values - #41763

Open
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/fix-file-list-default-grant-41727-53eb
Open

fix(api): grant WebApp access to file input default values#41763
Souravrajvi0 wants to merge 1 commit into
langgenius:mainfrom
Souravrajvi0:feat/fix-file-list-default-grant-41727-53eb

Conversation

@Souravrajvi0

Copy link
Copy Markdown
Contributor

Summary

  • Grant upload file access for studio-configured FILE and FILE_LIST input defaults before resolving user inputs in WebApp runs
  • Fixes the ownership mismatch where default files are uploaded by the Account in Studio but WebApp executes as an EndUser, causing Invalid upload file
  • Adds regression tests covering default file-list access under EndUser scope and ensuring user-provided files are not auto-granted

Context

Fixes #41727

When a Chatflow File List input has a default value, Preview works but WebApp fails with Invalid upload file. Preview runs as the Account (ownership filter skipped); WebApp runs as an EndUser (requires_user_ownership=True), so account-owned default uploads are rejected.

This uses the existing grant_upload_file_access mechanism (same approach as knowledge-base retrieved images in v1.15.0).

Test plan

  • uv run pytest tests/unit_tests/core/app/apps/test_base_app_generator.py -q (22 passed)
  • New test: account-owned default file list resolves under EndUser WebApp scope
  • New test: user-provided file list does not trigger default-file granting

When a workflow file or file-list input uses a studio-configured default,
the upload file is owned by the account rather than the end user. Grant
those default upload file IDs in the request scope before resolving
inputs so WebApp runs can read them, matching Preview behavior.

Fixes langgenius#41727
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-09-03 19:36:20.013808221 +0000
+++ /tmp/pyrefly_pr.txt	2026-09-03 19:36:04.791755203 +0000
@@ -4835,7 +4835,9 @@
 ERROR Class member `_DummyConverter.convert_stream_simple_response` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/core/app/apps/test_base_app_generate_response_converter.py:47:9
 ERROR Object of class `Account` has no attribute `tenant_id` [missing-attribute]
-   --> tests/unit_tests/core/app/apps/test_base_app_generator.py:599:9
+   --> tests/unit_tests/core/app/apps/test_base_app_generator.py:605:9
+ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
+   --> tests/unit_tests/core/app/apps/test_base_app_generator.py:630:58
 ERROR Class member `DummyQueueManager._publish` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
   --> tests/unit_tests/core/app/apps/test_base_app_queue_manager.py:21:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `GraphRuntimeState | None` in function `core.app.apps.base_app_queue_manager.AppQueueManager.graph_runtime_state` [bad-argument-type]

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 62.78% 62.79% +0.00%
Strict coverage 62.39% 62.39% +0.00%
Typed symbols 44,065 44,069 +4
Untyped symbols 26,286 26,287 +1
Modules 3315 3315 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File list input with default value returns "Invalid upload file" when accessed through Web App

1 participant