T09 · Insecure Skill Coding Practices
- Location
scripts/video-search.js:31- Finding
Insecure API Key Handling and Unrestricted API Endpoint Configuration
- Content
View full analysis
{ const baseUrl = (loadConfig().baseUrl || DEFAULT_BASE_URL).replace(/\/+$/, ''); const fullUrl = new URL(urlPath, baseUrl); const isHttps = fullUrl.protocol === 'https:'; const mod = isHttps ? https : http; const options = { hostname: fullUrl.hostname, port: fullUrl.port || (isHttps ? 443 : 80), path: fullUrl.pathname + fullUrl.search, method: method, headers: { 'X-API-Key': apiKey, } }; ``` The configuration command accepts an arbitrary base URL and saves it together with the API key: ```javascript async function config(args) { const apiKey = getArg(args, '--api-key'); const baseU ...[truncated 2896 chars]- Remediation
View remediation
