T09 · Insecure Skill Coding Practices
- Location
src/api/search.js:58- Finding
Authentication Token Exposed in URL Query Strings
- Content
View full analysis
Vulnerability Details
File Location:
src/api/search.js:58-77, with equivalent behavior insrc/api/comment.js:37-52,src/api/post.js:22-35, andsrc/api/hot.js:16-22
Vulnerability Type: Sensitive credential exposure through URL query parameters
Risk Level: HighVulnerable Code
javascript async function createSearchTask( token, keyword, sort, time, duration, content, limit, ) { const params = { _: Date.now(), token: token, }; const data = { keyword, sort_type: sort, publish_time: time, filter_duration: duration, content_type: content, limit: limit, }; return await requestApi( "POST", "/api/douyin/general-search/keyword", params, data, constants.CREATE_MAX_ATTEMPTS, "创建任务", ); }The shared request utility serializes these parameters directly into the request URL:
javascript const fullPath = `${path}?${querystring.stringify(params)}`; const options = { host: constants.BASE_URL, path: fullPath, method: "POST", headers: { "Content-Type": "application/json", "Accept-Encoding": "identity", "Content-Length": Buffer.byteLength(jsonData), }, };Query operations additionally place the token and user-supplied search details or Douyin URLs in GET query strings:
javascript const params = { _: Date.now(), token: token, keyword: keyword, sort_type: sort, publish_time: time, filter_duration: duration, content_type: content, limit: limit, };Technical Analysis
GUAIKEI_API_TOKENis a bearer-like service credential, but the application transmits it as atokenURL query parameter rather than in an authorization header. HTTPS protects the complete request in transit, but it does not prevent the URL from being recorded after TLS termination.Query strings are commonly retai ...[truncated 2087 chars]
- Remediation
View remediation
Remediation Suggestions
-
Remove
tokenfrom every query-parameter object. -
Send the credential through a request header, preferably:
javascript headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", "Accept-Encoding": "identity", } -
Update both GET and POST request helpers so authentication is handled centrally and cannot accidentally be serialized into a URL.
-
Ensure server, CDN, WAF, proxy, and APM configurations redact
Authorization, cookies, and any legacytokenparameter. -
Avoid placing user search terms and submitted resource URLs in GET query strings when they can be sent in a POST body.
-
Rotate existing tokens because historical infrastructure logs may already contain them.
-
Add automated tests that assert generated request paths never contain
token=. -
Document the exact third-party data transmission, retention policy, and credential revocation procedure.
-
