Skip to content

WebSocket connections fail behind Fence sandbox (ignore HTTPS_PROXY) #625

Description

@paviko

Summary

When running Command Code inside popular sandbox tool Fence (https://github.com/fencesandbox/fence) (Linux sandbox using bwrap --unshare-net), all WebSocket connections time out. Fence routes network traffic through an HTTP proxy (HTTPS_PROXY=http://127.0.0.1:3128) since direct TCP is blocked by the network namespace.

curl, fetch, and HTTP requests work correctly. However, new WebSocket(url) (used in buildSandboxStreamUrl / defaultCreateSandboxStreamSocket) ignores proxy env vars and attempts a direct TCP connection, which is blocked by the sandbox.

The codebase already has detectProxyFromEnv(). Maybe use ws package with https-proxy-agent for WebSocket connections when a proxy is detected, instead of the built-in WebSocket

Expected Behavior

CommandCode working inside Fence sandboxing

Actual Behavior

Connection issues with Fence. Can't use CommandCode with it.

Steps to reproduce the issue

  1. Install and configure Fence ( https://github.com/fencesandbox/fence )
  2. Run CommandCode with "fence cmd"

Command Code Version

1.10.0

Operating System

Linux

Terminal/IDE

JetBrains-JediTerm

Shell

bwrap

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions