T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:112- Finding
API Token Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
item.operationId === args.operation); if (!operation) { fail(`Unknown operation "${args.operation}".`, { availableOperations: manifest.operations.map((item) => item.operationId) }); } 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, }; if (operation.requestBody && params.body !== undefined) { requestInit.body = JSON.stringify(params.body); requestInit.headers["content-type"] = operation.requestBody.contentType || "application/json"; } let response; try { response = await fetch(url, requestInit); } catch (error) { fail("Network request failed.", { cause: error instanceof Error ? error.message : String(error), operationId: operation.operationId, }); } ``` The token is defined as a query parameter at `bin/run.mjs:24-32`: ```javascript { "defaultValue": null, "description": "User's authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" } ``` The documented invocation at `SKILL.md:50` places the environment variable value into the process argument list: ```bash node {baseDir}/bin/run.mjs --operation "mainSe ...[truncated 3692 chars]- Remediation
View remediation
"}' ``` - Prefer co ...[truncated 144 chars]
