T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:68- 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; } ``` ```javascript // bin/run.mjs:220-228 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); } } ``` ```bash # SKILL.md:43 node {baseDir}/bin/run.mjs --operation "ershoufangDetailV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"cityId":"","houseCode":""}' ``` ### Technical Analysis The Skill requires an API token for its de ...[truncated 2652 chars]- Remediation
View remediation
","houseCode":""}' ``` 4. If the upstream API mandates query-string authentication, retain the token only in memory for the shortest practical time and document the residual risk. Configure clients, gateways, proxies, application servers, monitoring platforms, and error handlers to redact the `token` query parameter. 5. Never include the completed request URL, request headers, token value, or complete process invocation in diagnostic output. Add automated tests confirming that errors and logs do not contain a supplied sentinel token. 6. Rotate any token suspected of appearing in process, shell, gateway, proxy, or server logs, and restrict token permissions and quotas to the minimum needed for this endpoint. ]]>
