T09 · Insecure Skill Coding Practices
- Location
assets/seedream.py:337- Finding
RedFox API Key Disclosed to Server-Supplied Image Download Hosts
- Content
View full analysis
0: pct = int(dl * 100 / total_size) bar = "█" * (pct // 5) + "░" * (20 - pct // 5) print(f"\r {bar} {pct}%", end="", flush=True) ``` ### Technical Analysis The script stores `X-API-KEY` in the default headers of a global `requests.Session`. This is appropriate for requests sent to the fixed RedFox API endpoints, but the same session is passed to `download_images()` and used to request URLs obtained from the API response's `imageUrls` field. Because default session headers are attached to outgoing requests, the RedFox API key can be transmitted to the host identified by each returned image URL. The download URL is not restricted to `redfox.hk` or an allowlisted storage domain. It may point to a third-party OSS/CDN host or, if the API service or response is compromised, an attacker-controlled host. TLS certificate verification only protects the connection against interception. It does not prevent the authenticated destination from reading the `X-API-KEY` header. Sending the key to R ...[truncated 1507 chars]- Remediation
View remediation
