T09 · Insecure Skill Coding Practices
- Location
src/client.ts:201- Finding
Unvalidated API endpoint can disclose bot credentials and sensitive message data
- Content
View full analysis
(endpoint: string, body: unknown): Promise { const url = `${this.baseUrl}${endpoint}`; const bodyStr = JSON.stringify(body); const controller = new AbortController(); const timer = setTimeout(() => controller.abort(), SEND_TIMEOUT_MS); try { const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json", AuthorizationType: "ilink_bot_token", Authorization: `Bearer ${this.token}`, "X-WECHAT-UIN": randomUIN(), }, body: bodyStr, signal: controller.signal, }); ``` The same unvalidated endpoint receives media-upload authorization requests: ```ts const uploadRes = await fetchWithTimeout( `${baseUrl}/ilink/bot/getuploadurl`, { method: "POST", headers: { "Content-Type": "application/json", AuthorizationType: "ilink_bot_token", Authorization: `Bearer ${token}`, "X-WECHAT-UIN": uinHeader, }, body: JSON.stringify(body), }, API_TIMEOUT_MS, ); ``` ...[truncated 2345 chars]- Remediation
View remediation
