T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:115- Finding
API Credential Exposed Through Process Arguments and URL Query Parameters
- Content
View full analysis
"}' ``` `bin/run.mjs:115-121` injects the token into the parameters and adds all query parameters to the 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:235-247` copies the command-line token into the operation parameters: ```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; } ``` `bin/run.mjs:253-263` appends query-located parameters, including `token`, to the outbound URL: ```js function applyQueryParams(operation, params, url) { for (const parameter of operation.parameters.filter((item) => item. ...[truncated 3155 chars]- Remediation
View remediation
