@sysid/sandbox-runtime-improved 0.0.43-sysid.5 → 0.0.45-sysid.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +37 -12
  2. package/dist/sandbox/http-proxy.d.ts +5 -4
  3. package/dist/sandbox/http-proxy.d.ts.map +1 -1
  4. package/dist/sandbox/http-proxy.js +131 -194
  5. package/dist/sandbox/http-proxy.js.map +1 -1
  6. package/dist/sandbox/linux-sandbox-utils.d.ts +17 -6
  7. package/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -1
  8. package/dist/sandbox/linux-sandbox-utils.js +109 -16
  9. package/dist/sandbox/linux-sandbox-utils.js.map +1 -1
  10. package/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -1
  11. package/dist/sandbox/macos-sandbox-utils.js +9 -0
  12. package/dist/sandbox/macos-sandbox-utils.js.map +1 -1
  13. package/dist/sandbox/parent-proxy.d.ts +117 -0
  14. package/dist/sandbox/parent-proxy.d.ts.map +1 -0
  15. package/dist/sandbox/parent-proxy.js +438 -0
  16. package/dist/sandbox/parent-proxy.js.map +1 -0
  17. package/dist/sandbox/sandbox-config.d.ts +75 -8
  18. package/dist/sandbox/sandbox-config.d.ts.map +1 -1
  19. package/dist/sandbox/sandbox-config.js +26 -7
  20. package/dist/sandbox/sandbox-config.js.map +1 -1
  21. package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
  22. package/dist/sandbox/sandbox-manager.js +50 -12
  23. package/dist/sandbox/sandbox-manager.js.map +1 -1
  24. package/dist/sandbox/socks-proxy.d.ts +7 -0
  25. package/dist/sandbox/socks-proxy.d.ts.map +1 -1
  26. package/dist/sandbox/socks-proxy.js +59 -0
  27. package/dist/sandbox/socks-proxy.js.map +1 -1
  28. package/dist/vendor/seccomp/arm64/apply-seccomp +0 -0
  29. package/dist/vendor/seccomp/arm64/unix-block.bpf +0 -0
  30. package/dist/vendor/seccomp/x64/apply-seccomp +0 -0
  31. package/dist/vendor/seccomp/x64/unix-block.bpf +0 -0
  32. package/dist/vendor/seccomp-src/apply-seccomp.c +231 -44
  33. package/dist/vendor/seccomp-src/seccomp-unix-block.c +50 -3
  34. package/package.json +2 -2
  35. package/vendor/seccomp/arm64/apply-seccomp +0 -0
  36. package/vendor/seccomp/arm64/unix-block.bpf +0 -0
  37. package/vendor/seccomp/x64/apply-seccomp +0 -0
  38. package/vendor/seccomp/x64/unix-block.bpf +0 -0
  39. package/vendor/seccomp-src/apply-seccomp.c +231 -44
  40. package/vendor/seccomp-src/seccomp-unix-block.c +50 -3
package/README.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
 
6
6
  Based on [Anthropic Sandbox Runtime](https://github.com/anthropic-experimental/sandbox-runtime).
7
+ Why: I just need faster feature cycle-times.
8
+
9
+ This fork will be rebased on [SRT](https://github.com/anthropic-experimental/sandbox-runtime) continuously (currently based on upstream **v0.0.45**).
10
+ As new features become available, equivalent local ones will be removed.
11
+
12
+ > Objective: keep as close to original as possible, while allowing selected additional features.
7
13
 
8
14
  ---
9
15
 
@@ -11,15 +17,11 @@ Based on [Anthropic Sandbox Runtime](https://github.com/anthropic-experimental/s
11
17
 
12
18
  ```json
13
19
  {
14
- "network": {
15
- "upstreamHttpProxy": "http://127.0.0.1:3128"
16
- },
17
20
  "allowBrowserProcess": false,
18
21
  "allowMachLookup": ["com.1password.*"]
19
22
  }
20
23
  ```
21
- - `network.upstreamHttpProxy` - URL of an upstream HTTP proxy to chain through (e.g., `"http://127.0.0.1:3128"`). When set, the built-in proxy forwards allowed requests through this proxy instead of connecting directly. Useful behind corporate proxies. *(fork-only)*
22
- - `allowBrowserProcess` - Allow browser process operations in the macOS sandbox (boolean, default: false). Grants Mach IPC, bootstrap registration, IOKit, and POSIX shared memory permissions that Chromium-based browsers need to launch. Required for tools like `agent-browser` that spawn a Chrome subprocess. *(fork-only)*
24
+ - `allowBrowserProcess` - **Significantly weakens the macOS sandbox.** Grants `(allow mach*)`, `(allow process-info*)`, `(allow iokit-open)`, and `(allow ipc-posix-shm*)` permissions Chromium-based browsers need to launch. Filesystem and network restrictions remain enforced. Only enable for browser automation (e.g. `agent-browser`). (boolean, default: false) *(fork-only)*
23
25
  - `allowMachLookup` - Additional Mach/XPC service names to allow in the macOS sandbox (string array, optional). Names ending with `*` use prefix matching (e.g., `"com.1password.*"`). Use for tools like 1Password CLI that need specific services. *(fork-only, mirrors [upstream PR #92](https://github.com/anthropic-experimental/sandbox-runtime/pull/92))*
24
26
 
25
27
  ---
@@ -172,6 +174,7 @@ src/
172
174
  ├── sandbox-violation-store.ts # Violation tracking
173
175
  ├── sandbox-utils.ts # Shared sandbox utilities
174
176
  ├── http-proxy.ts # HTTP/HTTPS proxy for network filtering
177
+ ├── parent-proxy.ts # Upstream/parent proxy chaining
175
178
  ├── socks-proxy.ts # SOCKS5 proxy for network filtering
176
179
  ├── linux-sandbox-utils.ts # Linux bubblewrap sandboxing
177
180
  └── macos-sandbox-utils.ts # macOS sandbox-exec sandboxing
@@ -200,7 +203,7 @@ srti --settings /path/to/srt-settings.json npm install
200
203
  import {
201
204
  SandboxManager,
202
205
  type SandboxRuntimeConfig,
203
- } from '@anthropic-ai/sandbox-runtime'
206
+ } from '@sysid/sandbox-runtime-improved'
204
207
  import { spawn } from 'child_process'
205
208
 
206
209
  // Define your sandbox configuration
@@ -239,10 +242,10 @@ child.on('exit', async code => {
239
242
 
240
243
  ```typescript
241
244
  // Main sandbox manager
242
- export { SandboxManager } from '@anthropic-ai/sandbox-runtime'
245
+ export { SandboxManager } from '@sysid/sandbox-runtime-improved'
243
246
 
244
247
  // Violation tracking
245
- export { SandboxViolationStore } from '@anthropic-ai/sandbox-runtime'
248
+ export { SandboxViolationStore } from '@sysid/sandbox-runtime-improved'
246
249
 
247
250
  // TypeScript types
248
251
  export type {
@@ -254,7 +257,7 @@ export type {
254
257
  FsReadRestrictionConfig,
255
258
  FsWriteRestrictionConfig,
256
259
  NetworkRestrictionConfig,
257
- } from '@anthropic-ai/sandbox-runtime'
260
+ } from '@sysid/sandbox-runtime-improved'
258
261
  ```
259
262
 
260
263
  ## Configuration
@@ -281,6 +284,11 @@ srti --settings /path/to/srt-settings.json <command>
281
284
  "*.npmjs.org"
282
285
  ],
283
286
  "deniedDomains": ["malicious.com"],
287
+ "parentProxy": {
288
+ "http": "http://proxy.corp:3128",
289
+ "https": "http://proxy.corp:3128",
290
+ "noProxy": "localhost,127.0.0.1,*.internal.corp"
291
+ },
284
292
  "allowUnixSockets": ["/var/run/docker.sock"],
285
293
  "allowLocalBinding": false
286
294
  },
@@ -309,6 +317,10 @@ Uses an **allow-only pattern** - all network access is denied by default.
309
317
  - `network.allowedDomains` - Array of allowed domains (supports wildcards like `*.example.com`). Empty array = no network access.
310
318
  - `network.deniedDomains` - Array of denied domains (checked first, takes precedence over allowedDomains)
311
319
  - `network.allowLocalBinding` - Allow binding to local ports (boolean, default: false)
320
+ - `network.parentProxy` - Upstream HTTP proxy for outbound connections (object, optional). When set, the sandbox's built-in proxy tunnels traffic through this parent proxy instead of connecting directly. Falls back to `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` environment variables if unset.
321
+ - `http` - Proxy URL for plain HTTP traffic (e.g., `"http://proxy.corp:3128"`)
322
+ - `https` - Proxy URL for HTTPS/CONNECT traffic (falls back to `http` if unset)
323
+ - `noProxy` - Comma-separated bypass list: hostname suffixes and CIDR ranges that connect directly
312
324
 
313
325
  **Unix Socket Settings** (platform-specific behavior):
314
326
 
@@ -464,6 +476,14 @@ Watchman accesses files outside the sandbox boundaries, which will trigger permi
464
476
  - Fedora: `dnf install ripgrep`
465
477
  - Arch: `pacman -S ripgrep`
466
478
 
479
+ **Ubuntu 24.04+ note:** These releases enable `kernel.apparmor_restrict_unprivileged_userns` by default, which allows `unshare(CLONE_NEWUSER)` but strips capabilities from the resulting namespace. Both bubblewrap and the seccomp isolation layer need capability-bearing user namespaces. Disable the restriction with:
480
+
481
+ ```bash
482
+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
483
+ ```
484
+
485
+ or add an AppArmor profile that grants `userns` to the relevant binaries.
486
+
467
487
  **Optional Linux dependencies (for seccomp fallback):**
468
488
 
469
489
  The package includes pre-generated seccomp BPF filters for x86-64 and arm architectures. These dependencies are only needed if you are on a different architecture where pre-generated filters are not available:
@@ -539,6 +559,8 @@ The sandbox runs HTTP and SOCKS5 proxy servers on the host machine that filter a
539
559
 
540
560
  - **macOS**: The Seatbelt profile allows communication only to specific localhost ports where the proxies listen. All other network access is blocked.
541
561
 
562
+ **Parent/upstream proxy chaining:** When running behind a corporate proxy, configure `network.parentProxy` (or set `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` environment variables) to chain the sandbox's proxies through an upstream proxy. Both HTTP and SOCKS5 traffic will tunnel through the parent proxy via CONNECT. Destinations matching `noProxy` patterns bypass the parent and connect directly.
563
+
542
564
  ### Filesystem Isolation
543
565
 
544
566
  Filesystem restrictions are enforced at the OS level:
@@ -620,11 +642,14 @@ On Linux, the sandbox uses **seccomp BPF (Berkeley Packet Filter)** to block Uni
620
642
  4. **Two-stage application using apply-seccomp binary**:
621
643
  - Outer bwrap creates the sandbox with filesystem, network, and PID namespace restrictions
622
644
  - Network bridging processes (socat) start inside the sandbox (need Unix sockets)
623
- - apply-seccomp binary applies the seccomp filter via `prctl()`
624
- - apply-seccomp execs the user command with seccomp active
645
+ - apply-seccomp creates a nested user+PID+mount namespace and remounts `/proc`
646
+ - Inside the nested namespace, apply-seccomp acts as PID 1 (non-dumpable init/reaper)
647
+ - apply-seccomp forks, applies the seccomp filter via `prctl()`, and execs the user command
625
648
  - User command runs with all sandbox restrictions plus Unix socket creation blocking
626
649
 
627
- **Security limitations**: The filter only blocks `socket(AF_UNIX, ...)` syscalls. It does not prevent operations on Unix socket file descriptors inherited from parent processes or passed via `SCM_RIGHTS`. For most sandboxing scenarios, blocking socket creation is sufficient to prevent unauthorized IPC.
650
+ **PID namespace isolation**: The nested PID namespace ensures the user command cannot see or address any process that runs without the seccomp filter (bwrap's init, the shell wrapper, or the socat helpers). This keeps the seccomp boundary intact regardless of `kernel.yama.ptrace_scope`, since unfiltered helpers are not reachable via `ptrace` or `/proc/N/mem`. The inner PID 1 sets `PR_SET_DUMPABLE=0` so it is not ptraceable either. If nested namespace creation fails, apply-seccomp aborts rather than running without isolation.
651
+
652
+ **Security limitations**: The filter blocks `socket(AF_UNIX, ...)` and the `io_uring_setup`/`io_uring_enter`/`io_uring_register` syscalls (the latter three because `IORING_OP_SOCKET` on Linux 5.19+ would otherwise bypass the `socket()` rule). It does not prevent operations on Unix socket file descriptors inherited from parent processes or passed via `SCM_RIGHTS`. For most sandboxing scenarios, blocking socket creation is sufficient to prevent unauthorized IPC.
628
653
 
629
654
  **Zero runtime dependencies**: Pre-built static apply-seccomp binaries and pre-generated BPF filters are included for x64 and arm64 architectures. No compilation tools or external dependencies required at runtime.
630
655
 
@@ -1,6 +1,6 @@
1
1
  import type { Socket, Server } from 'node:net';
2
2
  import type { Duplex } from 'node:stream';
3
- import { URL } from 'node:url';
3
+ import type { ResolvedParentProxy } from './parent-proxy.js';
4
4
  export interface HttpProxyServerOptions {
5
5
  filter(port: number, host: string, socket: Socket | Duplex): Promise<boolean> | boolean;
6
6
  /**
@@ -10,10 +10,11 @@ export interface HttpProxyServerOptions {
10
10
  */
11
11
  getMitmSocketPath?(host: string): string | undefined;
12
12
  /**
13
- * Optional upstream HTTP proxy to chain through for all outbound connections.
14
- * When set, traffic is forwarded through this proxy instead of connecting directly.
13
+ * Optional upstream HTTP proxy. When present, direct-connect traffic (i.e.
14
+ * not routed via mitmProxy) is tunnelled through this parent instead of
15
+ * connecting directly. NO_PROXY-matched hosts still connect directly.
15
16
  */
16
- upstreamHttpProxy?: URL;
17
+ parentProxy?: ResolvedParentProxy;
17
18
  }
18
19
  export declare function createHttpProxyServer(options: HttpProxyServerOptions): Server;
19
20
  //# sourceMappingURL=http-proxy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-proxy.d.ts","sourceRoot":"","sources":["../../src/sandbox/http-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAKzC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAG9B,MAAM,WAAW,sBAAsB;IACrC,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAE7B;;;;OAIG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAEpD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,GAAG,CAAA;CACxB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAqW7E"}
1
+ {"version":3,"file":"http-proxy.d.ts","sourceRoot":"","sources":["../../src/sandbox/http-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAOzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAY5D,MAAM,WAAW,sBAAsB;IACrC,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GAAG,MAAM,GACtB,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAA;IAE7B;;;;OAIG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAEpD;;;;OAIG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CA8O7E"}
@@ -4,24 +4,30 @@ import { request as httpsRequest } from 'node:https';
4
4
  import { connect } from 'node:net';
5
5
  import { URL } from 'node:url';
6
6
  import { logForDebugging } from '../utils/debug.js';
7
+ import { connectViaParentProxy, dialDirect, openConnectTunnel, proxyAuthHeader, selectParentProxyUrl, shouldBypassParentProxy, stripBrackets, stripHopByHop, } from './parent-proxy.js';
7
8
  export function createHttpProxyServer(options) {
8
9
  const server = createServer();
9
10
  // Handle CONNECT requests for HTTPS traffic
10
- server.on('connect', async (req, socket) => {
11
+ server.on('connect', async (req, socket, head) => {
11
12
  // Attach error handler immediately to prevent unhandled errors
12
13
  socket.on('error', err => {
13
14
  logForDebugging(`Client socket error: ${err.message}`, { level: 'error' });
14
15
  });
16
+ // Track client liveness so we can abort the upstream dial if they bail.
17
+ let clientGone = false;
18
+ socket.once('close', () => {
19
+ clientGone = true;
20
+ });
15
21
  try {
16
- const [hostname, portStr] = req.url.split(':');
17
- const port = portStr === undefined ? undefined : parseInt(portStr, 10);
18
- if (!hostname || !port) {
22
+ const target = parseConnectTarget(req.url);
23
+ if (!target) {
19
24
  logForDebugging(`Invalid CONNECT request: ${req.url}`, {
20
25
  level: 'error',
21
26
  });
22
27
  socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
23
28
  return;
24
29
  }
30
+ const { hostname, port } = target;
25
31
  const allowed = await options.filter(port, hostname, socket);
26
32
  if (!allowed) {
27
33
  logForDebugging(`Connection blocked to ${hostname}:${port}`, {
@@ -34,135 +40,58 @@ export function createHttpProxyServer(options) {
34
40
  'Connection blocked by network allowlist');
35
41
  return;
36
42
  }
37
- // Check if this host should be routed through a MITM proxy
43
+ // Decide upstream route: MITM unix socket > parent HTTP proxy > direct.
38
44
  const mitmSocketPath = options.getMitmSocketPath?.(hostname);
39
- if (mitmSocketPath) {
40
- // Route through MITM proxy via Unix socket
41
- logForDebugging(`Routing CONNECT ${hostname}:${port} through MITM proxy at ${mitmSocketPath}`);
42
- const mitmSocket = connect({ path: mitmSocketPath }, () => {
43
- // Send CONNECT request to the MITM proxy
44
- mitmSocket.write(`CONNECT ${hostname}:${port} HTTP/1.1\r\n` +
45
- `Host: ${hostname}:${port}\r\n` +
46
- '\r\n');
47
- });
48
- // Buffer to accumulate the MITM proxy's response
49
- let responseBuffer = '';
50
- const onMitmData = (chunk) => {
51
- responseBuffer += chunk.toString();
52
- // Check if we've received the full HTTP response headers
53
- const headerEndIndex = responseBuffer.indexOf('\r\n\r\n');
54
- if (headerEndIndex !== -1) {
55
- // Remove data listener, we're done parsing the response
56
- mitmSocket.removeListener('data', onMitmData);
57
- // Check if MITM proxy accepted the connection
58
- const statusLine = responseBuffer.substring(0, responseBuffer.indexOf('\r\n'));
59
- if (statusLine.includes(' 200 ')) {
60
- // Connection established, now pipe data between client and MITM
61
- socket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
62
- // If there's any data after the headers, write it to the client
63
- const remainingData = responseBuffer.substring(headerEndIndex + 4);
64
- if (remainingData.length > 0) {
65
- socket.write(remainingData);
66
- }
67
- mitmSocket.pipe(socket);
68
- socket.pipe(mitmSocket);
69
- }
70
- else {
71
- logForDebugging(`MITM proxy rejected CONNECT: ${statusLine}`, {
72
- level: 'error',
73
- });
74
- socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
75
- mitmSocket.destroy();
76
- }
77
- }
78
- };
79
- mitmSocket.on('data', onMitmData);
80
- mitmSocket.on('error', err => {
81
- logForDebugging(`MITM proxy connection failed: ${err.message}`, {
82
- level: 'error',
83
- });
84
- socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
85
- });
86
- socket.on('error', err => {
87
- logForDebugging(`Client socket error: ${err.message}`, {
88
- level: 'error',
45
+ const parentUrl = !mitmSocketPath &&
46
+ options.parentProxy &&
47
+ !shouldBypassParentProxy(options.parentProxy, hostname)
48
+ ? selectParentProxyUrl(options.parentProxy, { isHttps: true })
49
+ : undefined;
50
+ let upstream;
51
+ try {
52
+ if (mitmSocketPath) {
53
+ logForDebugging(`Routing CONNECT ${hostname}:${port} through MITM proxy at ${mitmSocketPath}`);
54
+ upstream = await openConnectTunnel({
55
+ dial: () => connect({ path: mitmSocketPath }),
56
+ readyEvent: 'connect',
57
+ destHost: hostname,
58
+ destPort: port,
89
59
  });
90
- mitmSocket.destroy();
91
- });
92
- socket.on('end', () => mitmSocket.end());
93
- mitmSocket.on('end', () => socket.end());
60
+ }
61
+ else if (parentUrl) {
62
+ upstream = await connectViaParentProxy(parentUrl, hostname, port);
63
+ }
64
+ else {
65
+ upstream = await dialDirect(hostname, port);
66
+ }
94
67
  }
95
- else if (options.upstreamHttpProxy) {
96
- // Chain through upstream HTTP proxy via CONNECT
97
- const upstream = options.upstreamHttpProxy;
98
- const upstreamPort = parseInt(upstream.port) || 3128;
99
- logForDebugging(`Routing CONNECT ${hostname}:${port} through upstream proxy at ${upstream.hostname}:${upstreamPort}`);
100
- const upstreamSocket = connect(upstreamPort, upstream.hostname, () => {
101
- upstreamSocket.write(`CONNECT ${hostname}:${port} HTTP/1.1\r\n` +
102
- `Host: ${hostname}:${port}\r\n` +
103
- '\r\n');
104
- });
105
- let responseBuffer = '';
106
- const onUpstreamData = (chunk) => {
107
- responseBuffer += chunk.toString();
108
- const headerEndIndex = responseBuffer.indexOf('\r\n\r\n');
109
- if (headerEndIndex !== -1) {
110
- upstreamSocket.removeListener('data', onUpstreamData);
111
- const statusLine = responseBuffer.substring(0, responseBuffer.indexOf('\r\n'));
112
- if (statusLine.includes(' 200 ')) {
113
- socket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
114
- const remainingData = responseBuffer.substring(headerEndIndex + 4);
115
- if (remainingData.length > 0) {
116
- socket.write(remainingData);
117
- }
118
- upstreamSocket.pipe(socket);
119
- socket.pipe(upstreamSocket);
120
- }
121
- else {
122
- logForDebugging(`Upstream proxy rejected CONNECT: ${statusLine}`, { level: 'error' });
123
- socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
124
- upstreamSocket.destroy();
125
- }
126
- }
127
- };
128
- upstreamSocket.on('data', onUpstreamData);
129
- upstreamSocket.on('error', err => {
130
- logForDebugging(`Upstream proxy connection failed: ${err.message}`, {
131
- level: 'error',
132
- });
133
- socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
134
- });
135
- socket.on('error', err => {
136
- logForDebugging(`Client socket error: ${err.message}`, {
137
- level: 'error',
138
- });
139
- upstreamSocket.destroy();
68
+ catch (err) {
69
+ logForDebugging(`CONNECT tunnel failed: ${err.message}`, {
70
+ level: 'error',
140
71
  });
141
- socket.on('end', () => upstreamSocket.end());
142
- upstreamSocket.on('end', () => socket.end());
72
+ socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
73
+ return;
143
74
  }
144
- else {
145
- // Direct connection (original behavior)
146
- const serverSocket = connect(port, hostname, () => {
147
- socket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
148
- serverSocket.pipe(socket);
149
- socket.pipe(serverSocket);
150
- });
151
- serverSocket.on('error', err => {
152
- logForDebugging(`CONNECT tunnel failed: ${err.message}`, {
153
- level: 'error',
154
- });
155
- socket.end('HTTP/1.1 502 Bad Gateway\r\n\r\n');
156
- });
157
- socket.on('error', err => {
158
- logForDebugging(`Client socket error: ${err.message}`, {
159
- level: 'error',
160
- });
161
- serverSocket.destroy();
162
- });
163
- socket.on('end', () => serverSocket.end());
164
- serverSocket.on('end', () => socket.end());
75
+ if (clientGone) {
76
+ upstream.on('error', () => { }); // swallow post-resolve errors
77
+ upstream.destroy();
78
+ return;
165
79
  }
80
+ socket.write('HTTP/1.1 200 Connection Established\r\n\r\n');
81
+ // Forward any bytes the client sent in the same packet as the CONNECT
82
+ // (Node delivers these as the `head` buffer, not via the socket stream).
83
+ if (head.length)
84
+ upstream.write(head);
85
+ upstream.pipe(socket);
86
+ socket.pipe(upstream);
87
+ upstream.on('error', err => {
88
+ logForDebugging(`CONNECT tunnel failed: ${err.message}`, {
89
+ level: 'error',
90
+ });
91
+ socket.destroy();
92
+ });
93
+ socket.on('close', () => upstream.destroy());
94
+ upstream.on('close', () => socket.destroy());
166
95
  }
167
96
  catch (err) {
168
97
  logForDebugging(`Error handling CONNECT: ${err}`, { level: 'error' });
@@ -173,7 +102,7 @@ export function createHttpProxyServer(options) {
173
102
  server.on('request', async (req, res) => {
174
103
  try {
175
104
  const url = new URL(req.url);
176
- const hostname = url.hostname;
105
+ const hostname = stripBrackets(url.hostname);
177
106
  const port = url.port
178
107
  ? parseInt(url.port, 10)
179
108
  : url.protocol === 'https:'
@@ -191,105 +120,113 @@ export function createHttpProxyServer(options) {
191
120
  res.end('Connection blocked by network allowlist');
192
121
  return;
193
122
  }
194
- // Check if this host should be routed through a MITM proxy
123
+ // Client may have disconnected while we awaited the filter; bail now
124
+ // rather than dialing an upstream nobody will read from.
125
+ if (req.socket.destroyed)
126
+ return;
127
+ const fwdHeaders = { ...stripHopByHop(req.headers), host: url.host };
128
+ // Decide upstream route: MITM unix socket > parent HTTP proxy > direct.
195
129
  const mitmSocketPath = options.getMitmSocketPath?.(hostname);
130
+ const parentUrl = !mitmSocketPath &&
131
+ options.parentProxy &&
132
+ !shouldBypassParentProxy(options.parentProxy, hostname)
133
+ ? selectParentProxyUrl(options.parentProxy, {
134
+ isHttps: url.protocol === 'https:',
135
+ })
136
+ : undefined;
137
+ // Reconstruct the absolute URI from parsed components rather than
138
+ // forwarding the client's raw req.url. This ensures the upstream proxy
139
+ // sees exactly the host we allowlist-checked, closing URL-parser
140
+ // differential bypasses.
141
+ const absUrl = `${url.protocol}//${url.host}${url.pathname}${url.search}`;
142
+ let proxyReq;
196
143
  if (mitmSocketPath) {
197
- // Route through MITM proxy via Unix socket
198
- // Use an agent that connects via the Unix socket
199
144
  logForDebugging(`Routing HTTP ${req.method} ${hostname}:${port} through MITM proxy at ${mitmSocketPath}`);
200
145
  const mitmAgent = new Agent({
201
146
  // @ts-expect-error - socketPath is valid but not in types
202
147
  socketPath: mitmSocketPath,
203
148
  });
204
- // Send request to MITM proxy with full URL (proxy-style request)
205
- const proxyReq = httpRequest({
149
+ proxyReq = httpRequest({
206
150
  agent: mitmAgent,
207
- // For proxy requests, path should be the full URL
208
- path: req.url,
151
+ path: absUrl,
209
152
  method: req.method,
210
- headers: {
211
- ...req.headers,
212
- host: url.host,
213
- },
153
+ headers: fwdHeaders,
214
154
  }, proxyRes => {
215
- res.writeHead(proxyRes.statusCode, proxyRes.headers);
155
+ res.writeHead(proxyRes.statusCode, stripHopByHop(proxyRes.headers));
216
156
  proxyRes.pipe(res);
217
157
  });
218
- proxyReq.on('error', err => {
219
- logForDebugging(`MITM proxy request failed: ${err.message}`, {
220
- level: 'error',
221
- });
222
- if (!res.headersSent) {
223
- res.writeHead(502, { 'Content-Type': 'text/plain' });
224
- res.end('Bad Gateway');
225
- }
226
- });
227
- req.pipe(proxyReq);
228
158
  }
229
- else if (options.upstreamHttpProxy) {
230
- // Forward through upstream HTTP proxy
231
- const upstream = options.upstreamHttpProxy;
232
- const upstreamPort = parseInt(upstream.port) || 3128;
233
- logForDebugging(`Routing HTTP ${req.method} ${hostname}:${port} through upstream proxy at ${upstream.hostname}:${upstreamPort}`);
234
- const proxyReq = httpRequest({
235
- hostname: upstream.hostname,
236
- port: upstreamPort,
237
- path: req.url,
159
+ else if (parentUrl) {
160
+ const parentHost = stripBrackets(parentUrl.hostname);
161
+ const parentPort = Number(parentUrl.port) || (parentUrl.protocol === 'https:' ? 443 : 80);
162
+ const auth = proxyAuthHeader(parentUrl);
163
+ const requestFn = parentUrl.protocol === 'https:' ? httpsRequest : httpRequest;
164
+ proxyReq = requestFn({
165
+ hostname: parentHost,
166
+ port: parentPort,
167
+ path: absUrl,
238
168
  method: req.method,
239
- headers: {
240
- ...req.headers,
241
- host: url.host,
242
- },
169
+ headers: auth
170
+ ? { ...fwdHeaders, 'proxy-authorization': auth }
171
+ : fwdHeaders,
243
172
  }, proxyRes => {
244
- res.writeHead(proxyRes.statusCode, proxyRes.headers);
173
+ res.writeHead(proxyRes.statusCode, stripHopByHop(proxyRes.headers));
245
174
  proxyRes.pipe(res);
246
175
  });
247
- proxyReq.on('error', err => {
248
- logForDebugging(`Upstream proxy request failed: ${err.message}`, {
249
- level: 'error',
250
- });
251
- if (!res.headersSent) {
252
- res.writeHead(502, { 'Content-Type': 'text/plain' });
253
- res.end('Bad Gateway');
254
- }
255
- });
256
- req.pipe(proxyReq);
257
176
  }
258
177
  else {
259
- // Direct request (original behavior)
260
- // Choose http or https module
261
178
  const requestFn = url.protocol === 'https:' ? httpsRequest : httpRequest;
262
- const proxyReq = requestFn({
179
+ proxyReq = requestFn({
263
180
  hostname,
264
181
  port,
265
182
  path: url.pathname + url.search,
266
183
  method: req.method,
267
- headers: {
268
- ...req.headers,
269
- host: url.host,
270
- },
184
+ headers: fwdHeaders,
271
185
  }, proxyRes => {
272
- res.writeHead(proxyRes.statusCode, proxyRes.headers);
186
+ res.writeHead(proxyRes.statusCode, stripHopByHop(proxyRes.headers));
273
187
  proxyRes.pipe(res);
274
188
  });
275
- proxyReq.on('error', err => {
276
- logForDebugging(`Proxy request failed: ${err.message}`, {
277
- level: 'error',
278
- });
279
- if (!res.headersSent) {
280
- res.writeHead(502, { 'Content-Type': 'text/plain' });
281
- res.end('Bad Gateway');
282
- }
283
- });
284
- req.pipe(proxyReq);
285
189
  }
190
+ proxyReq.on('error', err => {
191
+ logForDebugging(`Proxy request failed: ${err.message}`, {
192
+ level: 'error',
193
+ });
194
+ if (!res.headersSent) {
195
+ res.writeHead(502, { 'Content-Type': 'text/plain' });
196
+ res.end('Bad Gateway');
197
+ }
198
+ else {
199
+ res.destroy();
200
+ }
201
+ });
202
+ // Tear down the upstream request if the client goes away mid-flight.
203
+ res.on('close', () => proxyReq.destroy());
204
+ req.pipe(proxyReq);
286
205
  }
287
206
  catch (err) {
288
207
  logForDebugging(`Error handling HTTP request: ${err}`, { level: 'error' });
289
- res.writeHead(500, { 'Content-Type': 'text/plain' });
290
- res.end('Internal Server Error');
208
+ if (!res.headersSent) {
209
+ res.writeHead(500, { 'Content-Type': 'text/plain' });
210
+ res.end('Internal Server Error');
211
+ }
212
+ else {
213
+ res.destroy();
214
+ }
291
215
  }
292
216
  });
293
217
  return server;
294
218
  }
219
+ /**
220
+ * Parse a CONNECT request-target into host + port. Handles both plain
221
+ * `host:port` and bracketed IPv6 `[::1]:port`.
222
+ */
223
+ function parseConnectTarget(target) {
224
+ const m = /^\[([^\]]+)\]:(\d+)$/.exec(target) ?? /^([^:]+):(\d+)$/.exec(target);
225
+ if (!m)
226
+ return undefined;
227
+ const port = Number(m[2]);
228
+ if (!Number.isInteger(port) || port < 1 || port > 65535)
229
+ return undefined;
230
+ return { hostname: m[1], port };
231
+ }
295
232
  //# sourceMappingURL=http-proxy.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-proxy.js","sourceRoot":"","sources":["../../src/sandbox/http-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAuBnD,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,MAAM,MAAM,GAAG,YAAY,EAAE,CAAA;IAE7B,4CAA4C;IAC5C,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QACzC,+DAA+D;QAC/D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;YACvB,eAAe,CAAC,wBAAwB,GAAG,CAAC,OAAO,EA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