@sysid/sandbox-runtime-improved 0.0.56-sysid.1 → 0.0.64-sysid.1

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 (129) hide show
  1. package/README.md +106 -4
  2. package/dist/cli.js +12 -18
  3. package/dist/cli.js.map +1 -1
  4. package/dist/index.d.ts +5 -5
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/sandbox/credential-mask-files.d.ts +157 -0
  9. package/dist/sandbox/credential-mask-files.d.ts.map +1 -0
  10. package/dist/sandbox/credential-mask-files.js +298 -0
  11. package/dist/sandbox/credential-mask-files.js.map +1 -0
  12. package/dist/sandbox/credential-sentinel.d.ts +72 -0
  13. package/dist/sandbox/credential-sentinel.d.ts.map +1 -0
  14. package/dist/sandbox/credential-sentinel.js +130 -0
  15. package/dist/sandbox/credential-sentinel.js.map +1 -0
  16. package/dist/sandbox/domain-pattern.d.ts +36 -0
  17. package/dist/sandbox/domain-pattern.d.ts.map +1 -0
  18. package/dist/sandbox/domain-pattern.js +60 -0
  19. package/dist/sandbox/domain-pattern.js.map +1 -0
  20. package/dist/sandbox/http-proxy.d.ts +33 -2
  21. package/dist/sandbox/http-proxy.d.ts.map +1 -1
  22. package/dist/sandbox/http-proxy.js +30 -2
  23. package/dist/sandbox/http-proxy.js.map +1 -1
  24. package/dist/sandbox/linux-sandbox-utils.d.ts +20 -0
  25. package/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -1
  26. package/dist/sandbox/linux-sandbox-utils.js +134 -65
  27. package/dist/sandbox/linux-sandbox-utils.js.map +1 -1
  28. package/dist/sandbox/linux-violation-monitor.d.ts +48 -0
  29. package/dist/sandbox/linux-violation-monitor.d.ts.map +1 -0
  30. package/dist/sandbox/linux-violation-monitor.js +156 -0
  31. package/dist/sandbox/linux-violation-monitor.js.map +1 -0
  32. package/dist/sandbox/listen-in-range.d.ts +12 -0
  33. package/dist/sandbox/listen-in-range.d.ts.map +1 -0
  34. package/dist/sandbox/listen-in-range.js +43 -0
  35. package/dist/sandbox/listen-in-range.js.map +1 -0
  36. package/dist/sandbox/macos-sandbox-utils.d.ts +11 -0
  37. package/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -1
  38. package/dist/sandbox/macos-sandbox-utils.js +72 -17
  39. package/dist/sandbox/macos-sandbox-utils.js.map +1 -1
  40. package/dist/sandbox/mitm-ca.d.ts +69 -2
  41. package/dist/sandbox/mitm-ca.d.ts.map +1 -1
  42. package/dist/sandbox/mitm-ca.js +188 -16
  43. package/dist/sandbox/mitm-ca.js.map +1 -1
  44. package/dist/sandbox/mitm-leaf.d.ts +1 -1
  45. package/dist/sandbox/mitm-leaf.d.ts.map +1 -1
  46. package/dist/sandbox/mitm-leaf.js +26 -19
  47. package/dist/sandbox/mitm-leaf.js.map +1 -1
  48. package/dist/sandbox/mux-proxy.d.ts +59 -0
  49. package/dist/sandbox/mux-proxy.d.ts.map +1 -0
  50. package/dist/sandbox/mux-proxy.js +159 -0
  51. package/dist/sandbox/mux-proxy.js.map +1 -0
  52. package/dist/sandbox/request-filter.d.ts +11 -1
  53. package/dist/sandbox/request-filter.d.ts.map +1 -1
  54. package/dist/sandbox/request-filter.js.map +1 -1
  55. package/dist/sandbox/sandbox-config.d.ts +461 -41
  56. package/dist/sandbox/sandbox-config.d.ts.map +1 -1
  57. package/dist/sandbox/sandbox-config.js +342 -26
  58. package/dist/sandbox/sandbox-config.js.map +1 -1
  59. package/dist/sandbox/sandbox-manager.d.ts +5 -1
  60. package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
  61. package/dist/sandbox/sandbox-manager.js +697 -211
  62. package/dist/sandbox/sandbox-manager.js.map +1 -1
  63. package/dist/sandbox/sandbox-schemas.d.ts +15 -0
  64. package/dist/sandbox/sandbox-schemas.d.ts.map +1 -1
  65. package/dist/sandbox/sandbox-utils.d.ts +55 -6
  66. package/dist/sandbox/sandbox-utils.d.ts.map +1 -1
  67. package/dist/sandbox/sandbox-utils.js +143 -30
  68. package/dist/sandbox/sandbox-utils.js.map +1 -1
  69. package/dist/sandbox/socks-proxy.d.ts +11 -5
  70. package/dist/sandbox/socks-proxy.d.ts.map +1 -1
  71. package/dist/sandbox/socks-proxy.js +13 -81
  72. package/dist/sandbox/socks-proxy.js.map +1 -1
  73. package/dist/sandbox/tls-terminate-proxy.d.ts +2 -2
  74. package/dist/sandbox/tls-terminate-proxy.d.ts.map +1 -1
  75. package/dist/sandbox/tls-terminate-proxy.js +31 -5
  76. package/dist/sandbox/tls-terminate-proxy.js.map +1 -1
  77. package/dist/sandbox/windows-sandbox-utils.d.ts +508 -116
  78. package/dist/sandbox/windows-sandbox-utils.d.ts.map +1 -1
  79. package/dist/sandbox/windows-sandbox-utils.js +721 -209
  80. package/dist/sandbox/windows-sandbox-utils.js.map +1 -1
  81. package/dist/utils/shell-quote.d.ts +27 -0
  82. package/dist/utils/shell-quote.d.ts.map +1 -0
  83. package/dist/utils/shell-quote.js +47 -0
  84. package/dist/utils/shell-quote.js.map +1 -0
  85. package/package.json +7 -6
  86. package/vendor/seccomp/arm64/apply-seccomp +0 -0
  87. package/vendor/seccomp/build.ts +8 -30
  88. package/vendor/seccomp/x64/apply-seccomp +0 -0
  89. package/vendor/srt-win/build.ts +21 -0
  90. package/dist/vendor/seccomp/Dockerfile.build +0 -6
  91. package/dist/vendor/seccomp/arm64/apply-seccomp +0 -0
  92. package/dist/vendor/seccomp/build.ts +0 -91
  93. package/dist/vendor/seccomp/x64/apply-seccomp +0 -0
  94. package/dist/vendor/seccomp-src/apply-seccomp.c +0 -280
  95. package/dist/vendor/seccomp-src/seccomp-unix-block.c +0 -148
  96. package/dist/vendor/srt-win/Cargo.lock +0 -361
  97. package/dist/vendor/srt-win/Cargo.toml +0 -46
  98. package/dist/vendor/srt-win/ci/cleanup.ps1 +0 -49
  99. package/dist/vendor/srt-win/ci/smoke-exec.ps1 +0 -446
  100. package/dist/vendor/srt-win/ci/smoke.ps1 +0 -307
  101. package/dist/vendor/srt-win/src/job.rs +0 -102
  102. package/dist/vendor/srt-win/src/launch.rs +0 -732
  103. package/dist/vendor/srt-win/src/lib.rs +0 -20
  104. package/dist/vendor/srt-win/src/main.rs +0 -669
  105. package/dist/vendor/srt-win/src/self_protect.rs +0 -169
  106. package/dist/vendor/srt-win/src/sid.rs +0 -296
  107. package/dist/vendor/srt-win/src/token.rs +0 -341
  108. package/dist/vendor/srt-win/src/util.rs +0 -42
  109. package/dist/vendor/srt-win/src/wfp.rs +0 -992
  110. package/dist/vendor/srt-win/src/winsta.rs +0 -209
  111. package/dist/vendor/srt-win/tests/sd_access_check_matrix.rs +0 -259
  112. package/vendor/seccomp-src/apply-seccomp.c +0 -280
  113. package/vendor/seccomp-src/seccomp-unix-block.c +0 -148
  114. package/vendor/srt-win/Cargo.lock +0 -361
  115. package/vendor/srt-win/Cargo.toml +0 -46
  116. package/vendor/srt-win/ci/cleanup.ps1 +0 -49
  117. package/vendor/srt-win/ci/smoke-exec.ps1 +0 -446
  118. package/vendor/srt-win/ci/smoke.ps1 +0 -307
  119. package/vendor/srt-win/src/job.rs +0 -102
  120. package/vendor/srt-win/src/launch.rs +0 -732
  121. package/vendor/srt-win/src/lib.rs +0 -20
  122. package/vendor/srt-win/src/main.rs +0 -669
  123. package/vendor/srt-win/src/self_protect.rs +0 -169
  124. package/vendor/srt-win/src/sid.rs +0 -296
  125. package/vendor/srt-win/src/token.rs +0 -341
  126. package/vendor/srt-win/src/util.rs +0 -42
  127. package/vendor/srt-win/src/wfp.rs +0 -992
  128. package/vendor/srt-win/src/winsta.rs +0 -209
  129. package/vendor/srt-win/tests/sd_access_check_matrix.rs +0 -259
@@ -0,0 +1,59 @@
1
+ import { type Server, type Socket } from 'node:net';
2
+ import type { Server as HttpServer } from 'node:http';
3
+ export interface MuxProxyOptions {
4
+ /**
5
+ * The HTTP CONNECT/absolute-URI proxy. Must NOT already be listening;
6
+ * the mux owns its listen lifecycle (on a private unix socket on
7
+ * macOS/Linux, or a localhost TCP port on Windows).
8
+ */
9
+ httpServer: HttpServer;
10
+ /**
11
+ * Per-connection SOCKS entry point. The mux calls this with a socket
12
+ * whose peeked first byte has been `unshift()`ed back, so the handler
13
+ * sees the full SOCKS greeting starting at byte 0.
14
+ */
15
+ handleSocksConnection: (socket: Socket) => void;
16
+ /**
17
+ * How long to wait for the client's first byte before destroying the
18
+ * connection. Guards against connect-then-stall clients holding a slot.
19
+ */
20
+ firstByteTimeoutMs?: number;
21
+ /**
22
+ * Windows only: range the HTTP backend's TCP port must fall inside, so
23
+ * the WFP loopback permit covers the mux→backend hop. Ignored on other
24
+ * platforms (unix socket needs no port).
25
+ */
26
+ httpBackendPortRange?: readonly [number, number];
27
+ }
28
+ export interface MuxProxyServer {
29
+ /** The front-end TCP listener. Call `.listen()` on this. */
30
+ server: Server;
31
+ /** Bound front-end port, once listening. */
32
+ getPort(): number | undefined;
33
+ /**
34
+ * Start the HTTP backend listener (unix socket on macOS/Linux, localhost
35
+ * TCP on Windows). Must be awaited before the front-end `.listen()`s so
36
+ * an early HTTP connection never dispatches to an unbound backend.
37
+ * Returns the backend's TCP port on Windows (so the caller can exclude
38
+ * it when binding the front-end in the same range), or undefined on
39
+ * unix-socket platforms.
40
+ */
41
+ listenHttpBackend(): Promise<number | undefined>;
42
+ /** Tear down front-end, backend, and all open client sockets. */
43
+ close(): Promise<void>;
44
+ /** unref() both listeners so they don't keep the event loop alive. */
45
+ unref(): void;
46
+ }
47
+ /**
48
+ * Single-port proxy front-end that dispatches each connection to either the
49
+ * SOCKS handler or the HTTP proxy based on the first byte the client sends.
50
+ *
51
+ * The HTTP leg cannot use `httpServer.emit('connection', socket)` because
52
+ * Bun's `http.Server` does not implement that injection path (Node does).
53
+ * Instead the HTTP backend listens on a private endpoint — a unix socket on
54
+ * macOS/Linux, a localhost TCP port on Windows — and the mux pipes the
55
+ * client socket to it. SOCKS connections are handed directly to the
56
+ * library's per-connection entry, no extra hop.
57
+ */
58
+ export declare function createMuxProxyServer(opts: MuxProxyOptions): MuxProxyServer;
59
+ //# sourceMappingURL=mux-proxy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mux-proxy.d.ts","sourceRoot":"","sources":["../../src/sandbox/mux-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAC1E,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA;AAmBrD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;IACtB;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjD;AAED,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAA;IACd,4CAA4C;IAC5C,OAAO,IAAI,MAAM,GAAG,SAAS,CAAA;IAC7B;;;;;;;OAOG;IACH,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAChD,iEAAiE;IACjE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB,sEAAsE;IACtE,KAAK,IAAI,IAAI,CAAA;CACd;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CA8I1E"}
@@ -0,0 +1,159 @@
1
+ import { createServer, connect } from 'node:net';
2
+ import { join } from 'node:path';
3
+ import { tmpdir } from 'node:os';
4
+ import { unlink } from 'node:fs/promises';
5
+ import { logForDebugging } from '../utils/debug.js';
6
+ import { getPlatform } from '../utils/platform.js';
7
+ import { listenInRange } from './listen-in-range.js';
8
+ /**
9
+ * First-byte values that select the SOCKS handler. SOCKS5's greeting is
10
+ * `VER NMETHODS METHODS...` with VER=0x05; SOCKS4's CONNECT is
11
+ * `VN CD DSTPORT...` with VN=0x04. Everything else on this port is HTTP:
12
+ * request methods start with an ASCII uppercase letter (>= 0x41 'A'),
13
+ * h2-prior-knowledge starts `PRI ` (0x50), and a stray TLS ClientHello
14
+ * starts 0x16 — none of which collide with 0x04/0x05. A one-byte peek is
15
+ * therefore an unambiguous discriminator.
16
+ */
17
+ const SOCKS_FIRST_BYTES = new Set([0x04, 0x05]);
18
+ const DEFAULT_FIRST_BYTE_TIMEOUT_MS = 10000;
19
+ let backendSeq = 0;
20
+ function unixSocketPath() {
21
+ // Keep it short — macOS sun_path is 104 bytes.
22
+ return join(tmpdir(), `srt-mux-${process.pid}-${(backendSeq++).toString(36)}.sock`);
23
+ }
24
+ /**
25
+ * Single-port proxy front-end that dispatches each connection to either the
26
+ * SOCKS handler or the HTTP proxy based on the first byte the client sends.
27
+ *
28
+ * The HTTP leg cannot use `httpServer.emit('connection', socket)` because
29
+ * Bun's `http.Server` does not implement that injection path (Node does).
30
+ * Instead the HTTP backend listens on a private endpoint — a unix socket on
31
+ * macOS/Linux, a localhost TCP port on Windows — and the mux pipes the
32
+ * client socket to it. SOCKS connections are handed directly to the
33
+ * library's per-connection entry, no extra hop.
34
+ */
35
+ export function createMuxProxyServer(opts) {
36
+ const firstByteTimeoutMs = opts.firstByteTimeoutMs ?? DEFAULT_FIRST_BYTE_TIMEOUT_MS;
37
+ const isWindows = getPlatform() === 'windows';
38
+ // Where the HTTP backend listens. Exactly one of these is set after
39
+ // listenHttpBackend() resolves.
40
+ let backendSocketPath;
41
+ let backendTcpPort;
42
+ // Track every accepted client socket so close() can tear them down
43
+ // immediately rather than waiting for in-flight tunnels to drain.
44
+ const openSockets = new Set();
45
+ function dispatchHttp(client) {
46
+ if (backendSocketPath === undefined && backendTcpPort === undefined) {
47
+ // listenHttpBackend() must resolve before the front-end listens; this
48
+ // guard is defense-in-depth in case a future caller reorders them.
49
+ logForDebugging('mux: HTTP dispatch before backend bound; dropping', {
50
+ level: 'error',
51
+ });
52
+ client.destroy();
53
+ return;
54
+ }
55
+ const upstream = backendSocketPath
56
+ ? connect(backendSocketPath)
57
+ : connect(backendTcpPort, '127.0.0.1');
58
+ upstream.on('error', err => {
59
+ // Surface a 502 with the errno code so callers (and CI logs) can tell
60
+ // *why* the backend was unreachable instead of an opaque empty-reply.
61
+ // Full error (including path) goes to debug logging only — the client
62
+ // is our own sandboxed child, but there's no need to echo host paths.
63
+ const code = err.code ?? 'ERR';
64
+ logForDebugging(`mux: HTTP backend dial failed: ${err.message}`, { level: 'error' });
65
+ if (!client.destroyed) {
66
+ client.end(`HTTP/1.1 502 Bad Gateway\r\nConnection: close\r\n\r\n` +
67
+ `mux backend dial failed (${code})\n`);
68
+ }
69
+ });
70
+ client.on('error', () => upstream.destroy());
71
+ client.once('close', () => upstream.destroy());
72
+ upstream.once('close', () => client.destroy());
73
+ client.pipe(upstream);
74
+ upstream.pipe(client);
75
+ }
76
+ const server = createServer(client => {
77
+ openSockets.add(client);
78
+ client.once('close', () => openSockets.delete(client));
79
+ client.on('error', err => logForDebugging(`mux: client socket error: ${err.message}`));
80
+ const timer = setTimeout(() => {
81
+ logForDebugging('mux: first-byte timeout; destroying connection');
82
+ client.destroy();
83
+ }, firstByteTimeoutMs);
84
+ // Don't let a pending sniff keep the process alive.
85
+ if (typeof timer.unref === 'function')
86
+ timer.unref();
87
+ client.once('readable', () => {
88
+ clearTimeout(timer);
89
+ const peek = client.read(1);
90
+ if (!peek || peek.length === 0) {
91
+ // EOF before any byte — client connected and closed.
92
+ client.destroy();
93
+ return;
94
+ }
95
+ client.unshift(peek);
96
+ if (SOCKS_FIRST_BYTES.has(peek[0])) {
97
+ opts.handleSocksConnection(client);
98
+ }
99
+ else {
100
+ dispatchHttp(client);
101
+ }
102
+ });
103
+ });
104
+ return {
105
+ server,
106
+ getPort() {
107
+ const addr = server.address();
108
+ return addr && typeof addr === 'object' ? addr.port : undefined;
109
+ },
110
+ async listenHttpBackend() {
111
+ if (!isWindows) {
112
+ const path = unixSocketPath();
113
+ // A prior process with the same PID may have crashed without
114
+ // unlinking; clear any stale file so listen() doesn't EADDRINUSE.
115
+ await unlink(path).catch(() => { });
116
+ await new Promise((resolve, reject) => {
117
+ opts.httpServer.once('error', reject);
118
+ opts.httpServer.listen(path, () => {
119
+ opts.httpServer.removeListener('error', reject);
120
+ resolve();
121
+ });
122
+ });
123
+ backendSocketPath = path;
124
+ logForDebugging(`mux: HTTP backend listening on ${path}`);
125
+ return undefined;
126
+ }
127
+ // Windows: AF_UNIX support under Bun is unverified, so the backend
128
+ // listens on a localhost TCP port inside the WFP-permitted range.
129
+ // The mux→backend hop originates from the parent process (not the
130
+ // sandboxed child), so WFP doesn't strictly require it; staying in
131
+ // range just keeps the port surface predictable.
132
+ await listenInRange(opts.httpServer, p => opts.httpServer.listen(p, '127.0.0.1'), opts.httpBackendPortRange, new Set());
133
+ const addr = opts.httpServer.address();
134
+ backendTcpPort = addr && typeof addr === 'object' ? addr.port : undefined;
135
+ logForDebugging(`mux: HTTP backend listening on 127.0.0.1:${backendTcpPort}`);
136
+ return backendTcpPort;
137
+ },
138
+ async close() {
139
+ for (const s of openSockets)
140
+ s.destroy();
141
+ openSockets.clear();
142
+ await new Promise(resolve => server.close(() => resolve()));
143
+ // The mux owns httpServer's listen lifecycle, so it owns close too.
144
+ // sandbox-manager.reset() additionally calls forceCloseHttpServer()
145
+ // for closeAllConnections() semantics; double-close is a no-op.
146
+ await new Promise(resolve => opts.httpServer.close(() => resolve()));
147
+ if (backendSocketPath) {
148
+ await unlink(backendSocketPath).catch(() => { });
149
+ backendSocketPath = undefined;
150
+ }
151
+ backendTcpPort = undefined;
152
+ },
153
+ unref() {
154
+ server.unref();
155
+ opts.httpServer.unref();
156
+ },
157
+ };
158
+ }
159
+ //# sourceMappingURL=mux-proxy.js.map
@@ -0,0 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AAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;YACzE,eAAe,CACb,4CAA4C,cAAc,EAAE,CAC7D,CAAA;YACD,OAAO,cAAc,CAAA;QACvB,CAAC;QACD,KAAK,CAAC,KAAK;YACT,KAAK,MAAM,CAAC,IAAI,WAAW;gBAAE,CAAC,CAAC,OAAO,EAAE,CAAA;YACxC,WAAW,CAAC,KAAK,EAAE,CAAA;YACnB,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YACjE,oEAAoE;YACpE,oEAAoE;YACpE,gEAAgE;YAChE,MAAM,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;YAC1E,IAAI,iBAAiB,EAAE,CAAC;gBACtB,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;gBAC/C,iBAAiB,GAAG,SAAS,CAAA;YAC/B,CAAC;YACD,cAAc,GAAG,SAAS,CAAA;QAC5B,CAAC;QACD,KAAK;YACH,MAAM,CAAC,KAAK,EAAE,CAAA;YACd,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAA;QACzB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * and, when `tlsTerminate` is configured, to terminated HTTPS. The proxy
8
8
  * enforces the decision; the library does not bless any matching DSL.
9
9
  */
10
- import type { IncomingMessage, ServerResponse } from 'node:http';
10
+ import type { IncomingHttpHeaders, IncomingMessage, ServerResponse } from 'node:http';
11
11
  import { Readable } from 'node:stream';
12
12
  export type RequestDecision = {
13
13
  action: 'allow' | 'deny';
@@ -29,6 +29,16 @@ export type RequestDecision = {
29
29
  * contract for a security boundary: a buggy policy fails closed.
30
30
  */
31
31
  export type FilterRequestCallback = (request: Request) => Promise<RequestDecision>;
32
+ /**
33
+ * Mutate the headers that will be sent upstream, in place.
34
+ *
35
+ * Runs after the allow/deny decision and hop-by-hop stripping, immediately
36
+ * before the upstream request is built. `destHost` is the canonical
37
+ * destination host (the CONNECT target on the TLS-terminated path, or the
38
+ * absolute-URI host on the plain-HTTP path) — never the client-supplied
39
+ * Host header, which is spoofable.
40
+ */
41
+ export type MutateForwardedHeaders = (headers: IncomingHttpHeaders, destHost: string) => void;
32
42
  /**
33
43
  * Build a `Request`, run the callback, and if denied write the 403 response
34
44
  * and return `null`. On allow, returns the body stream the caller must pipe
@@ -1 +1 @@
1
- {"version":3,"file":"request-filter.d.ts","sourceRoot":"","sources":["../../src/sandbox/request-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,eAAe,CAAC,CAAA;AAI7B;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CACpC,aAAa,EAAE,qBAAqB,EACpC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAsD1B"}
1
+ {"version":3,"file":"request-filter.d.ts","sourceRoot":"","sources":["../../src/sandbox/request-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA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