T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:24- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:24-32, 88-90, 221-229;SKILL.md:43,49;generated/operations.json:16-24;generated/operations.md:19
Vulnerability Type: API credential exposure
Risk Level: MediumThe Skill accepts the JustOneAPI access token as a command-line argument and transmits it as a URL query parameter.
Relevant parameter definition from
bin/run.mjs:24-32:js { "defaultValue": null, "description": "Access token for the API.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" },Request construction and transmission from
bin/run.mjs:88-90:js applyPathParams(operation, params, url); applyQueryParams(operation, params, url);Token injection from
bin/run.mjs:221-229:js 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; }The documented invocation in
SKILL.md:43also places the credential in the process argument list:bash node {baseDir}/bin/run.mjs --operation "getVideoCaptionV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"bvid":"<bvid>","aid":"<aid>","cid":"<cid>"}'Technical Analysis
Passing a secret through
--tokencan expose its value through process inspection facilities, command auditing, shell tracing, diagnostic tooling, or process-monitoring systems. Although shell expansion does not normally place the expanded value in shell history when the command contains the environment-variable reference, the resulting Node.js process still recei ...[truncated 2431 chars]- Remediation
View remediation
Remediation Suggestions
-
Read the credential directly from
process.env.JUST_ONE_API_TOKENrather than requiring it through--token. This prevents routine exposure in the Node.js process argument vector. -
Update the API integration to send the token in a dedicated authorization header, if supported by JustOneAPI:
js const token = process.env.JUST_ONE_API_TOKEN; if (!token) { fail("JUST_ONE_API_TOKEN is required."); } const requestInit = { method: operation.method, headers: { accept: "application/json", authorization: `Bearer ${token}`, }, }; -
Remove the token from the operation's query-parameter definition and prevent callers from supplying
tokenthrough--params-json. -
Remove the
--tokenoption from the documented command and runtime argument parser. -
Ensure request URLs, headers, and configuration objects are redacted before being written to logs, traces, diagnostics, or error reports.
-
If JustOneAPI only supports query-string authentication, continue reading the token from the environment, never print or log the resulting URL, configure all intermediary systems to redact the
tokenparameter, and explicitly document the residual query-string exposure risk. -
Rotate any token that may already have appeared in process monitoring or URL logs, and review those systems for unauthorized retention or access.
-
Apply least-privilege restrictions, expiration, usage limits, and revocation controls to issued API tokens wherever supported.
-
