T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:228- Finding
API Token Exposed Through Process Arguments and URL Query Parameters
- Content
View full analysis
parameter.name === "token"); if (!tokenParam || params.token !== undefined) { return; } if (!cliToken) { fail("--token is required for this operation.", { operationId: operation.operationId, }); } params.token = cliToken; } ``` ```js // bin/run.mjs:228-249 function applyQueryParams(operation, params, url) { for (const parameter of operation.parameters.filter((item) => item.location === "query")) { const value = params[parameter.name]; if (value === undefined) { continue; } appendValue(url.searchParams, parameter.name, value); } } function a ...[truncated 3183 chars]- Remediation
View remediation
"}' ``` 5. If the upstream API only supports query-string authentication: - Document this security limitation explicitly. - Use short-lived, narrowly scoped tokens where supported. - Configure gateways, proxies, servers, and observability systems to redact the `token` query parameter. - Ensure errors and diagnostics never include the complete request URL. - Rotate the token immediately if it may have appeared in logs. - Consider constructing the authenticated request as late as possible and clearing unnecessary in-memory references after use. 6. Reject a `token` property supplied through `--params-json` so callers cannot bypass the safer credential path after authentication is moved to an HTTP header. ]]>
