T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:20- 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; } ``` 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; } app ...[truncated 3106 chars]- Remediation
View remediation
`, if the JustOneAPI service supports header-based authentication. 3. If the upstream service strictly requires query authentication: - Avoid logging the constructed URL. - Add centralized redaction that replaces the `token` query value before URLs can enter diagnostics or telemetry. - Ensure reverse proxies, gateways, access logs, application monitoring, and tracing systems redact or omit the `token` parameter. - Use narrowly scoped, short-lived, and regularly rotated tokens. 4. Reject `token` values supplied inside `--params-json` so callers cannot bypass the safer environment-based credential path. 5. Update `SKILL.md` to use an invocation without a token argument: ```bash JUST_ONE_API_TOKEN="$JUST_ONE_API_TOKEN" node {baseDir}/bin/run.mjs \ --operation "getAmazonProductDetailV1" \ --params-json '{"asin":""}' ``` 6. Document the residual logging risk if query-string authentication cannot be replaced, and provide immediate token-revocation and rotation guidance. ]]>
