T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:20- Finding
API Credential Exposed Through URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:20-29, 132-139, 242-253, 276-284
Vulnerability Type: API credential disclosure through URL query-string authentication
Risk Level: MediumVulnerable Code
js { "defaultValue": null, "description": "Access token for this API service.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }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); const requestInit = { headers: { "accept": "application/json", }, method: operation.method, }; 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, }); }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; }js function applyQueryParams(operation, params, url) { for (const parameter of operation.parameters.filter((item) => item.location === "query")) { const value = params[parameter.name]; if (value === undefined) { continue; } appendValue(url.searchParams, parameter.name, value); } }Technical Analysis
The operation manifest defin ...[truncated 2763 chars]
- Remediation
View remediation
Remediation Suggestions
-
Prefer a provider-supported authentication header, such as:
js const requestInit = { headers: { accept: "application/json", authorization: `Bearer ${args.token}`, }, method: operation.method, };Remove
tokenfrom the query-parameter manifest and ensure it is never added toURLSearchParams. -
If JustOneAPI only supports query-string authentication:
- Configure reverse proxies, gateways, application servers, and observability platforms to redact the
tokenparameter. - Disable full request-URL logging where practical.
- Ensure errors and debugging output never include
url.href, request objects, or unredacted query strings. - Use narrowly scoped, short-lived tokens where the provider supports them.
- Rotate tokens regularly and immediately after suspected exposure.
- Monitor provider usage for anomalous requests or quota consumption.
- Explicitly document the residual query-string exposure for users.
- Configure reverse proxies, gateways, application servers, and observability platforms to redact the
-
Prevent callers from supplying
tokeninside--params-json; accept it only through the dedicated credential channel. This reduces accidental inclusion in command examples and serialized parameter objects. -
Prefer reading the credential directly from
JUST_ONE_API_TOKENrather than requiring it as a command-line argument, because process arguments may be visible to local process-inspection tools on some operating systems.
-
