T09 · Insecure Skill Coding Practices
- Location
scripts/http.js:1- Finding
API Credential Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
} [extraHeaders] */ export async function apiRequest(method, path, body, extraHeaders = {}) { const root = baseUrl(); const p = path.startsWith('/') ? path : `/${path}`; const url = `${root}${p}`; const headers = { 'x-api-key': apiKey(), ...extraHeaders, }; const init = { method, headers }; if (body !== undefined && method !== 'GET' && method !== 'HEAD') { headers['Content-Type'] = 'application/json'; init.body = JSON.stringify(body); } const res = await fetch(url, init); ``` The insecure HTTP configuration is also shown in `SKILL.md:84-86`: ```bash export KRYPTONE_API_BASE_URL=http://localhost:5001 export AGENT_API_KEY=your-server-agent-key ``` ### Technical Analysis The API base URL is read directly from an environment variable and used without parsing or validating its protocol or destination. The `AGENT_API_KEY` credential is then attached to every request through the `x-api-key` header. Although plaintext HTTP is appropriate for a strictly local loopback development server, the implementation does not restrict HTTP connections to loopback addresses. A user can therefore configure a non-local URL such as `http://api.example.test`, causing the s ...[truncated 2190 chars]- Remediation
View remediation
