T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:18- Finding
API Token Exposed in URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs, lines 18–24, 88–107, and 237–245
Vulnerability Type: API credential disclosure through URL query parameters
Risk Level: MediumVulnerable Code
js { "defaultValue": null, "description": "Security token for API access.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }js 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);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 classifies the API token as a query parameter.
applyQueryParamsconsequently appends the token tourl.searchParams, and the resulting URL is passed directly tofetch.HTTPS protects the request from passive network interception, but it does not prevent the complete URL from being recorded after TLS termination. Query strings are commonly retained by API gateway logs, reverse proxies, server access logs, application performance monitoring systems, debugging tools, and observability platforms.
Transmitting an authentication secret to ...[truncated 1481 chars]
- Remediation
View remediation
Remediation Suggestions
- Change the API authentication contract to use an HTTP header, preferably:
http Authorization: Bearer TOKEN_VALUE - Remove the token parameter from
operation.parametersso it cannot be processed byapplyQueryParams. - Add the authorization header directly to
requestInit.headers. - Ensure application, proxy, gateway, and telemetry configurations redact authentication headers.
- Update
generated/operations.json,generated/operations.md, andSKILL.mdto document header-based authentication. - Rotate any token that may already have been retained in URL or access logs.
- If the upstream API only supports query authentication, explicitly document the residual risk, disable query-string logging wherever possible, and apply automated redaction for the
tokenparameter.
- Change the API authentication contract to use an HTTP header, preferably:
