T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:20- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:43-51;bin/run.mjs:20-25;bin/run.mjs:191-201;bin/run.mjs:230-237
Vulnerability Type: Sensitive credential exposure
Risk Level: MediumVulnerable Code
SKILL.md:43-51:bash node {baseDir}/bin/run.mjs --operation "gwApiDataSpAuthorCpInfoV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"oAuthorId":"<oAuthorId>"}'markdown - Required: `JUST_ONE_API_TOKEN` - Pass the token with `--token "$JUST_ONE_API_TOKEN"`; do not paste token values into chat messages, screenshots, or logs.bin/run.mjs:20-25:js { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }bin/run.mjs:191-201: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; }bin/run.mjs:230-237:js if (value && typeof value === "object") { searchParams.append(name, JSON.stringify(value)); return; } searchParams.append(name, String(value));Technical Analysis
The Skill instructs users to supply the API token through the
--tokencommand-line argument. Command-line arguments can be exposed to other local users or administrative monitoring systems through process inspection, shell history, process accounting, audit systems, debugging output, or orchestration telemetry.The manifest additionally classifies
tokenas a query parameter. The token is injected intoparams, passed toapplyQueryParams, and appended to the request URL usin ...[truncated 2602 chars]- Remediation
View remediation
Remediation Suggestions
-
Read the token directly from
process.env.JUST_ONE_API_TOKENinstead of requiring it in--token. This prevents normal invocations from exposing the credential in process arguments and shell history. -
If supported by JustOneAPI, send the credential in an authorization header rather than the query string:
js 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, }; -
Remove
tokenfrom the operation's query-parameter definitions and preventparams-jsonfrom accepting atokenfield. Authentication material should be handled separately from ordinary endpoint parameters. -
If the upstream API only accepts query authentication, coordinate an API change to support header-based credentials. Until then:
- Read the token from the environment rather than command-line arguments.
- Configure clients, proxies, gateways, and monitoring platforms to redact the
tokenquery parameter. - Avoid including complete URLs in errors or diagnostic output.
- Use short-lived, narrowly scoped tokens with strict rate and quota limits.
- Rotate the token immediately if process records or URL logs may have exposed it.
-
Add automated tests verifying that credentials never appear in command examples, standard output, standard error, exception payloads, or request logging.
-
