T09 · Insecure Skill Coding Practices
- Location
src/enrichment/email-scraper.ts:91- Finding
Unrestricted Website Fetching Enables Server-Side Request Forgery
- Content
View full analysis
0) { const best = scrapeResult.emails[0]!; ``` ```ts // src/enrichment/email-scraper.ts:91-108 let baseUrl = websiteUrl.trim(); if (!baseUrl.startsWith('http://') && !baseUrl.startsWith('https://')) { baseUrl = 'https://' + baseUrl; } // Remove trailing slash baseUrl = baseUrl.replace(/\/$/, ''); const urlObj = new URL(baseUrl); const domain = urlObj.hostname.replace('www.', ''); logger.debug(`Scraping ${baseUrl} for emails`); // Try each contact path for (const path of CONTACT_PATHS) { const pageUrl = baseUrl + path; try { const pageEmails = await scrapePageForEmails(pageUrl, domain); ``` ```ts // src/enrichment/email-scraper.ts:162-177 const controller = new AbortController(); const timeout = setTimeout(() => controller.abort(), 10000); try { const response = await fetch(url, { signal: controller.signal, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', }, redirect: 'follow', }); ``` ### Technical Analysis The enrichment waterfall automatically fetches website URLs stored in lead records. These URLs originate from external business listings and are not validated as public Internet destinations before being passed to `fetch`. The implementation accepts both HTTP and HTTPS, follows redirects automatically, and ...[truncated 2054 chars]- Remediation
View remediation
