T09 · Insecure Skill Coding Practices
- Location
SKILL.md:115- Finding
Access Key Exposure Through URL Query Parameters and Configurable API Origin
- Content
View full analysis
` (and friends as `&key=value`). ``` From `references/API.md`: ```markdown - **Base URL**:默认 `https://store-api.liganma.com`,可由 `E_STORE_BASE_URL` 覆盖。 - **认证**:通过 URL 查询参数 `ak=`(每个请求都要带)。 ``` ```http GET {baseURL}/access/product/search?ak={ak}&keyword=Spring¬InLib=true&pageNum=1&pageSize=10 GET {baseURL}/access/product/detail?ak={ak}&id=1001 GET {baseURL}/access/product/versions?ak={ak}&productId=1001&pageNum=1&pageSize=20 GET {baseURL}/access/product/download?ak={ak}&id=1001 GET {baseURL}/access/product/config?ak={ak}&id=1001 GET {baseURL}/access/product/version/config?ak={ak}&versionId=3001 GET {baseURL}/access?ak={ak} ``` ### Technical Analysis The Skill requires the `E_STORE_AK` access key to be appended to every request URL. Secrets placed in query strings are routinely exposed beyond the process that originates the request. Full URLs may be recorded by: - Origin-server and reverse-proxy access logs - CDN, gateway, firewall, and observability systems - Debugging output and exception traces - Shell history when requests are issued manually - Browser or HTTP-client history - Copied URLs and support diagnostics TLS protects the request in transit but does not prevent the URL from being retained by the receiving service or authorized infrastructure components. The risk is increased by allowing `E_STORE_BASE_URL` to override the default service origin. The reviewed instructions do not require HTTPS, validate the destination ...[truncated 1925 chars]- Remediation
View remediation
``` 2. Remove all documentation and examples that place access keys in URLs. 3. Restrict API requests to an explicit allowlist of trusted HTTPS origins. By default, permit only: ```text https://store-api.liganma.com ``` 4. If a custom `E_STORE_BASE_URL` is operationally necessary: - Require an `https://` URL. - Reject embedded credentials, unexpected ports, redirects to other origins, and non-public or loopback destinations unless explicitly authorized. - Require informed user approval before sending credentials to a non-default origin. 5. Configure clients to remove authorization data before logging requests or exceptions. 6. Ensure reverse proxies, API gateways, and monitoring systems redact existing `ak` parameters while migration is in progress. 7. Scope keys to the minimum necessary read/download permissions, issue short-lived credentials where possible, and support immediate rotation and revocation. 8. Rotate any existing key that may have appeared in URL logs and review relevant infrastructure logs for unauthorized use. ]]>
