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
Vulnerability Details
File Location:
bin/run.mjs:20-24, 153-155, 186-195, 228-235; usage documented inSKILL.md:42, 50
Vulnerability Type: Credential exposure through command-line arguments and URL query parameters
Risk Level: MediumVulnerable Code
javascript { "defaultValue": null, "description": "Access token for this API service.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }javascript if (flag === "--token") { parsed.token = value; index += 1; continue; }javascript 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; }javascript 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 "getVideoCommentsV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"videoId":"<videoId>"}'Technical Analysis
The access token is first supplied through the
--tokencommand-line argument. Command-line arguments may be observable by other local users or monitoring software through process inspection facilities, shell tracing, job-control systems, audit logs, and process telemetry.The token is then assigned to
params.token. Because the operation man ...[truncated 2086 chars]- Remediation
View remediation
Remediation Suggestions
-
Use an authentication header: If supported by JustOneAPI, remove
tokenfrom the query schema and transmit it through an authorization header, such as:javascript const token = process.env.JUST_ONE_API_TOKEN; if (!token) { fail("JUST_ONE_API_TOKEN is required."); } const requestInit = { headers: { "accept": "application/json", "authorization": `Bearer ${token}`, }, method: operation.method, }; -
Read the token directly from the environment: Avoid accepting reusable secrets through command-line arguments. Read
process.env.JUST_ONE_API_TOKENinside the process so the secret does not appear in the documented command line. -
Reject token overrides in parameter JSON: Prevent callers from supplying
tokenthrough--params-json, which would otherwise continue to place the credential in the URL. -
Redact sensitive values: Ensure request URLs, exception details, telemetry, and backend diagnostics never include an unredacted
tokenparameter. Implement centralized redaction before logging URLs or request metadata. -
If query authentication is unavoidable: Clearly document the residual exposure, disable full-URL logging where possible, configure proxies and observability systems to redact the
tokenparameter, use narrowly scoped short-lived tokens, and rotate any token suspected of being logged. -
Update documentation: Replace the
--tokenexample inSKILL.mdwith an environment-only invocation and explain the credential-handling protections.
-
