T09 · Insecure Skill Coding Practices
Warning
- Location
- references/scene2-nearby-search.md:95
- Finding
- API Credential Disclosure in Nearby-Search Links<![CDATA[ ## Vulnerability Details **File Location**: `references/scene2-nearby-search.md:95-103` **Vulnerability Type**: API credential exposure through a user-facing query string **Risk Level**: Medium ### Vulnerable Code Snippet ```text https://mapapi.qq.com/web/claw/nearby-search.html?center={latitude},{longitude}&keyword={search_category}&radius=1000&key=xxx ``` The response workflow directs the Agent to replace the example values with the applicable coordinates, search category, and configured Tencent Maps API key, and then return the resulting URL to the user. ### Technical Analysis The nearby-search workflow places the API key in the `key` query-string parameter of a user-facing URL. Query strings are commonly retained in: - Assistant conversation history - Browser history and synchronization services - HTTP access logs and reverse-proxy logs - Monitoring and analytics systems - Screenshots, copied messages, and shared links - Referrer headers, depending on browser and destination policy Although the documentation displays `xxx`, the workflow requires a configured API key and instructs the Agent to generate and return the completed link. Consequently, the intended execution can substitute the actual credential into the URL. This also conflicts with the warning in `SKILL.md` that URLs containing keys must not be shared or logged. ### Attack Path 1. The user configures a valid Tencent Maps API key through `TMAP_LBS_CONFIG`. 2. The user requests a nearby search. 3. The workflow calls the geocoding service and obtains the requested location's coordinates. 4. The Agent constructs the documented nearby-search URL and inserts the configured API key into its query string. 5. The Agent returns the completed URL in the conversation. 6. The URL and credential may be retained in chat history, browser history, logs, screenshots, or copied messages. 7. A party with access to any retained copy extracts the `key` parameter. 8. The exposed key is reused agains ...[truncated 603 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Never place the Tencent Maps API key in assistant output or any user-facing URL. 2. Move authenticated API calls behind a trusted backend that attaches the credential server-side. 3. Return an opaque, short-lived session identifier rather than the API key. 4. If browser-side authorization is unavoidable, issue a narrowly scoped, short-lived token that cannot be used for unrelated API operations. 5. Configure strict API restrictions, including allowed services, referrers or source IP addresses, quotas, and expiration. 6. Apply a restrictive `Referrer-Policy`, such as `no-referrer`, to map pages. 7. Redact `key`, `token`, and similar parameters from application, proxy, analytics, and audit logs. 8. Revoke and rotate any key that may already have appeared in generated links. 9. Update the response template to return a credential-free link or structured search results instead. ]]>
