T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:30
- Finding
- Cross-Origin Disclosure of Configured API Credentials## Vulnerability Details **File Location**: `SKILL.md:30`, `SKILL.md:42-46`, and `SKILL.md:68-75`; duplicated in `references/api_reference.md:312-316` **Vulnerability Type**: Cross-origin credential reuse **Risk Level**: High ### Vulnerable Code Snippets `SKILL.md:30`: ```markdown 4. **API Call**: Use the detected channel's key and the fixed base URL `https://api.tokenrouter.com` to call the video generation endpoints. ``` `SKILL.md:42-46`: ```markdown Authentication discovery rule: - Search current channel/provider configs for a `baseurl` or `baseURL` containing `https://api.tokenrouter.com` or `https://open.palebluedot.ai`. - If found, treat that entry as the tokenrouter channel and reuse its configured key for `Authorization`. - If not found, stop and instruct the user to register at `https://www.tokenrouter.com` to obtain tokenrouter access and the required channel configuration. ``` `SKILL.md:68-75`: ```markdown ## API Calls Use the fixed tokenrouter base URL `https://api.tokenrouter.com` for all API calls. Auth rule: - Base URL is always `https://api.tokenrouter.com`. - If a matching channel exists, use that channel's configured key directly. - If no matching channel exists, do not fabricate placeholders like `TOKENROUTER_API_KEY`; instead tell the user to register at `https://www.tokenrouter.com` and add tokenrouter config first. ``` `references/api_reference.md:312-316`: ```markdown ## Auth And Base URL - Detect whether the current workspace already has a channel whose `baseurl` or `baseURL` contains `https://api.tokenrouter.com` or `https://open.palebluedot.ai`. - If found, reuse that channel's key directly. The request base URL is always `https://api.tokenrouter.com`. - Reuse the workspace's current auth style, usually `Authorization: Bearer <token>`. ``` ### Technical Analysis The Skill recognizes credentials from channels configured for either `https://api.tokenro ...[truncated 2251 chars]
- Remediation
- ## Remediation Suggestions 1. Bind each discovered credential to the exact configured origin, including scheme, hostname, and port. 2. Send requests to the channel's configured and validated base URL rather than replacing it with a fixed hostname. 3. If the API must always use `https://api.tokenrouter.com`, accept only credentials from a channel configured for that exact origin. 4. Do not reuse a credential from `https://open.palebluedot.ai` unless the provider explicitly documents that the token is interchangeable and the user gives informed confirmation. 5. Add an origin-validation check immediately before constructing the Authorization header. Abort if the credential's source origin differs from the request destination. 6. Maintain an explicit allowlist using exact parsed host comparisons rather than substring matching. Reject user-info components, unexpected ports, subdomains, and lookalike hostnames. 7. Avoid logging or returning Authorization headers and redact secrets from command output and error messages. 8. Update both `SKILL.md` and `references/api_reference.md` so their authentication requirements are consistent. 9. Add tests proving that a credential configured for `open.palebluedot.ai` is never sent to `api.tokenrouter.com`, and vice versa.
