T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:18- Finding
API Credential Exposed Through Command-Line Arguments and URL Query Parameters
- Content
View full analysis
"}' ``` `bin/run.mjs:18-25` defines the token as a required query parameter: ```js { "defaultValue": null, "description": "User security token for API access authentication.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" } ``` `bin/run.mjs:63-72` injects the command-line token and appends query parameters to the request URL: ```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); ``` `bin/run.mjs:223-231` copies the token into the parameter collection: ```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; } ``` Because the token parameter has `location: "query"`, the generic query builder ultimately creates a URL equivalent to: ```text https://api.justoneapi.com/api/facebook/get-profile-posts/v1?token=SECRET&profileId=... ``` ### Technical Analysis The credential is exposed through two security-sensitive channels: 1. The token is supplied throu ...[truncated 2379 chars]- Remediation
View remediation
