T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:245- Finding
API Credential Exposed in the Request URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:17-25,bin/run.mjs:202-213,bin/run.mjs:245-267, andbin/run.mjs:115
Vulnerability Type: API credential disclosure through URL query parameters
Risk Level: MediumVulnerable Code
js { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }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); } } 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.append(name, String(value)); }js response = await fetch(url, requestInit);Technical Analysis
The authentication token is inserted into the general parameter object, classified as a query parameter, appended to the URL, and transmitted to the fixed JustOneAPI endpoint. TLS protects the URL while it is in transit, but it does not prevent the complete URL from being recorded by the API server, reverse pro ...[truncated 1395 chars]
- Remediation
View remediation
Remediation Suggestions
- Use an authentication header, such as
Authorization: Bearer <token>, if JustOneAPI supports it. - Keep the token separate from ordinary endpoint parameters so it cannot be serialized accidentally.
- Add explicit URL-redaction logic before URLs are written to logs, errors, or telemetry.
- Configure API gateways, proxies, and backend services not to record sensitive query parameters.
- Use short-lived, narrowly scoped tokens and provide straightforward rotation and revocation controls.
- If query-string authentication is an unavoidable upstream requirement, document this residual risk prominently and verify that every network layer suppresses or redacts the
tokenparameter.
- Use an authentication header, such as
