T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:205- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:80-87,bin/run.mjs:147-151,bin/run.mjs:205-213; documented usage atSKILL.md:38andSKILL.md:45
Vulnerability Type: Credential exposure through process arguments and URL query strings
Risk Level: MediumThe Skill requires a JustOneAPI credential to perform its declared API request. Sending a credential to the fixed JustOneAPI service is necessary, but the selected transport mechanisms expose the token beyond the minimum necessary scope.
Relevant request-construction code:
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);Relevant command-line parsing code:
js function parseArgs(argv) { const parsed = { operation: null, paramsJson: "{}", token: null }; for (let index = 0; index < argv.length; index += 1) { const flag = argv[index]; const value = argv[index + 1]; if (flag === "--operation") { parsed.operation = value; index += 1; continue; } if (flag === "--params-json") { parsed.paramsJson = value; index += 1; continue; } if (flag === "--token") { parsed.token = value; index += 1; continue; } fail(`Unknown argument "${flag}".`); } return parsed; }Relevant token injection code:
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: ...[truncated 3596 chars]- Remediation
View remediation
Remediation Suggestions
-
Change the API authentication scheme to use an HTTP authorization header, such as:
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, };This requires corresponding support from the JustOneAPI backend. Do not silently switch authentication formats unless the service documents and validates the header.
-
Read the credential directly from
process.env.JUST_ONE_API_TOKENinstead of accepting it through--token. Remove the token from process arguments and updateSKILL.mdaccordingly. -
Exclude authentication parameters from generic query-parameter construction. Treat credentials as a separate, explicitly handled security-sensitive field.
-
Configure clients, gateways, reverse proxies, application servers, and observability systems to redact authorization information and any legacy
tokenquery parameter. -
If query-based authentication cannot immediately be removed, disable query-string logging wherever possible, use narrowly scoped and short-lived tokens, and rotate credentials that may already have appeared in process or URL logs.
-
Add automated tests verifying that credentials never appear in the constructed URL, standard output, standard error, or diagnostic messages.
-
