T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:216- Finding
API Credential Exposed in URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:25-31,bin/run.mjs:56-76, andbin/run.mjs:216-223
Vulnerability Type: API credential disclosure through URL query parameters
Risk Level: MediumVulnerable Code
The operation manifest defines the access token as a query parameter:
js { "defaultValue": null, "description": "Access token for the API.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" }The token is injected into the request parameters and subsequently added to the URL:
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, }; response = await fetch(url, requestInit);The query-parameter helper serializes every parameter whose location is
query, including the token: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
Authentication is necessary for the Skill's declared functionality, and the credential is sent over HTTPS only to the declared endpoint at
https://api.justoneapi.com. Therefore, the network request itself is expected and there is no evidence of covert exfiltration.However, placing an API credential in the URL produces a request resembling:
text https://api ...[truncated 2109 chars]- Remediation
View remediation
Remediation Suggestions
-
Change the API authentication contract to use an HTTP authorization header rather than a query parameter, for example:
js const requestInit = { method: operation.method, headers: { accept: "application/json", authorization: `Bearer ${args.token}`, }, }; -
Remove
tokenfromoperation.parametersso that generic query serialization cannot place it in the URL. -
Reject a
tokenproperty supplied through--params-json; credentials should enter through one dedicated authentication channel. -
Prefer reading the token directly from
JUST_ONE_API_TOKENrather than requiring it as a command-line argument. Command-line arguments may be visible to local process-inspection tools or retained in shell history. -
If the upstream API cannot support header-based authentication:
- Use short-lived, narrowly scoped tokens.
- Ensure servers, proxies, gateways, and telemetry systems redact the
tokenquery parameter. - Disable storage of complete query strings where operationally possible.
- Rotate affected credentials and monitor for unauthorized usage.
- Avoid including complete request URLs in errors or diagnostic logs.
-
Add automated tests confirming that secrets never appear in generated URLs, stdout, stderr, or exception payloads.
-
