File tree Expand file tree Collapse file tree
backend/open_webui/routers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2757,6 +2757,27 @@ async def process_files_batch(
27572757
27582758 for file in form_data .files :
27592759 try :
2760+ # Ownership check: verify the requesting user owns the file or is an admin
2761+ db_file = Files .get_file_by_id (file .id )
2762+ if not db_file :
2763+ file_errors .append (
2764+ BatchProcessFilesResult (
2765+ file_id = file .id ,
2766+ status = "failed" ,
2767+ error = "File not found" ,
2768+ )
2769+ )
2770+ continue
2771+ if db_file .user_id != user .id and user .role != "admin" :
2772+ file_errors .append (
2773+ BatchProcessFilesResult (
2774+ file_id = file .id ,
2775+ status = "failed" ,
2776+ error = "Permission denied: not file owner" ,
2777+ )
2778+ )
2779+ continue
2780+
27602781 text_content = file .data .get ("content" , "" )
27612782 docs : List [Document ] = [
27622783 Document (
You can’t perform that action at this time.
0 commit comments