T09 · Insecure Skill Coding Practices
- Location
scripts/generate_video.py:41- Finding
Unbounded video-status polling can exhaust service resources
- Content
View full analysis
- Remediation
View remediation
= deadline: return { "status": "timeout", "message": "Video generation did not complete within the allowed time." } result = client.videos.retrieve_videos_result(id=task_id) status = getattr(result, "task_status", None) if status == "SUCCESS": return { "status": "success", "message": "Video generation completed.", "video_url": result.video_url, } if status == "FAILED": return { "status": "failed", "message": "Video generation failed." } if status not in {"PENDING", "PROCESSING", "RUNNING"}: return { "status": "failed", "message": "The provider returned an unexpected task status." } time.sleep(min(5 * (2 ** min(attempt, 3)), 30)) ``` ]]>
