T09 · Insecure Skill Coding Practices
- Location
scripts/browser_capture.mjs:309- Finding
DataEase Authentication Token Is Sent to Unrelated Origins
- Content
View full analysis
Vulnerability Details
File Location:
scripts/browser_capture.mjs:309-350
Vulnerability Type: Authentication token disclosure through unrestricted browser headers
Risk Level: HighVulnerable Code:
javascript const context = await browser.newContext({ viewport: { width, height }, deviceScaleFactor: 1, ignoreHTTPSErrors: true, extraHTTPHeaders: { 'X-DE-TOKEN': token } }); await context.route('**/de2api/**', async route => { const request = route.request(); const headers = { ...request.headers(), 'X-DE-TOKEN': token }; const url = request.url(); if (url.includes('/de2api/outerParams/getOuterParamsInfo/')) { try { const response = await route.fetch({ headers }); if (response.status() < 500) { await route.fulfill({ response }); return; } debugLogs.push(`outerParams fallback: ${response.status()} ${url}`); } catch (error) { debugLogs.push(`outerParams fallback error: ${error?.message || String(error)}`); } await route.fulfill({ status: 200, contentType: 'application/json;charset=UTF-8', body: JSON.stringify({ code: 0, msg: 'success', data: { outerParamsInfoMap: {}, outerParamsInfoBaseMap: {} } }) }); return; } await route.continue({ headers }); });Technical Analysis
The
extraHTTPHeadersoption appliesX-DE-TOKENto every request made by the browser context, rather than only to requests sent to the configured DataEase origin. Although the subsequent route handler targets paths matching**/de2api/**, that route does not restrict or override the global behavior for other requests.A rendered dashboard may load third-party images, scripts, fonts, frames, tracking resources, or attacker-controlled URLs. Requests to those origins can consequently car ...[truncated 1116 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
extraHTTPHeadersfrom the browser context. - Parse and validate the configured DataEase URL before launching the browser.
- Add the token only in a route handler that verifies both the exact trusted origin and the expected
/de2api/path prefix. - Explicitly strip
X-DE-TOKEN,Authorization, cookies, and other credentials from cross-origin requests. - Consider blocking unnecessary third-party requests during capture.
- Reject redirects from the trusted DataEase origin to an untrusted origin.
- Use a short-lived, capture-specific token with the smallest available resource and organization scope.
- Remove
