T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:12
- Finding
- Unvalidated API Origin Can Receive Bearer Credentials and Sensitive Health Data<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:12`, `SKILL.md:40`, `SKILL.md:55-60`, `SKILL.md:127`, `SKILL.md:134-145`; `api-reference.md:3-10` **Vulnerability Type**: Unrestricted external API endpoint configuration **Risk Level**: High ### Vulnerable Code Snippets From `SKILL.md:12`: ```markdown You ARE the user's nutrition coach. Haver is your backend -- it stores their data, analyzes their food, calculates their metrics, and tracks their progress. You interact with it through HTTP API calls to the base URL from `HAVER_API_URL` (default: `https://haver.dev`). ``` From `SKILL.md:40`: ```http Authorization: Bearer hv_... ``` From `SKILL.md:55-60`: ```http POST {HAVER_API_URL}/api/register Content-Type: application/json { "provider": "openclaw", "externalId": "<user's unique ID>" } ``` From `api-reference.md:3-10`: ```markdown Full request/response documentation for all Haver API endpoints. All authenticated endpoints require `Authorization: Bearer hv_...` header. ## Registration ```http POST {HAVER_API_URL}/api/register Content-Type: application/json { "provider": "openclaw", "externalId": "<user's unique ID>" } ``` ``` ### Technical Analysis The Skill obtains its API origin from the `HAVER_API_URL` environment variable but does not require that the resulting origin be `https://haver.dev`, enforce HTTPS, or define redirect restrictions. Authenticated requests attach a reusable bearer credential to requests made through this configured origin. The API processes sensitive personal and health information, including food records, photographs, weight, height, age, sex, activity level, nutrition goals, and coaching conversations. If the environment variable is changed through deployment misconfiguration or attacker access to runtime configuration, the Agent may send both the bearer credential and sensitive user data to an unintended server. The same weakness also affects response integrity. A substituted server can return fabricated ...[truncated 1468 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Hard-code or strictly allowlist the production API origin: - Permit only `https://haver.dev`. - Compare the normalized scheme, host, and effective port against an exact allowlist. - Reject embedded credentials, alternate subdomains, IP-address substitutions, and nonstandard ports. 2. Require HTTPS and fail closed for all non-TLS destinations. 3. Disable redirects for authenticated requests, or validate every redirect target before following it. 4. Never forward the `Authorization` header when the redirect destination has a different origin. 5. Separate registration and authenticated API clients so credentials cannot be attached to unexpected destinations. 6. Require explicit user disclosure and consent before transmitting sensitive health information. 7. Minimize transmitted data and define retention controls for images, profile information, and conversations. 8. Add automated tests confirming that invalid origins and cross-origin redirects are rejected. ]]>
