T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:23- Finding
API Credential Exposed Through Command-Line 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; } ``` All query parameters, including the token, are appended to the request 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 documented invocation also passes the secret as a command-line argument: ```bash node {baseDir}/bin/run.mjs --operation "getToutiaoUserDetailV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"userId":""}' ``` ### Technical Analysis The Skill receives the JustOneAPI token through the `--token` command-line option and subsequently places it in the HTTPS request URL as `?token=...`. Passing secrets through command-line arguments can expose them through process inspectio ...[truncated 2351 chars]- Remediation
View remediation
"}' ``` 5. Reject a user-supplied `token` inside `--params-json` to prevent callers from bypassing the safer credential path. 6. Rotate any token that may already have appeared in process telemetry, shell history, proxy logs, or server logs. ]]>
