T09 · Insecure Skill Coding Practices
- Location
scripts/navigation.js:12- Finding
Unvalidated API Base URL Can Exfiltrate API Keys and Travel Data in Route Planning
- Content
View full analysis
{ https.get(url.toString(), (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { try { const result = JSON.parse(data); if (result.status === '1' && result.geocodes && result.geocodes.length > 0) { resolve(result.geocodes[0].location); } else { reject(new Error(`Geocoding failed: ${address}`)); } } catch (err) { reject(err); } }); }).on('error', reject); }); } ``` Route requests use the same configuration: ```javascript const endpoint = mode === 'transit' ? '/v3/direction/transit/integrated' : `/v3/direction/${mode}`; const url = new URL(endpoint, AMAP_BASE_URL); url.searchParams.set('key', AMAP_API_KEY); url.searchParams.set('origin', originLoc); url.searchParams.set('destination', destLoc); https.get(url.toString(), (res) => { // Response processing }); ``` ### Technical Analysis `AMAP_BASE_URL` is read directly from the process environment and used as the base for outbound HTTPS requests without validating its hostname, port, credentials, or expected origin. The code then places the AMap API key and user travel information in URL query parameters. ...[truncated 1606 chars]- Remediation
View remediation
