T09 · Insecure Skill Coding Practices
- Location
scripts/download_file.py:31- Finding
Videoinu Access Token Disclosed to Arbitrary Download URLs
- Content
View full analysis
str: """Download a single URL. Returns local path.""" # Extract extension from URL parsed_path = urllib.parse.urlparse(url).path ext = os.path.splitext(parsed_path)[1] or ".bin" filename = f"{prefix}_{index:03d}{ext}" if prefix else os.path.basename(parsed_path) local_path = os.path.join(output_dir, filename) req = urllib.request.Request(url, headers={"Cookie": _cookie_header()}) with urllib.request.urlopen(req, timeout=120) as resp: with open(local_path, "wb") as f: while True: chunk = resp.read(65536) if not chunk: break f.write(chunk) return local_path ``` ```python parser.add_argument("graph_id", nargs="?", help="Graph ID to download files from") parser.add_argument("--urls", nargs="+", help="Direct URLs to download") parser.add_argument("--output-dir", default=DEFAULT_OUTPUT_DIR, help="Output directory") parser.add_argument("--type", choices=["image", "video", "audio", "all"], default="all", help="Filter by asset type (default: all)") parser.add_argument("--prefix", default="", help="File name prefix") parser.add_argument("--workers", type=int, default=5, help="Parallel download workers") args = parser.parse_args() if not args.urls and not args.graph_id: parser.error("Either GRAPH_ID or --urls is required") require_access_key() os.makedirs(args.output_dir, exist_ok=True) urls = [] if args.urls: urls = args.urls else: # Fetch graph and extract URLs from asset core nodes data = api_get(f"/graph/{args.graph_id}") ``` ### Technical Analysis The download function adds the account au ...[truncated 1845 chars]- Remediation
View remediation
