T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:220- Finding
API Token Exposed Through Process Arguments and URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:20-29, 95-102, 220-230; supporting invocation guidance atSKILL.md:45-51
Vulnerability Type: Credential exposure through command-line arguments and URL query parameters
Risk Level: MediumThe Skill legitimately needs an authentication token to call the declared JustOneAPI endpoint. However, the token is accepted as a command-line argument and subsequently transmitted as a URL query parameter.
Relevant parameter declaration:
js { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" },Request construction and transmission:
js 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, };Token injection:
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 also places the secret in the process argument list:
bash node {baseDir}/bin/run.mjs --operation "getKolConvertVideosOrProductsV1" --token "$JUST_ONE_API_TOKEN" --params-json '{"kolId":"<kolId>","detailType":"_1","page":1}'Technical Analysis
Process command-line arguments can be exposed through local process inspection, execution telemetry, shell tracing, job-runner metadata, diagnostic reports, or monitoring agents. Expan ...[truncated 2024 chars]
- Remediation
View remediation
Remediation Suggestions
- Read the token directly from
process.env.JUST_ONE_API_TOKENrather than requiring it through--token. If a CLI override must remain available, clearly mark it as unsafe and avoid using it in the default documentation. - If supported by JustOneAPI, transmit the credential in an authorization header, such as
Authorization: Bearer ..., rather than in the URL query string. - If the provider requires query-based authentication, request or adopt a header-authenticated API version. Until then, ensure that reverse proxies, gateways, observability systems, and error handlers redact the
tokenquery parameter. - Never print or include the constructed authenticated URL in normal output or error details. Add automated tests that verify token values do not appear in stdout, stderr, or diagnostic messages.
- Use short-lived, narrowly scoped tokens where the provider supports them, enforce usage limits, monitor abnormal API activity, and provide a documented revocation and rotation procedure.
- Update
SKILL.mdto recommend direct environment-variable consumption and explicitly warn against placing secret values in command lines, shell history, screenshots, or logs.
- Read the token directly from
