T09 · Insecure Skill Coding Practices
- Location
scripts/detect.js:105- Finding
<![CDATA[Custom API endpoints permit plaintext transmission of credentials and inspected content]]>
- Content
View full analysis
{ const endpoint = new URL(DETECT_PATH, baseUrl.replace(/\/$/, "")); const body = JSON.stringify({ input_text: text }); const isHttps = endpoint.protocol === "https:"; const transport = isHttps ? https : http; const options = { hostname: endpoint.hostname, port: endpoint.port || (isHttps ? 443 : 80), path: endpoint.pathname, method: "POST", headers: { "X-App-Key": apiKey, "Content-Type": "application/json", "Accept": "application/json", "Content-Length": Buffer.byteLength(body), }, }; const req = transport.request(options, (res) => { ``` ### Technical Analysis Both implementations accept a user-selected `--base-url`. The Node.js implementation explicitly selects the built-in `http` transport for an `http:` URL, while the Python implementation passes the unvalidated URL to `urllib.request.urlopen`. Each request contains both the API key in the `X-App-Key` header and the complete inspected text in the JSON body. Consequently, an HTTP custom endpoint transmits both values without confidentiality or transport integrity. Supporting custom endpoints is legitimate for self-hosting, but accepting plaintext HTTP is not necessary for normal operation. The default ho ...[truncated 1256 chars]- Remediation
View remediation
