T09 · Insecure Skill Coding Practices
- Location
scripts/impl.py:51- Finding
Environment-controlled API origin can receive bearer credentials and user media
- Content
View full analysis
tuple[str, str]: """Get base_url and api_key from environment variables.""" base_url = os.environ.get("SHORTVIDEO_BASE_URL", "") api_key = os.environ.get("SHORTVIDEO_API_KEY", "") if not base_url: print("Error: SHORTVIDEO_BASE_URL environment variable not set") print("Set it with: export SHORTVIDEO_BASE_URL='https://api.shortvideo.ai'") sys.exit(1) if not api_key: print("Error: SHORTVIDEO_API_KEY environment variable not set") print("Please visit https://shortvideo.ai to get your API key") print("Set it with: export SHORTVIDEO_API_KEY='your-api-key'") sys.exit(1) return base_url.rstrip("/"), api_key ``` The environment-controlled origin is then used for authenticated media uploads: ```python def upload_file(filepath: str, upload_type: str = None) -> dict[str, Any]: """Upload a local file to OSS.""" base_url, api_key = get_config() if not os.path.isfile(filepath): return {"status": "error", "error": f"File not found: {filepath}"} file_size = os.path.getsize(filepat ...[truncated 3685 chars]- Remediation
View remediation
