other
- Location
plugin/dist/.setup/config-options-CsLZNDe3.mjs:510- Finding
Remote WebSocket Transport Allows Cleartext Transmission of Credentials and Agent Traffic ## Remediation Suggestions 1. **Require TLS for remote WebSocket connections.** Parse the configured URL and reject every non-loopback destination unless its scheme is `wss:`. Enforce this alongside the existing remote-authentication requirement. 2. **Validate schemes explicitly.** For WebSocket transport, accept only `ws:` and `wss:`. Restrict plaintext `ws:` to strictly validated loopback addresses. Preserve the separate Unix-socket transport boundary. 3. **Add defense-in-depth validation at connection creation.** Apply the same transport-security policy immediately before constructing the WebSocket connection so alternate callers cannot bypass configuration validation. 4. **Maintain certificate verification.** Do not disable TLS certificate or hostname verification. Where private certificate authorities are necessary, configure an explicit trust store. 5. **Add regression tests.** Verify that remote `ws://` URLs are rejected even with valid credentials, remote `wss://` URLs still require authentication, and intended loopback and Unix-socket connections continue to work. 6. **Address existing exposure.** Identify plaintext remote deployments, migrate them to TLS or a separately secured tunnel, and rotate credentials that may have traversed untrusted networks.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/.setup/config-options-CsLZNDe3.mjs:510–519plugin/dist/.setup/transport-websocket-BazDtpsr.mjs:30–47
Vulnerability Type: CWE-319 — Cleartext Transmission of Sensitive Information
Risk Level: MediumVulnerable Code
The connection-security check requires authentication for remote connections but does not require encrypted transport:
javascript function inferCodexAppServerConnectionClass(params) { if (params.transport !== "websocket") return "local-loopback"; const parsed = params.url ? URL.parse(params.url) : null; return (parsed?.protocol === "ws:" || parsed?.protocol === "wss:") && isLoopbackHost(parsed.hostname) ? "local-loopback" : "remote"; } /** Applies the canonical remote-auth boundary to any Codex AppServer transport. */ function assertCodexAppServerConnectionSecurity(params) { if (inferCodexAppServerConnectionClass(params) === "remote" && !readNonEmptyString(params.authToken) && !Object.entries(params.headers).some(([key, value]) => key.trim().toLowerCase() === "authorization" && Boolean(readNonEmptyString(value)))) throw new Error("remote Codex app-server WebSocket URLs require appServer.authToken or an Authorization header"); }The transport then forwards credentials and the configured URL directly to the WebSocket implementation:
javascript /** Opens a WebSocket app-server transport and maps newline-delimited frames to stdout/stdin. */ function createWebSocketTransport(options) { if (!options.url) throw new Error("codex app-server websocket transport requires plugins.entries.codex.config.appServer.url"); const events = new EventEmitter(); const stdout = new PassThrough(); const stderr = new PassThrough(); const websocketOptions = { headers: { ...options.headers, ...options.authToken ? { Authorization: `Bearer ${options.authToken}` } : {} }, perMessageDeflate: false, ...options.transport === "websocket" ? { handshakeTimeout: WEBSOCKET_HANDS ...[truncated 3025 chars]
