T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:182- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
"}' ``` The executable injects that value into the request parameters: ```js function injectToken(operation, params, cliToken) { const tokenParam = operation.parameters.find((parameter) => parameter.name === "token"); if (!tokenParam || params.token !== undefined) { return; } if (!cliToken) { fail("--token is required for this operation.", { operationId: operation.operationId, }); } params.token = cliToken; } ``` All parameters defined as query parameters—including `token`—are appended to the URL: ```js 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); } } ``` The generated operation specification explicitly identifies the credential as a required query parameter: ```json { "defaultValue": null, "description": "Authentication token for this API service.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" } ``` ### Technical Analysis The API token is exposed through two sensitive channels: 1. The token is supplied through `--token`, making it part of the process command line. Depending on the operating system, container configuration, and monitoring enviro ...[truncated 2293 chars]- Remediation
View remediation
"}' ``` 7. Add automated tests confirming that tokens never appear in command examples, generated URLs, standard output, standard error, or logged error payloads. ]]>
