T09 · Insecure Skill Coding Practices
- Location
bin/run.mjs:24- Finding
Authentication Token Exposed in the Request URL Query String
- Content
View full analysis
Vulnerability Details
File Location:
bin/run.mjs:24-31,bin/run.mjs:209-217
Vulnerability Type: Credential exposure through URL query parameters
Risk Level: MediumThe operation metadata declares the authentication token as a query parameter:
javascript { "defaultValue": null, "description": "User authentication token.", "enumValues": [], "location": "query", "name": "token", "required": true, "schemaType": "string" },The generic query-parameter handling subsequently appends the token to the request URL:
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); } }The resulting request has the effective form:
text https://api.justoneapi.com/api/douyin-xingtu/gw/api/data_sp/item_report_detail/v1?token=SECRET&itemId=ITEM_IDTechnical Analysis
The helper receives an authentication token, injects it into the operation parameters, and uses
URLSearchParamsto place it in the URL. Although the request is sent over HTTPS to the fixed, declaredapi.justoneapi.comhost, TLS does not prevent the URL from being recorded after termination.Query strings are commonly retained by API gateways, reverse proxies, access logs, web application firewalls, observability platforms, tracing systems, browser-like tooling, and error telemetry. Consequently, infrastructure components that legitimately process the request may unintentionally retain the reusable credential.
The documented invocation also passes the token through the
--tokencommand-line argument. Depending on operating-system configuration, command-line arguments may be vis ...[truncated 2029 chars]- Remediation
View remediation
Remediation Suggestions
-
Change the API authentication scheme to use an HTTP authorization header rather than a query parameter:
javascript const requestInit = { headers: { accept: "application/json", authorization: `Bearer ${token}`, }, method: operation.method, }; -
Coordinate this change with the JustOneAPI server so the endpoint accepts header-based authentication. Remove
tokenfrom the operation's query-parameter metadata after server support is available. -
Read the credential directly from
process.env.JUST_ONE_API_TOKENinstead of requiring it as a command-line argument. If explicit injection is necessary, use protected standard input or another secret-delivery mechanism that does not expose the token in process listings. -
Ensure application, proxy, gateway, telemetry, and error logs redact authorization headers and sensitive query parameters. Until query authentication is retired, explicitly redact the
tokenparameter before recording URLs. -
Avoid including complete request URLs, authorization values, or command invocations in diagnostic output. Add automated tests that verify credentials never appear in URLs, standard output, standard error, or exceptions.
-
Rotate any token that may already have been retained in logs or shell history, and define short expiration periods and least-privilege scopes for replacement credentials.
-
