T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:25- Finding
API Token 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 URL before transmission: ```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 credential-bearing URL is sent to the remote service: ```js response = await fetch(url, requestInit); ``` The documented invocation also exposes the token through the process argument list: ```bash node {baseDir}/bin/run.mjs --operation "getYoukuVideoDetailV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"videoId":""}' ``` ### Technical Analysis The API token follows this data flow: 1. The shell expands `JUST_ONE_API_TOKEN` into the `--token` command-line argument. 2. `pa ...[truncated 2342 chars]- Remediation
View remediation
"}' ``` Prefer configuring the environment outside the command itself when supported by the execution environment. 5. If JustOneAPI only supports query-based authentication, document that limitation, configure all intermediaries to redact the `token` parameter, disable full-URL logging where possible, and use short-lived, narrowly scoped tokens. 6. Ensure error reporting, telemetry, tracing, and debugging code never print authorization headers, environment variables, command-line arguments, or complete credential-bearing URLs. 7. Rotate any token that may already have appeared in process-monitoring records or request logs. ]]>
