T09 · Insecure Skill Coding Practices
- Location
scripts/mta.mjs:281- Finding
Bus API Key Disclosed Through HTTP Error Messages
- Content
View full analysis
{ if (err.name === 'TimeoutError' || err.message?.includes('timeout')) { console.error('Request timed out. MTA feed may be slow or unreachable. Try again in a moment.'); } else if (err.code === 'ENOTFOUND' || err.code === 'ECONNREFUSED') { console.error('Network error: Could not reach MTA API. Check your internet connection.'); } else { console.error(`Error: ${err.message}`); } process.exit(1); }); ``` The same credential-bearing URL pattern is also used at: - `scripts/mta.mjs:826-827` - `scripts/mta.mjs:980-981` - `scripts/mta.mjs:1068-1069` - `scripts/mta.mjs:1088-1096` ### Technical Analysis The MTA BusTime API credential is transmitted as the `key` query parameter. Although sending the key to the declared official MTA HTTPS endpoint is necessary for bus functionality, the implementation passes the complete URL to `fetchJSON()` and includes that URL verbatim in exceptions generated for non-success HTTP responses. The top-level exception handler subsequently prints `err ...[truncated 1471 chars]- Remediation
View remediation
