T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:139- Finding
API Token Exposure Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:36,SKILL.md:42,bin/run.mjs:20-28,bin/run.mjs:59-75,bin/run.mjs:139-143,bin/run.mjs:203-210
Vulnerability Type: Insecure credential handling
Risk Level: MediumThe Skill instructs users to supply the JustOneAPI token as a command-line argument. The implementation then inserts that credential into the URL query string sent to the declared API endpoint.
Relevant documentation:
bash node {baseDir}/bin/run.mjs --operation "getRecentHotTvV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"key":"value"}'Relevant token parameter declaration:
javascript { "defaultValue": null, "description": "Access token for this API service.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }Relevant request construction:
javascript const params = parseParams(args.paramsJson); applyDefaults(operation, params); injectToken(operation, params, args.token); validateRequired(operation, params); const baseUrl = manifest.baseUrl; const url = new URL(operation.path, ensureBaseUrl(baseUrl)); applyPathParams(operation, params, url); applyQueryParams(operation, params, url); const requestInit = { headers: { "accept": "application/json", }, method: operation.method, };Relevant command-line argument handling:
javascript if (flag === "--token") { parsed.token = value; index += 1; continue; }Relevant query-string construction:
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); } }Technical Analysis
Supplying a secret ...[truncated 2699 chars]
- Remediation
View remediation
Remediation Suggestions
-
Read the token directly from
process.env.JUST_ONE_API_TOKENinstead of requiring a--tokencommand-line argument:javascript const token = process.env.JUST_ONE_API_TOKEN; if (!token) { fail("JUST_ONE_API_TOKEN is required.", { operationId: operation.operationId, }); } -
Remove or deprecate the
--tokenoption so credentials are not exposed through process arguments or copied into shell history. -
If supported by JustOneAPI, transmit the credential in an authorization header rather than the query string:
javascript const requestInit = { headers: { accept: "application/json", authorization: `Bearer ${token}`, }, method: operation.method, }; -
Prevent
tokenfrom being accepted through--params-json. Treat authentication material separately from ordinary endpoint parameters. -
If the upstream API only supports query-string authentication, document the residual exposure and ensure the API server, reverse proxies, gateways, monitoring systems, and error-reporting services redact the
tokenquery parameter. -
Never include complete request URLs containing credentials in exceptions, logs, telemetry, or diagnostic output.
-
Apply server-side least privilege by restricting the token to the required endpoint and account scope where the service supports such controls. Use short-lived credentials and rotate any token suspected of appearing in process records or URL logs.
-
