T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/handle_receipt_upload.py:62- Finding
Caller-Controlled File ID Permits Unauthorized Google Drive File Mutation
- Content
View full analysis
dict: try: # 1. Get folder ID target_folder_id = get_folder_id(property_name) # 2. Determine final file name file_extension = Path(original_file_name).suffix if desired_file_name: final_name = desired_file_name elif excel_index: final_name = f"{excel_index}{file_extension}" else: return {"success": False, "error": "Cannot determine final file name. Please provide excel_index or desired_file_name."} # 3. Move and rename file in Drive # gog drive move --parent subprocess.run(["gog", "drive", "move", file_id, "--parent", target_folder_id], capture_output=True, text=True, check=True) # gog drive rename subprocess.run(["gog", "drive", "rename", file_id, final_name], capture_output=True, text=True, check=True) # 4. Get webViewLink (need to search again by ID as rename might change some metadata) cmd_get_link = ["gog", "drive", "get", file_id, "--json", "--select", "file(webViewLink)"] result_link = subprocess.run(cmd_get_link, capture_output=True, text=True, check=True) file_link = json.loads(result_link.stdout).get("file", {}).get("webViewLink", "") # 5. Update Excel sheet if excel_index: sheet_id = get_sheet_id(property_name) tab_name = get_sheet_tab_name(property_name) # Find the row for the given index # Assuming index is in column A and data starts from row 2 cmd_get_all_data = ["gog", "shee ...[truncated 3511 chars]- Remediation
View remediation
