T05 · Unauthorized Access and Privilege Escalation
- Location
references/transcribe_server.py:390- Finding
Unauthenticated Cross-Origin Access to Local-File Transcription
- Content
View full analysis
web.Response: """启动转录任务""" body = await request.json() file_path = body.get("file_path") if not file_path or not os.path.isfile(file_path): return web.json_response({"error": "file_path 不存在"}, status=400) model = body.get("model") or DEFAULT_WHISPER_MODEL language = body.get("language", "auto") chunk_sec = int(body.get("chunk_sec", 150)) overlap_sec = int(body.get("overlap_sec", 20)) tasks_store[task_id] = { "id": task_id, "file_path": file_path, "file_name": os.path.basename(file_path), "model": model, ``` ```python async def task_status_handler(request: web.Request) -> web.Response: task_id = request.match_info["task_id"] task = tasks_store.get(task_id) if not task: return web.json_response({"error": "Task not found"}, status=404) response = { "id": task["id"], "file_name": task["file_name"], "model": task["model"], "language": task["language"], "chunk_sec": task["chunk_sec"], "overlap_sec": task["overlap_sec"], "status": task["status"], "progress": task["progress"], "current_chunk": task["current_chunk"], "total_chunks": task["total_chunks"], "skipped_chunks": task["skipped_chunks"], "skipped_chunk_indexes": task["skipped_chunk_indexes"], "segments": task["segments"], "duration": task["duration"], "error": task["error"], "completed_at": task["completed_at"], } return web.json_response(response) ``` ```python @web.middleware async def cors_middleware(request: web.Request, ...[truncated 2307 chars]- Remediation
View remediation
