T09 · Insecure Skill Coding Practices
- Location
scripts/analyze_image.py:37- Finding
Arbitrary Readable File Disclosure Through Symlink Following and Configurable Vision Endpoint
- Content
View full analysis
str: """Validate and resolve image path. Returns resolved path or raises ValueError.""" # Resolve ~ and normalize resolved = os.path.abspath(os.path.expanduser(image_path)) # Check for path traversal if '..' in image_path: raise ValueError(f"Path traversal not allowed: {image_path}") # Check file extension _, ext = os.path.splitext(resolved) if ext.lower() not in ALLOWED_EXTS: raise ValueError( f"Unsupported image format: {ext}. " f"Allowed: {', '.join(sorted(ALLOWED_EXTS))}" ) # Check file exists if not os.path.exists(resolved): raise ValueError(f"Image file not found: {image_path}") # Check file size file_size = os.path.getsize(resolved) if file_size > MAX_FILE_SIZE: raise ValueError( f"Image too larg ...[truncated 3621 chars]- Remediation
View remediation
