T09 · Insecure Skill Coding Practices
- Location
scripts/config.mjs:7- Finding
Bearer API Key and Operational Data Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/config.mjs:7-22
Vulnerability Type: Insufficient transport security for credentials and sensitive operational data
Risk Level: HighVulnerable Code
js const baseUrl = (process.env.AGENTNOTES_BASE_URL || "http://localhost:3000").replace( /\/$/, "" ); const logPath = process.env.AGENTNOTES_LOG_PATH || DEFAULT_LOG_PATH; const completePath = process.env.AGENTNOTES_COMPLETE_PATH || DEFAULT_COMPLETE_PATH; return { apiKey, agentId, baseUrl, logUrl: `${baseUrl}${logPath.startsWith("/") ? logPath : `/${logPath}`}`, completeUrl: `${baseUrl}${ completePath.startsWith("/") ? completePath : `/${completePath}` }`, };The resulting URLs are used with bearer authentication, for example in
scripts/log.mjs:37-55:js const res = await fetch(logUrl, { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify({ agent_id: agentId, run_id: runId, logs: [ { step_name: stepName, event_type: isError ? "error" : "log", message: message || (isError ? "Error" : "log"), data, }, ], }), });Equivalent authenticated requests are made in
scripts/start-run.mjs:13-23,scripts/task.mjs:42-108,scripts/complete-run.mjs:36-49, andscripts/verify.mjs:25-42.Technical Analysis
AGENTNOTES_BASE_URLis accepted without validating its protocol or host. Although the default HTTP endpoint points to localhost and may be appropriate for local development, the same code permits a remote URL such ashttp://agentnotes.example. Requests to such an endpoint include the API key in anAuthorization: Bearerheader.The request bodies may also contain the agent identifier, run identifier, task summaries, step messages, structured data, and error details. W ...[truncated 1437 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse the configured endpoint with
new URL()and reject malformed URLs. - Require the
https:protocol for every non-loopback destination. - If local development requires plaintext HTTP, permit it only for explicitly recognized loopback hosts such as
localhost,127.0.0.1, and[::1]. - Reject unsupported protocols and URLs containing embedded user information.
- Consider restricting production deployments to an explicit allowlist of trusted AgentNotes hosts.
- Document that remote endpoints must use HTTPS with valid certificate verification.
- Apply least privilege and rotation to AgentNotes API keys so interception has limited impact.
- Avoid including unnecessary sensitive content in task summaries, log messages, structured data, and error details.
- Add automated tests confirming that remote HTTP URLs are rejected while trusted HTTPS and loopback development URLs are accepted.
- Parse the configured endpoint with
