T09 · Insecure Skill Coding Practices
- Location
scripts/publish.mjs:31- Finding
Arbitrary API Endpoint Override Can Expose Credentials and Project Data
- Content
View full analysis
({})); return { response, body }; } ``` The saved bearer credential is sent through this helper when listing sites: ```js async function listSites(accessToken){ return api("/api/agent/sites",{headers:{Authorization:`Bearer ${accessToken}`}}); } ``` It is also sent with selected project content when publishing or updating a site: ```js async function publish(accessToken, payload, siteId) { const project=inputKind!=="html",basePath=project?"/api/agent/projects":"/api/agent/sites"; return api(siteId ? `${basePath}/${encodeURIComponent(siteId)}` : basePath, { method:siteId ? "PUT" : "POST", headers:{Authorization:`Bearer ${accessToken}`,...(project?{}:{"Content-Type":"application/json; charset=utf-8"})}, body:project?payload:JSON.stringify(payload), }); } ``` ### Technical Analysis `YEZHOU_BASE_URL` can specify an arbitrary origin, including an attacker-controlled HTTPS server, a plaintext HTTP server, or a local-network endpoint. No origin allowlist, HTTPS requirement, or separation of credentials by origin is implemented. After reading the bearer credential from the user's configuration directory, the script attaches it to requests sent to the configured origin. Publ ...[truncated 2656 chars]- Remediation
View remediation
