T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:27- Finding
API Authentication Token Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs, lines 27–34, 68–74, and 197–207
Vulnerability Type: Sensitive credential exposure through URL query parameters
Risk Level: MediumVulnerable Code
The operation manifest defines the authentication token as a query parameter:
javascript { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" },The request URL is then populated and transmitted:
javascript 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, };javascript 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
injectTokenplaces the supplied API token intoparams.token. Because the manifest identifiestokenas having aquerylocation,applyQueryParamsappends the credential to the request URL beforefetchtransmits the request tohttps://api.justoneapi.com.HTTPS protects the URL from passive observation while the connection is in transit, but it does not prevent the complete URL from being recorded at endpoints or trusted intermediaries. Query strings may be retained in reverse-proxy access logs, API gateway telemetry, server logs, monitoring products, debugging output, or exception diagnostics. Personnel and services with access to th ...[truncated 1800 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace query-string authentication with an authorization header supported by the service, preferably:
javascript const requestInit = { headers: { "accept": "application/json", "authorization": `Bearer ${args.token}`, }, method: operation.method, }; -
Remove
tokenfrom the operation's query-parameter definitions and ensure it cannot be supplied through--params-json. -
If the upstream API only supports query-string authentication, request support for header-based authentication. Until then:
- Configure gateways, reverse proxies, servers, and monitoring systems to redact the
tokenquery parameter. - Disable full-URL logging for this endpoint.
- Ensure errors and diagnostic output never include serialized request URLs.
- Apply short token lifetimes, narrow endpoint scopes, rate limits, rotation, and revocation.
- Restrict access to request logs and establish short retention periods.
- Configure gateways, reverse proxies, servers, and monitoring systems to redact the
-
Reject credentials embedded in general parameters so the dedicated token handling path is always used.
-
Add automated tests verifying that tokens do not appear in URLs, standard output, standard error, or logged exception details.
-
