@sysid/sandbox-runtime-improved 0.0.43-sysid.4 → 0.0.43-sysid.6

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.
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Parent/upstream HTTP proxy support.
3
+ *
4
+ * When SRT runs in an environment that requires an HTTP proxy for outbound
5
+ * internet access (e.g. inside a VM on a host behind a corporate proxy),
6
+ * SRT's own proxies must chain through that upstream rather than connecting
7
+ * directly.
8
+ *
9
+ * This module provides:
10
+ * - config resolution (explicit config -> HTTP_PROXY/HTTPS_PROXY/NO_PROXY env)
11
+ * - NO_PROXY matching (hostname suffix + CIDR via net.BlockList). Follows
12
+ * golang.org/x/net/http/httpproxy semantics for suffix matching. Note:
13
+ * port-specific NO_PROXY entries (e.g. `host:8080`) are matched by host
14
+ * only; the port is ignored.
15
+ * - a generic CONNECT-tunnel helper that works over Unix socket, TCP, or TLS
16
+ */
17
+ import { BlockList, connect as netConnect, isIP } from 'node:net';
18
+ import { connect as tlsConnect } from 'node:tls';
19
+ import { URL } from 'node:url';
20
+ import { logForDebugging } from '../utils/debug.js';
21
+ const CONNECT_TIMEOUT_MS = 30000;
22
+ /**
23
+ * Hop-by-hop headers per RFC 7230 §6.1, plus proxy-specific headers that
24
+ * MUST NOT be forwarded to the upstream. `transfer-encoding` is included
25
+ * because we re-frame bodies via Node's client; Content-Length is preserved
26
+ * end-to-end (Node's llhttp already rejects the TE+CL smuggling vector).
27
+ */
28
+ const HOP_BY_HOP = new Set([
29
+ 'connection',
30
+ 'keep-alive',
31
+ 'proxy-authenticate',
32
+ 'proxy-authorization',
33
+ 'proxy-connection',
34
+ 'te',
35
+ 'trailer',
36
+ 'transfer-encoding',
37
+ 'upgrade',
38
+ ]);
39
+ /**
40
+ * Resolve the parent proxy config, falling back to the SRT process's own
41
+ * environment. Note: SRT later overwrites HTTP_PROXY etc. in the *sandboxed
42
+ * child's* environment to point at itself — but process.env here reflects the
43
+ * environment SRT itself was launched with, which is what we want.
44
+ */
45
+ export function resolveParentProxy(cfg) {
46
+ const http = cfg?.http ?? process.env.HTTP_PROXY ?? process.env.http_proxy ?? undefined;
47
+ const https = cfg?.https ??
48
+ process.env.HTTPS_PROXY ??
49
+ process.env.https_proxy ??
50
+ // Fall back to HTTP_PROXY for HTTPS if HTTPS_PROXY is unset — this is
51
+ // the de-facto behaviour of curl and most tooling.
52
+ http;
53
+ const noProxyRaw = cfg?.noProxy ?? process.env.NO_PROXY ?? process.env.no_proxy ?? '';
54
+ if (!http && !https)
55
+ return undefined;
56
+ const parse = (u) => {
57
+ if (!u)
58
+ return undefined;
59
+ // Accept schemeless `host:port` like curl does, but reject any scheme
60
+ // other than http/https.
61
+ const hasScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(u);
62
+ const withScheme = hasScheme ? u : `http://${u}`;
63
+ try {
64
+ const parsed = new URL(withScheme);
65
+ if ((parsed.protocol !== 'http:' && parsed.protocol !== 'https:') ||
66
+ !parsed.hostname) {
67
+ throw new Error('unsupported scheme or empty host');
68
+ }
69
+ return parsed;
70
+ }
71
+ catch {
72
+ logForDebugging(`Invalid parent proxy URL, ignoring: ${redactUserinfo(u)}`, { level: 'error' });
73
+ return undefined;
74
+ }
75
+ };
76
+ const httpUrl = parse(http);
77
+ const httpsUrl = parse(https);
78
+ // If both parsed to undefined, behave as if no parent proxy was configured
79
+ // rather than returning a husk object that makes callers do bypass checks
80
+ // for nothing.
81
+ if (!httpUrl && !httpsUrl)
82
+ return undefined;
83
+ return { httpUrl, httpsUrl, noProxy: parseNoProxy(noProxyRaw) };
84
+ }
85
+ function parseNoProxy(raw) {
86
+ const rules = {
87
+ all: false,
88
+ suffixes: [],
89
+ cidr: new BlockList(),
90
+ };
91
+ for (let entry of raw.split(',')) {
92
+ entry = entry.trim();
93
+ if (!entry)
94
+ continue;
95
+ if (entry === '*') {
96
+ rules.all = true;
97
+ continue;
98
+ }
99
+ // CIDR?
100
+ const slash = entry.indexOf('/');
101
+ if (slash !== -1) {
102
+ const ip = entry.slice(0, slash);
103
+ const prefixStr = entry.slice(slash + 1);
104
+ const fam = isIP(ip);
105
+ if (fam && prefixStr !== '' && /^\d+$/.test(prefixStr)) {
106
+ const prefix = Number(prefixStr);
107
+ const max = fam === 6 ? 128 : 32;
108
+ if (prefix >= 0 && prefix <= max) {
109
+ try {
110
+ rules.cidr.addSubnet(ip, prefix, fam === 6 ? 'ipv6' : 'ipv4');
111
+ }
112
+ catch {
113
+ // BlockList rejected it — ignore this entry.
114
+ }
115
+ continue;
116
+ }
117
+ }
118
+ // malformed CIDR → ignore (do NOT treat as suffix; `/` isn't a valid
119
+ // hostname char)
120
+ continue;
121
+ }
122
+ // Hostname suffix. Normalise: lowercase, strip brackets (handling the
123
+ // `[v6]:port` form), strip leading `*.`, strip a trailing `:port` (unless
124
+ // the entry is an IP literal — IPv6 addresses contain colons).
125
+ let v = entry.toLowerCase();
126
+ const bracketed = /^\[([^\]]+)\](?::\d+)?$/.exec(v);
127
+ if (bracketed)
128
+ v = bracketed[1];
129
+ if (v.startsWith('*.'))
130
+ v = v.slice(1);
131
+ const bareFam = isIP(v);
132
+ if (!bareFam) {
133
+ const colon = v.lastIndexOf(':');
134
+ if (colon !== -1 && /^\d+$/.test(v.slice(colon + 1))) {
135
+ v = v.slice(0, colon);
136
+ }
137
+ }
138
+ else {
139
+ // Bare IP literal — store as an exact-match /32 or /128 CIDR so that
140
+ // lookups go through BlockList rather than string suffix matching.
141
+ try {
142
+ rules.cidr.addAddress(v, bareFam === 6 ? 'ipv6' : 'ipv4');
143
+ continue;
144
+ }
145
+ catch {
146
+ // fall through to suffix push
147
+ }
148
+ }
149
+ rules.suffixes.push(v);
150
+ }
151
+ return rules;
152
+ }
153
+ /**
154
+ * Returns true if the given host should bypass the parent proxy and connect
155
+ * directly. Always bypasses loopback.
156
+ *
157
+ * NB: the port is not consulted. NO_PROXY entries of the form `host:port` are
158
+ * matched by host only (the port suffix is stripped during parsing).
159
+ */
160
+ export function shouldBypassParentProxy(resolved, host) {
161
+ const h = stripBrackets(host.toLowerCase().replace(/\.$/, ''));
162
+ // Always bypass loopback — chaining localhost through an upstream proxy is
163
+ // never what you want. Covers the whole 127/8 block and IPv4-mapped forms.
164
+ if (h === 'localhost')
165
+ return true;
166
+ const fam = isIP(h);
167
+ if (fam) {
168
+ if (LOOPBACK.check(h, fam === 6 ? 'ipv6' : 'ipv4'))
169
+ return true;
170
+ }
171
+ if (resolved.noProxy.all)
172
+ return true;
173
+ if (fam) {
174
+ if (resolved.noProxy.cidr.check(h, fam === 6 ? 'ipv6' : 'ipv4'))
175
+ return true;
176
+ }
177
+ for (const v of resolved.noProxy.suffixes) {
178
+ if (v.startsWith('.')) {
179
+ // .example.com matches foo.example.com and example.com
180
+ if (h === v.slice(1) || h.endsWith(v))
181
+ return true;
182
+ }
183
+ else {
184
+ // example.com matches example.com and foo.example.com (golang semantics)
185
+ if (h === v || h.endsWith('.' + v))
186
+ return true;
187
+ }
188
+ }
189
+ return false;
190
+ }
191
+ const LOOPBACK = (() => {
192
+ const bl = new BlockList();
193
+ bl.addSubnet('127.0.0.0', 8, 'ipv4');
194
+ bl.addAddress('::1', 'ipv6');
195
+ bl.addSubnet('::ffff:127.0.0.0', 104, 'ipv6'); // v4-mapped loopback
196
+ return bl;
197
+ })();
198
+ /**
199
+ * Pick which parent proxy URL to use for a given destination.
200
+ */
201
+ export function selectParentProxyUrl(resolved, opts) {
202
+ if (opts.isHttps)
203
+ return resolved.httpsUrl ?? resolved.httpUrl;
204
+ // For plain HTTP we only fall back to HTTPS_PROXY if it was explicitly set
205
+ // — matches curl's behaviour where HTTP requests go direct if only
206
+ // HTTPS_PROXY is configured.
207
+ return resolved.httpUrl;
208
+ }
209
+ /**
210
+ * Generic CONNECT-tunnel: dial a proxy transport (unix/tcp/tls), send
211
+ * `CONNECT host:port`, wait for a 2xx, and resolve with the tunnelled socket.
212
+ * Validates destHost to prevent CRLF injection from untrusted callers.
213
+ */
214
+ export function openConnectTunnel(opts) {
215
+ const { destHost, destPort } = opts;
216
+ // CRLF-injection guard: destHost may originate from an untrusted SOCKS5
217
+ // DOMAINNAME field. Reject anything that isn't a plain hostname or IP.
218
+ const bare = stripBrackets(destHost);
219
+ if (!isValidHost(bare)) {
220
+ return Promise.reject(new Error(`Invalid destination host for CONNECT: ${JSON.stringify(destHost)}`));
221
+ }
222
+ if (!Number.isInteger(destPort) || destPort < 1 || destPort > 65535) {
223
+ return Promise.reject(new Error(`Invalid destination port: ${destPort}`));
224
+ }
225
+ const authority = isIP(bare) === 6 ? `[${bare}]:${destPort}` : `${bare}:${destPort}`;
226
+ return new Promise((resolve, reject) => {
227
+ const sock = opts.dial();
228
+ let settled = false;
229
+ const fail = (err) => {
230
+ if (settled)
231
+ return;
232
+ settled = true;
233
+ sock.destroy();
234
+ reject(err);
235
+ };
236
+ const onClose = () => fail(new Error('Proxy closed during CONNECT handshake'));
237
+ sock.setTimeout(opts.timeoutMs ?? CONNECT_TIMEOUT_MS, () => fail(new Error('CONNECT handshake timed out')));
238
+ sock.once('error', fail);
239
+ sock.once('close', onClose);
240
+ sock.once(opts.readyEvent, () => {
241
+ sock.write(`CONNECT ${authority} HTTP/1.1\r\n` +
242
+ `Host: ${authority}\r\n` +
243
+ (opts.authHeader
244
+ ? `Proxy-Authorization: ${opts.authHeader}\r\n`
245
+ : '') +
246
+ '\r\n');
247
+ let buf = '';
248
+ const onData = (chunk) => {
249
+ buf += chunk.toString('latin1');
250
+ const end = buf.indexOf('\r\n\r\n');
251
+ if (end === -1) {
252
+ // Cap header size to avoid unbounded buffering on a misbehaving proxy.
253
+ if (buf.length > 16 * 1024)
254
+ fail(new Error('CONNECT response header too large'));
255
+ return;
256
+ }
257
+ // Pause before detaching the data listener so the stream stops
258
+ // flowing — otherwise the unshift below (or any bytes arriving
259
+ // between now and the caller's pipe()) would be dropped.
260
+ sock.pause();
261
+ sock.removeListener('data', onData);
262
+ const statusLine = buf.slice(0, buf.indexOf('\r\n'));
263
+ if (!/^HTTP\/1\.[01] 2\d\d(?:\s|$)/.test(statusLine)) {
264
+ return fail(new Error(`Proxy refused CONNECT: ${statusLine.trim()}`));
265
+ }
266
+ // Re-emit any bytes that arrived after the header terminator.
267
+ const rest = buf.slice(end + 4);
268
+ if (rest.length)
269
+ sock.unshift(Buffer.from(rest, 'latin1'));
270
+ settled = true;
271
+ sock.setTimeout(0);
272
+ sock.removeListener('error', fail);
273
+ sock.removeListener('close', onClose);
274
+ resolve(sock);
275
+ };
276
+ sock.on('data', onData);
277
+ });
278
+ });
279
+ }
280
+ /**
281
+ * Open a CONNECT tunnel through a parent HTTP(S) proxy specified by URL.
282
+ * Thin wrapper around openConnectTunnel that dials TCP or TLS based on the
283
+ * proxy URL scheme.
284
+ */
285
+ export function connectViaParentProxy(proxyUrl, destHost, destPort) {
286
+ const proxyHost = stripBrackets(proxyUrl.hostname);
287
+ const proxyPort = Number(proxyUrl.port) || (proxyUrl.protocol === 'https:' ? 443 : 80);
288
+ const useTls = proxyUrl.protocol === 'https:';
289
+ return openConnectTunnel({
290
+ destHost,
291
+ destPort,
292
+ authHeader: proxyAuthHeader(proxyUrl),
293
+ readyEvent: useTls ? 'secureConnect' : 'connect',
294
+ dial: () => useTls
295
+ ? tlsConnect({
296
+ host: proxyHost,
297
+ port: proxyPort,
298
+ // SNI must be a hostname, never an IP literal (RFC 6066 §3).
299
+ ...(isIP(proxyHost) ? {} : { servername: proxyHost }),
300
+ })
301
+ : netConnect(proxyPort, proxyHost),
302
+ });
303
+ }
304
+ // ---------------------------------------------------------------------------
305
+ // Utilities
306
+ // ---------------------------------------------------------------------------
307
+ export function proxyAuthHeader(proxyUrl) {
308
+ if (!proxyUrl.username && !proxyUrl.password)
309
+ return undefined;
310
+ try {
311
+ const creds = `${decodeURIComponent(proxyUrl.username)}:${decodeURIComponent(proxyUrl.password)}`;
312
+ return `Basic ${Buffer.from(creds).toString('base64')}`;
313
+ }
314
+ catch {
315
+ // Malformed percent-encoding in userinfo — fall back to raw values
316
+ // rather than throwing synchronously into the caller.
317
+ const creds = `${proxyUrl.username}:${proxyUrl.password}`;
318
+ return `Basic ${Buffer.from(creds).toString('base64')}`;
319
+ }
320
+ }
321
+ /**
322
+ * Strip hop-by-hop and proxy-specific headers before forwarding upstream.
323
+ * Also strips any headers named in the incoming `Connection` header, per
324
+ * RFC 7230 §6.1.
325
+ */
326
+ export function stripHopByHop(h) {
327
+ const extra = new Set();
328
+ const connHeader = h.connection;
329
+ if (connHeader) {
330
+ for (const tok of String(connHeader).split(',')) {
331
+ extra.add(tok.trim().toLowerCase());
332
+ }
333
+ }
334
+ const out = {};
335
+ for (const [k, v] of Object.entries(h)) {
336
+ const lk = k.toLowerCase();
337
+ if (!HOP_BY_HOP.has(lk) && !extra.has(lk))
338
+ out[k] = v;
339
+ }
340
+ return out;
341
+ }
342
+ /** Remove surrounding square brackets from an IPv6 literal. */
343
+ export function stripBrackets(host) {
344
+ return host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : host;
345
+ }
346
+ /** Redact userinfo from a URL for safe logging. */
347
+ export function redactUrl(u) {
348
+ if (!u)
349
+ return '-';
350
+ if (!u.username && !u.password)
351
+ return u.href;
352
+ const c = new URL(u.href);
353
+ c.username = '***';
354
+ c.password = '***';
355
+ return c.href;
356
+ }
357
+ function redactUserinfo(raw) {
358
+ // Best-effort redaction for unparseable URLs.
359
+ return raw.replace(/\/\/[^@/]*@/, '//***:***@');
360
+ }
361
+ /**
362
+ * Hostname validation: accepts DNS names and IP literals (without zone IDs).
363
+ * Primary purpose is to block control characters (CRLF injection, null-byte
364
+ * DNS truncation) and zone-identifier allowlist bypasses from reaching the
365
+ * wire or the allowlist matcher.
366
+ *
367
+ * IPv6 zone IDs (`fe80::1%eth0`) are rejected because `isIP` accepts a very
368
+ * permissive zone charset including dots — `::ffff:1.2.3.4%x.allowed.com`
369
+ * would pass `isIP`, pass a `.endsWith('.allowed.com')` wildcard check, and
370
+ * then connect to 1.2.3.4 when the OS discards the bogus scope.
371
+ */
372
+ export function isValidHost(h) {
373
+ if (!h || h.length > 255)
374
+ return false;
375
+ const bare = stripBrackets(h);
376
+ // Reject zone identifiers outright (see doc comment).
377
+ if (bare.includes('%'))
378
+ return false;
379
+ if (isIP(bare))
380
+ return true;
381
+ // DNS label charset. Underscore is permitted for compatibility with real-
382
+ // world DNS records (_dmarc, _acme-challenge, etc.).
383
+ return /^[A-Za-z0-9._-]+$/.test(bare);
384
+ }
385
+ /**
386
+ * Canonicalize a host string via the WHATWG URL parser so that string
387
+ * comparisons in the allowlist agree with what `net.connect()`/`getaddrinfo()`
388
+ * will actually dial. This normalizes:
389
+ * - inet_aton shorthand (`127.1` → `127.0.0.1`, `2130706433` → `127.0.0.1`)
390
+ * - hex/octal octets (`0x7f.0.0.1` → `127.0.0.1`)
391
+ * - IPv6 compression (`0:0:0:0:0:0:0:1` → `::1`)
392
+ * - trailing dots, case, brackets
393
+ *
394
+ * Returns undefined if the input is not a valid URL host.
395
+ */
396
+ export function canonicalizeHost(h) {
397
+ try {
398
+ const bare = stripBrackets(h);
399
+ // WHATWG URL rejects zone IDs and most garbage; it normalizes inet_aton
400
+ // forms and IPv6 compression. It does NOT strip trailing dots or IPv6
401
+ // brackets from the output, so we do that ourselves.
402
+ const bracketed = isIP(bare) === 6 ? `[${bare}]` : bare;
403
+ const out = new URL(`http://${bracketed}/`).hostname;
404
+ return stripBrackets(out).replace(/\.$/, '');
405
+ }
406
+ catch {
407
+ return undefined;
408
+ }
409
+ }
410
+ /**
411
+ * Dial `host:port` directly with a bounded timeout. Shared by the HTTP and
412
+ * SOCKS direct-connect paths so they get the same timeout behaviour as the
413
+ * CONNECT-tunnelled paths.
414
+ */
415
+ export function dialDirect(host, port, timeoutMs = CONNECT_TIMEOUT_MS) {
416
+ return new Promise((resolve, reject) => {
417
+ const s = netConnect(port, host);
418
+ let settled = false;
419
+ const done = (err) => {
420
+ if (settled)
421
+ return;
422
+ settled = true;
423
+ s.setTimeout(0);
424
+ if (err) {
425
+ s.destroy();
426
+ reject(err);
427
+ }
428
+ else {
429
+ resolve(s);
430
+ }
431
+ };
432
+ s.setTimeout(timeoutMs, () => done(new Error('connect timed out')));
433
+ s.once('connect', () => done());
434
+ s.once('error', done);
435
+ s.once('close', () => done(new Error('socket closed before connect')));
436
+ });
437
+ }
438
+ //# sourceMappingURL=parent-proxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parent-proxy.js","sourceRoot":"","sources":["../../src/sandbox/parent-proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,SAAS,EAAE,OAAO,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAenD,MAAM,kBAAkB,GAAG,KAAM,CAAA;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC;IACzB,YAAY;IACZ,YAAY;IACZ,oBAAoB;IACpB,qBAAqB;IACrB,kBAAkB;IAClB,IAAI;IACJ,SAAS;IACT,mBAAmB;IACnB,SAAS;CACV,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAuB;IAEvB,MAAM,IAAI,GACR,GAAG,EAAE,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,SAAS,CAAA;IAC5E,MAAM,KAAK,GACT,GAAG,EAAE,KAAK;QACV,OAAO,CAAC,GAAG,CAAC,WAAW;QACvB,OAAO,CAAC,GAAG,CAAC,WAAW;QACvB,sEAAsE;QACtE,mDAAmD;QACnD,IAAI,CAAA;IACN,MAAM,UAAU,GACd,GAAG,EAAE,OAAO,IAAI,OAA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iBAAM,CAAC;gBACN,OAAO,CAAC,CAAC,CAAC,CAAA;YACZ,CAAC;QACH,CAAC,CAAA;QACD,CAAC,CAAC,UAAU,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAA;QACnE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAA;QAC/B,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACrB,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -17,6 +17,24 @@ declare const MitmProxyConfigSchema: z.ZodObject<{
17
17
  socketPath: string;
18
18
  domains: string[];
19
19
  }>;
20
+ /**
21
+ * Schema for upstream/parent HTTP proxy configuration.
22
+ * Used when SRT itself runs behind a corporate proxy and cannot make direct
23
+ * outbound connections.
24
+ */
25
+ declare const ParentProxyConfigSchema: z.ZodObject<{
26
+ http: z.ZodOptional<z.ZodString>;
27
+ https: z.ZodOptional<z.ZodString>;
28
+ noProxy: z.ZodOptional<z.ZodString>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ http?: string | undefined;
31
+ https?: string | undefined;
32
+ noProxy?: string | undefined;
33
+ }, {
34
+ http?: string | undefined;
35
+ https?: string | undefined;
36
+ noProxy?: string | undefined;
37
+ }>;
20
38
  /**
21
39
  * Network configuration schema for validation
22
40
  */
@@ -38,7 +56,19 @@ export declare const NetworkConfigSchema: z.ZodObject<{
38
56
  socketPath: string;
39
57
  domains: string[];
40
58
  }>>;
41
- upstreamHttpProxy: z.ZodOptional<z.ZodString>;
59
+ parentProxy: z.ZodOptional<z.ZodObject<{
60
+ http: z.ZodOptional<z.ZodString>;
61
+ https: z.ZodOptional<z.ZodString>;
62
+ noProxy: z.ZodOptional<z.ZodString>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ http?: string | undefined;
65
+ https?: string | undefined;
66
+ noProxy?: string | undefined;
67
+ }, {
68
+ http?: string | undefined;
69
+ https?: string | undefined;
70
+ noProxy?: string | undefined;
71
+ }>>;
42
72
  }, "strip", z.ZodTypeAny, {
43
73
  allowedDomains: string[];
44
74
  deniedDomains: string[];
@@ -51,7 +81,11 @@ export declare const NetworkConfigSchema: z.ZodObject<{
51
81
  socketPath: string;
52
82
  domains: string[];
53
83
  } | undefined;
54
- upstreamHttpProxy?: string | undefined;
84
+ parentProxy?: {
85
+ http?: string | undefined;
86
+ https?: string | undefined;
87
+ noProxy?: string | undefined;
88
+ } | undefined;
55
89
  }, {
56
90
  allowedDomains: string[];
57
91
  deniedDomains: string[];
@@ -64,7 +98,11 @@ export declare const NetworkConfigSchema: z.ZodObject<{
64
98
  socketPath: string;
65
99
  domains: string[];
66
100
  } | undefined;
67
- upstreamHttpProxy?: string | undefined;
101
+ parentProxy?: {
102
+ http?: string | undefined;
103
+ https?: string | undefined;
104
+ noProxy?: string | undefined;
105
+ } | undefined;
68
106
  }>;
69
107
  /**
70
108
  * Filesystem configuration schema for validation
@@ -145,7 +183,19 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
145
183
  socketPath: string;
146
184
  domains: string[];
147
185
  }>>;
148
- upstreamHttpProxy: z.ZodOptional<z.ZodString>;
186
+ parentProxy: z.ZodOptional<z.ZodObject<{
187
+ http: z.ZodOptional<z.ZodString>;
188
+ https: z.ZodOptional<z.ZodString>;
189
+ noProxy: z.ZodOptional<z.ZodString>;
190
+ }, "strip", z.ZodTypeAny, {
191
+ http?: string | undefined;
192
+ https?: string | undefined;
193
+ noProxy?: string | undefined;
194
+ }, {
195
+ http?: string | undefined;
196
+ https?: string | undefined;
197
+ noProxy?: string | undefined;
198
+ }>>;
149
199
  }, "strip", z.ZodTypeAny, {
150
200
  allowedDomains: string[];
151
201
  deniedDomains: string[];
@@ -158,7 +208,11 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
158
208
  socketPath: string;
159
209
  domains: string[];
160
210
  } | undefined;
161
- upstreamHttpProxy?: string | undefined;
211
+ parentProxy?: {
212
+ http?: string | undefined;
213
+ https?: string | undefined;
214
+ noProxy?: string | undefined;
215
+ } | undefined;
162
216
  }, {
163
217
  allowedDomains: string[];
164
218
  deniedDomains: string[];
@@ -171,7 +225,11 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
171
225
  socketPath: string;
172
226
  domains: string[];
173
227
  } | undefined;
174
- upstreamHttpProxy?: string | undefined;
228
+ parentProxy?: {
229
+ http?: string | undefined;
230
+ https?: string | undefined;
231
+ noProxy?: string | undefined;
232
+ } | undefined;
175
233
  }>;
176
234
  filesystem: z.ZodObject<{
177
235
  denyRead: z.ZodArray<z.ZodString, "many">;
@@ -211,6 +269,7 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
211
269
  mandatoryDenySearchDepth: z.ZodOptional<z.ZodNumber>;
212
270
  allowPty: z.ZodOptional<z.ZodBoolean>;
213
271
  allowBrowserProcess: z.ZodOptional<z.ZodBoolean>;
272
+ allowMachLookup: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
214
273
  seccomp: z.ZodOptional<z.ZodObject<{
215
274
  bpfPath: z.ZodOptional<z.ZodString>;
216
275
  applyPath: z.ZodOptional<z.ZodString>;
@@ -234,7 +293,11 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
234
293
  socketPath: string;
235
294
  domains: string[];
236
295
  } | undefined;
237
- upstreamHttpProxy?: string | undefined;
296
+ parentProxy?: {
297
+ http?: string | undefined;
298
+ https?: string | undefined;
299
+ noProxy?: string | undefined;
300
+ } | undefined;
238
301
  };
239
302
  filesystem: {
240
303
  denyRead: string[];
@@ -254,6 +317,7 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
254
317
  mandatoryDenySearchDepth?: number | undefined;
255
318
  allowPty?: boolean | undefined;
256
319
  allowBrowserProcess?: boolean | undefined;
320
+ allowMachLookup?: string[] | undefined;
257
321
  seccomp?: {
258
322
  bpfPath?: string | undefined;
259
323
  applyPath?: string | undefined;
@@ -271,7 +335,11 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
271
335
  socketPath: string;
272
336
  domains: string[];
273
337
  } | undefined;
274
- upstreamHttpProxy?: string | undefined;
338
+ parentProxy?: {
339
+ http?: string | undefined;
340
+ https?: string | undefined;
341
+ noProxy?: string | undefined;
342
+ } | undefined;
275
343
  };
276
344
  filesystem: {
277
345
  denyRead: string[];
@@ -291,12 +359,14 @@ export declare const SandboxRuntimeConfigSchema: z.ZodObject<{
291
359
  mandatoryDenySearchDepth?: number | undefined;
292
360
  allowPty?: boolean | undefined;
293
361
  allowBrowserProcess?: boolean | undefined;
362
+ allowMachLookup?: string[] | undefined;
294
363
  seccomp?: {
295
364
  bpfPath?: string | undefined;
296
365
  applyPath?: string | undefined;
297
366
  } | undefined;
298
367
  }>;
299
368
  export type MitmProxyConfig = z.infer<typeof MitmProxyConfigSchema>;
369
+ export type ParentProxyConfig = z.infer<typeof ParentProxyConfigSchema>;
300
370
  export type NetworkConfig = z.infer<typeof NetworkConfigSchema>;
301
371
  export type FilesystemConfig = z.infer<typeof FilesystemConfigSchema>;
302
372
  export type IgnoreViolationsConfig = z.infer<typeof IgnoreViolationsConfigSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-config.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAoDvB;;;GAGG;AACH,QAAA,MAAM,qBAAqB;;;;;;;;;EAQzB,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqD9B,CAAA;AAEF;;GAEG;AACH,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