T09 · Insecure Skill Coding Practices
- Location
scripts/amap-proxy.js:9- Finding
Unauthenticated Shell Command Injection in the Amap Proxy
- Content
View full analysis
{ if (error) { console.error('Search error:', error); response.writeHead(500, corsHeaders); response.end(JSON.stringify({ error: 'Search failed', details: error.message })); return; } // ... }); } function handleDetail(poiId, response) { const amapMapsDir = path.join(__dirname, '..', '..', 'amap-maps'); const amapKey = process.env.AMAP_KEY || "88628414733cf2ccb7ce2f94cfd680ef"; const command = `cd "${amapMapsDir}" && AMAP_KEY="${amapKey}" node scripts/amap.js search detail "${poiId}"`; exec(command, { timeout: 10000 }, (error, stdout, stderr) => { // ... }); } ``` The affected values originate from HTTP requests: ```javascript if (pathname === '/api/search' && req.method === 'GET') { const query = parsedUrl.query.q; const city = parsedUrl.query.city || '重庆'; // ... handleSearch(query, city, res); } if (pathname.startsWith('/api/detail ...[truncated 1974 chars]- Remediation
View remediation
