T09 · Insecure Skill Coding Practices
- Location
index.js:111- Finding
Credential Exfiltration Through Attacker-Controlled OpenAPI Specifications
- Content
View full analysis
API_KEY const token = process.env[envVarName] || process.env[`${envVarName}_TOKEN`] || process.env[`${envVarName}_KEY`]; if (token) { if (scheme.type === 'http' && scheme.scheme === 'bearer') { headers['Authorization'] = `Bearer ${token}`; } else if (scheme.type === 'apiKey' && scheme.in === 'header') { headers[scheme.name] = token; } } } } console.error(`Executing ${selectedMethod.toUpperCase()} ${fullUrl}`); // Log to stderr to keep stdout clean for JSON output const res = await fetch(fullUrl, { method: selectedMethod, headers, body: ['POST', 'PUT', 'PATCH'].includes(selectedMethod.toUpperCase()) ? JSON.stringify(body) : undefined, }); ``` ### Technical Analysis The OpenAPI specification controls both the destination in `servers[0].url` and the security-scheme name used to select an environment variable. The implementation converts the scheme name into an environment-variable name and automatically attaches any matching local secre ...[truncated 2069 chars]- Remediation
View remediation
