T09 · Insecure Skill Coding Practices
- Location
scripts/call_informat.js:43- Finding
Agent Token and Sensitive API Payloads Can Be Transmitted over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
scripts/call_informat.js:43-48, 851-879, 922-925
Vulnerability Type: Cleartext transmission of credentials and sensitive API data
Risk Level: HighVulnerable Code
javascript function post(targetUrl, headers, body, callback) { var parsed = new urlMod.URL(targetUrl); var mod = parsed.protocol === "https:" ? https : http; var req = mod.request(parsed, { method: "POST", headers: Object.assign({}, headers, { "Content-Length": Buffer.byteLength(body) }), timeout: 60000, }, function (res) {javascript var host = (process.env.INFORMAT_HOST || env.INFORMAT_HOST || "").trim(); if (!host) { console.error("Missing INFORMAT_HOST"); process.exit(1); } var agentToken = (process.env.INFORMAT_AGENT_TOKEN || env.INFORMAT_AGENT_TOKEN || "").trim(); if (!agentToken) { console.error("Missing INFORMAT_AGENT_TOKEN"); process.exit(1); } if (host.charAt(host.length - 1) !== "/") host += "/"; // Build API path var apiPath; if (methodName.startsWith("_company_")) { apiPath = "web0/aiagent/company_agent"; } else if (methodName.startsWith("_wb_")) { apiPath = "web0/aiagent/wb_agent"; } else if (appId) { apiPath = "web0/aiagent/app_agent/" + appId; } else { apiPath = "web0/aiagent/common_agent"; } var url = host + apiPath; var body = JSON.stringify({ jsonrpc: "2.0", id: 1, params: { name: methodName, arguments: methodArgs, threadId: informatAgentThreadId || null, }, });javascript postWithRetry(url, { "Content-Type": "application/json", "X-INFORMAT-AGENT-TOKEN": agentToken, }, body, function (err, text) {Technical Analysis
The client accepts
INFORMAT_HOSTwithout enforcing HTTPS. The transport implementation selects Node.js's plaintexthttpmodule whenever the configured URL does not use thehttps:protocol:javascript var mod = parsed.protocol === "https:" ? https : http;Consequently, configuring
INFORMAT_HOSTas anhttp://URL ca ...[truncated 2809 chars]- Remediation
View remediation
Remediation Suggestions
-
Enforce HTTPS before constructing or sending any request
javascript const parsedHost = new URL(host); if (parsedHost.protocol !== "https:") { throw new Error("INFORMAT_HOST must use HTTPS"); } -
Reject unsupported or ambiguous URL forms
- Permit only
https:. - Reject URLs containing embedded credentials.
- Normalize the host with
URLrather than string concatenation. - Reject fragments and unexpected paths if the deployment expects an origin only.
- Permit only
-
Restrict credential destinations
- Maintain an allowlist of approved Informat domains or origins.
- Compare the final request origin against the configured approved origin before attaching
X-INFORMAT-AGENT-TOKEN. - Do not forward credentials across redirects.
-
Remove or harden
.envcredential fallback- Prefer runtime secret injection from a managed secret store.
- If
.envsupport is required for development, require an explicit development flag. - Verify restrictive file permissions and reject files writable by untrusted users.
- Never rely on
.gitignoreas a credential-protection control.
-
Use least-privilege tokens
- Separate team, workbench, common, and application-operation credentials where possible.
- Limit each token to the specific methods and applications required.
- Use short-lived, revocable credentials.
-
Protect network transport
- Use valid certificate verification without disabling TLS checks.
- Consider certificate or public-key pinning in managed deployments.
- Rotate the Agent token immediately if plaintext transmission may already have occurred.
-
Add automated tests
- Confirm that
http://hosts are rejected. - Confirm that credentials are never attached to unapproved origins.
- Confirm that malformed or unsupported protocols fail closed before network activity.
- Confirm that
-
