T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:219- Finding
API Authentication Token Exposed in the Request URL
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:89-96, 219-227
Vulnerability Type: Authentication token disclosure through a URL query parameter
Risk Level: MediumVulnerable Code
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);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); } }The operation manifest explicitly defines the authentication token as a query parameter:
js { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }Technical Analysis
The helper injects the API token into the general parameter object and passes every parameter whose location is
querytoURLSearchParams. Consequently, the final request URL contains the credential in the form?token=....HTTPS protects the URL from passive observation while it is transmitted to the fixed destination,
https://api.justoneapi.com. However, query strings are commonly captured by reverse-proxy access logs, API gateways, network monitoring products, tracing systems, diagnostic tooling, and backend request logs. Such systems may retain the complete URL for substantially longer than the request itself.Sending authentication material to the declared API provider is necessary for the Skill's functionality. ...[truncated 1424 chars]
- Remediation
View remediation
Remediation Suggestions
-
Replace query-string authentication with a provider-supported HTTP authentication header, preferably:
js const requestInit = { headers: { accept: "application/json", authorization: `Bearer ${token}`, }, method: operation.method, }; -
Remove
tokenfrom the operation's query-parameter definitions so the generic query builder cannot append it to the URL. -
Keep authentication material in a separate variable rather than merging it into the general user-supplied parameter object.
-
If the upstream API only accepts query authentication, request a header-based authentication mechanism from the provider. Until then:
- Configure gateways, proxies, and telemetry systems to redact the
tokenparameter. - Disable complete-URL logging for this endpoint.
- Apply short token lifetimes and narrowly scoped permissions.
- Rotate the token immediately if it may have entered logs.
- Configure gateways, proxies, and telemetry systems to redact the
-
Add automated tests asserting that serialized request URLs never contain token values.
-
