T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:18- Finding
API Access Token Exposed Through Process Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:18-27,bin/run.mjs:62-77,bin/run.mjs:200-211; usage is also documented inSKILL.md:39-45
Vulnerability Type: Sensitive credential exposure
Risk Level: MediumThe Skill legitimately needs to authenticate with JustOneAPI, but it handles the access token through two insecure channels: a command-line argument and a URL query parameter.
Vulnerable Code
The operation defines the access token as a query parameter:
js { "defaultValue": null, "description": "Access token for this API service.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" },The token is injected into the general parameter object, converted into a query parameter, and sent over the network:
js 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, };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 passes the secret through the process command line:
bash node {baseDir}/bin/run.mjs --operation "shareLinkResolutionV1" --token "$JUST_ONE_API_TOKEN" --params-json ...[truncated 2552 chars]- Remediation
View remediation
Remediation Suggestions
-
Read the token directly from
process.env.JUST_ONE_API_TOKENrather than requiring it through--token. This prevents routine exposure in the process argument vector. -
Prefer an authorization header if supported by the service:
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
tokenfrom the ordinary operation parameter collection so it cannot accidentally be serialized into URLs, diagnostics, or returned parameter objects. -
Redact authentication parameters and full query strings from application, proxy, gateway, and observability logs.
-
If JustOneAPI only supports query-string authentication, continue using HTTPS but read the token from the environment, configure all relevant infrastructure to redact the
tokenparameter, restrict log access and retention, and explicitly document the residual exposure risk. -
Rotate any token suspected of having been captured in process or URL logs and apply the narrowest available API scope and quota limits.
-
