Brainstorming / design discussion: introducing a File Access layer between application logic and storage backendsSuggestions for New Features #30045
6leonardo
started this conversation in
Suggestion
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
I searched existing Suggestions and Feature Requests and did not find any discussion about centralizing file access with a context-aware boundary or architectural refactor of file handling. The current suggestions focus on specific app features or improvements, but not on core file access abstractions.
While digging into the codebase to understand how file access is currently handled, I did a focused analysis of the main upload/download flows, controllers, services, and pipelines.
This analysis confirmed that file access today is mostly performed directly by application services and controllers, without a dedicated intermediate layer between business logic and the storage backend.
I’m opening this as a design/brainstorming discussion rather than a feature request.
What the current code looks like
From the analysis, file access is currently performed in several different ways:
FileService,ToolFileManager, andDatasourceFileManagerstorage.load(...)infile_preview.py)UploadFileandToolFileare queried directly by application code to retrieve storage keysFor example:
files.pydelegates most logic toFileService, assuming contextual checks have already happenedfile_preview.py, user/app/tenant checks are performed locally in the controller, rather than being centralizedThis makes it hard to have a single place where file access can be audited, validated, or reasoned about.
Observed issues
Based on the current structure:
This is not a functional bug, but a structural limitation.
Proposed direction (for discussion)
The idea is to introduce a thin File Access layer between application logic and the existing storage backends:
Important clarifications:
UploadFile,ToolFile, etc.) would remain unchangedAccess context and security
From the current code, tenant isolation already appears as a clear and consistent boundary, so enforcing tenant ownership in the File Access layer from the beginning seems reasonable.
User- and role-level decisions, instead, are currently deeply tied to application logic and specific use cases (apps, tools, workflows), and there is no dedicated file-level security table today.
For this reason, an incremental approach would make sense:
First iteration
Later iterations (optional)
Incremental implementation approach
This does not need to be a big-bang refactor.
A possible path could be:
One important aspect to consider early is how access context can be propagated in areas where it is not immediately available (async tasks, plugins, background jobs), possibly falling back to a “best effort” or system context to avoid regressions.
2. Additional context or comments
This is meant as a discussion to validate whether:
If the direction makes sense, I’d be happy to help with a small initial PR as a proof of concept.
3. Can you help us with this feature?
Beta Was this translation helpful? Give feedback.
All reactions