File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,17 +52,9 @@ def process(payload: dict):
5252 logger .warning ("Missing minio_object in payload" , extra = {"status" : "error" })
5353 return {"error" : "minio_object is required" }
5454
55- # Fix #1: only extract the suffix from user input — never use minio_object
56- # as a path component directly, preventing path traversal via object keys
57- ext = Path (minio_object ).suffix .lower ()
58- if ext not in ALLOWED_SUFFIXES :
59- logger .warning (
60- f"Rejected unsupported extension — { ext !r} " ,
61- extra = {"status" : "error" }
62- )
63- return {"error" : "Unsupported file type" }
64-
65- filename = f"{ uuid .uuid4 ()} { ext } "
55+ # Use a trusted local temp filename that does not depend on user input.
56+ # This prevents untrusted data from influencing filesystem paths.
57+ filename = f"{ uuid .uuid4 ()} .bin"
6658
6759 # Fix #2: initialise tmp_path before try so finally block never hits NameError
6860 # Fix #3: keep as Path throughout — only cast to str at call sites that need it
You can’t perform that action at this time.
0 commit comments