T09 · Insecure Skill Coding Practices
- Location
scripts/videogen.py:91- Finding
Unrestricted API Base URL Can Redirect Credentials and Media to an Attacker-Controlled Server
- Content
View full analysis
- Remediation
View remediation
str: parsed = urlparse(value) if parsed.scheme != "https": raise SystemExit("The API endpoint must use HTTPS.") if parsed.hostname not in TRUSTED_API_HOSTS: raise SystemExit("The API endpoint is not trusted.") if parsed.username or parsed.password: raise SystemExit("Credentials in the API URL are not permitted.") return value.rstrip("/") ``` 4. Validate upload responses: - Require HTTPS upload URLs. - Allowlist documented object-storage domains. - Reject unexpected HTTP methods. - Reject redirects or revalidate every redirect destination. - Do not forward headers returned by an untrusted API without filtering. 5. Protect the configuration file: - Continue enforcing mode `0600`. - Reject symbolic links when reading or writing sensitive configuration where practical. - Warn if the stored endpoint differs from the official production endpoint. 6. Use scoped, revocable API keys and provide clear key-rotation instructions in case endpoint configuration is compromised. ]]>
