T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:175- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
"}' ``` `SKILL.md:45` ```markdown - Pass the token with `--token "$JUST_ONE_API_TOKEN"`; do not paste token values into chat messages, screenshots, or logs. ``` `bin/run.mjs:22-30` ```javascript { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" } ``` `bin/run.mjs:69-76` ```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); ``` `bin/run.mjs:91` ```javascript response = await fetch(url, requestInit); ``` `bin/run.mjs:175-188` ```javascript 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:224-233` ```javascript function appendValue(searchParams, name, value) { if (Array.isArray(value)) { for (const item of value) { appendValue(searchParams, name, item); } return; } if (value && typeof value === "object") { searchParams.append(name, JSON.stringify(value)); return; } searchParams.appe ...[truncated 2685 chars]- Remediation
View remediation
"}' ``` 5. If the upstream API strictly requires query-based authentication, document that residual risk, prevent the helper from logging complete URLs, configure proxies and monitoring systems to redact the `token` parameter, disable shell tracing around invocation, and use short-lived, least-privileged tokens. 6. Rotate any token suspected of having appeared in process telemetry, command histories, CI logs, proxy logs, or server access logs. ]]>
