@sysid/sandbox-runtime-improved 0.0.45-sysid.2 → 0.0.49-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.
- package/README.md +9 -30
- package/dist/sandbox/generate-seccomp-filter.d.ts +0 -51
- package/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -1
- package/dist/sandbox/generate-seccomp-filter.js +0 -106
- package/dist/sandbox/generate-seccomp-filter.js.map +1 -1
- package/dist/sandbox/linux-sandbox-utils.d.ts +4 -13
- package/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -1
- package/dist/sandbox/linux-sandbox-utils.js +84 -105
- package/dist/sandbox/linux-sandbox-utils.js.map +1 -1
- package/dist/sandbox/macos-sandbox-utils.d.ts +1 -1
- package/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -1
- package/dist/sandbox/macos-sandbox-utils.js +41 -20
- package/dist/sandbox/macos-sandbox-utils.js.map +1 -1
- package/dist/sandbox/sandbox-config.d.ts +16 -12
- package/dist/sandbox/sandbox-config.d.ts.map +1 -1
- package/dist/sandbox/sandbox-config.js +17 -10
- package/dist/sandbox/sandbox-config.js.map +1 -1
- package/dist/sandbox/sandbox-manager.d.ts +1 -1
- package/dist/sandbox/sandbox-manager.d.ts.map +1 -1
- package/dist/sandbox/sandbox-manager.js +6 -9
- package/dist/sandbox/sandbox-manager.js.map +1 -1
- package/dist/vendor/seccomp/build.ts +91 -0
- package/dist/vendor/seccomp-src/apply-seccomp.c +18 -23
- package/package.json +3 -8
- package/vendor/seccomp/build.ts +91 -0
- package/vendor/seccomp-src/apply-seccomp.c +18 -23
- package/dist/vendor/seccomp/arm64/apply-seccomp +0 -0
- package/dist/vendor/seccomp/arm64/unix-block.bpf +0 -0
- package/dist/vendor/seccomp/x64/apply-seccomp +0 -0
- package/dist/vendor/seccomp/x64/unix-block.bpf +0 -0
- package/vendor/seccomp/arm64/apply-seccomp +0 -0
- package/vendor/seccomp/arm64/unix-block.bpf +0 -0
- package/vendor/seccomp/x64/apply-seccomp +0 -0
- package/vendor/seccomp/x64/unix-block.bpf +0 -0
package/README.md
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
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
7
|
|
|
9
|
-
This fork will be rebased on [SRT](https://github.com/anthropic-experimental/sandbox-runtime) continuously (currently based on upstream **v0.0.
|
|
8
|
+
This fork will be rebased on [SRT](https://github.com/anthropic-experimental/sandbox-runtime) continuously (currently based on upstream **v0.0.49**).
|
|
10
9
|
As new features become available, equivalent local ones will be removed.
|
|
11
10
|
|
|
12
11
|
> Objective: keep as close to original as possible, while allowing selected additional features.
|
|
@@ -17,12 +16,10 @@ As new features become available, equivalent local ones will be removed.
|
|
|
17
16
|
|
|
18
17
|
```json
|
|
19
18
|
{
|
|
20
|
-
"allowBrowserProcess": false
|
|
21
|
-
"allowMachLookup": ["com.1password.*"]
|
|
19
|
+
"allowBrowserProcess": false
|
|
22
20
|
}
|
|
23
21
|
```
|
|
24
22
|
- `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)*
|
|
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))*
|
|
26
23
|
|
|
27
24
|
---
|
|
28
25
|
|
|
@@ -324,10 +321,10 @@ Uses an **allow-only pattern** - all network access is denied by default.
|
|
|
324
321
|
|
|
325
322
|
**Unix Socket Settings** (platform-specific behavior):
|
|
326
323
|
|
|
327
|
-
| Setting
|
|
328
|
-
|
|
329
|
-
| `allowUnixSockets: string[]`
|
|
330
|
-
| `allowAllUnixSockets: boolean` | Allow all sockets
|
|
324
|
+
| Setting | macOS | Linux |
|
|
325
|
+
| ------------------------------ | ------------------------- | ---------------------------------------- |
|
|
326
|
+
| `allowUnixSockets: string[]` | Allowlist of socket paths | _Ignored_ (seccomp can't filter by path) |
|
|
327
|
+
| `allowAllUnixSockets: boolean` | Allow all sockets | Disable seccomp blocking |
|
|
331
328
|
|
|
332
329
|
Unix sockets are **blocked by default** on both platforms.
|
|
333
330
|
|
|
@@ -383,7 +380,6 @@ Examples:
|
|
|
383
380
|
- `ignoreViolations` - Object mapping command patterns to arrays of paths where violations should be ignored
|
|
384
381
|
- `enableWeakerNestedSandbox` - Enable weaker sandbox mode for Docker environments (boolean, default: false)
|
|
385
382
|
- `enableWeakerNetworkIsolation` - Allow access to `com.apple.trustd.agent` in the macOS sandbox (boolean, default: false). This is needed for Go programs (`gh`, `gcloud`, `terraform`, `kubectl`, etc.) to verify TLS certificates when using `httpProxyPort` with a MITM proxy and custom CA. **Security warning:** enabling this opens a potential data exfiltration vector through the trustd service.
|
|
386
|
-
- `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.*"` allows all 1Password services). Others use exact matching.
|
|
387
383
|
|
|
388
384
|
### Common Configuration Recipes
|
|
389
385
|
|
|
@@ -509,15 +505,9 @@ npm install
|
|
|
509
505
|
# Build the project
|
|
510
506
|
npm run build
|
|
511
507
|
|
|
512
|
-
# Build seccomp binaries (requires Docker)
|
|
513
|
-
npm run build:seccomp
|
|
514
|
-
|
|
515
508
|
# Run tests
|
|
516
509
|
npm test
|
|
517
510
|
|
|
518
|
-
# Run integration tests
|
|
519
|
-
npm run test:integration
|
|
520
|
-
|
|
521
511
|
# Type checking
|
|
522
512
|
npm run typecheck
|
|
523
513
|
|
|
@@ -530,18 +520,7 @@ npm run format
|
|
|
530
520
|
|
|
531
521
|
### Building Seccomp Binaries
|
|
532
522
|
|
|
533
|
-
The
|
|
534
|
-
|
|
535
|
-
```bash
|
|
536
|
-
npm run build:seccomp
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
This script uses Docker to cross-compile seccomp binaries for multiple architectures:
|
|
540
|
-
|
|
541
|
-
- x64 (x86-64)
|
|
542
|
-
- arm64 (aarch64)
|
|
543
|
-
|
|
544
|
-
The script builds static generator binaries, generates the BPF filters (~104 bytes each), and stores them in `vendor/seccomp/x64/` and `vendor/seccomp/arm64/`. The generator binaries are removed to keep the package size small.
|
|
523
|
+
The BPF filter and `apply-seccomp` loader are compiled from C source in `vendor/seccomp-src/` via `npm run build:seccomp` (Linux only; needs `gcc` and `libseccomp-dev`). CI runs it before tests on each Linux arch, and the release workflow builds both arches and bundles them into the published package.
|
|
545
524
|
|
|
546
525
|
## Implementation Details
|
|
547
526
|
|
|
@@ -633,9 +612,9 @@ On Linux, the sandbox uses **seccomp BPF (Berkeley Packet Filter)** to block Uni
|
|
|
633
612
|
|
|
634
613
|
**How it works:**
|
|
635
614
|
|
|
636
|
-
1. **
|
|
615
|
+
1. **Baked-in BPF filter**: The package ships a static `apply-seccomp` binary for x64 and arm64 with the seccomp BPF filter compiled in. The filter is architecture-specific but libc-independent, so the binary works with both glibc and musl.
|
|
637
616
|
|
|
638
|
-
2. **Runtime detection**: The sandbox automatically detects your system's architecture and
|
|
617
|
+
2. **Runtime detection**: The sandbox automatically detects your system's architecture and uses the matching `apply-seccomp` binary.
|
|
639
618
|
|
|
640
619
|
3. **Syscall filtering**: The BPF filter intercepts the `socket()` syscall and blocks creation of `AF_UNIX` sockets by returning `EPERM`. This prevents sandboxed code from creating new Unix domain sockets.
|
|
641
620
|
|
|
@@ -1,22 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the path to a pre-generated BPF filter file from the vendor directory
|
|
3
|
-
* Returns the path if it exists, null otherwise
|
|
4
|
-
*
|
|
5
|
-
* Pre-generated BPF files are organized by architecture:
|
|
6
|
-
* - vendor/seccomp/{x64,arm64}/unix-block.bpf
|
|
7
|
-
*
|
|
8
|
-
* Tries multiple paths for resilience:
|
|
9
|
-
* 0. Explicit path provided via parameter (checked first if provided)
|
|
10
|
-
* 1. vendor/seccomp/{arch}/unix-block.bpf (bundled - when bundled into consuming packages)
|
|
11
|
-
* 2. ../../vendor/seccomp/{arch}/unix-block.bpf (package root - standard npm installs)
|
|
12
|
-
* 3. ../vendor/seccomp/{arch}/unix-block.bpf (dist/vendor - for bundlers)
|
|
13
|
-
* 4. Global npm install (if seccompBinaryPath not provided) - for native builds
|
|
14
|
-
*
|
|
15
|
-
* @param seccompBinaryPath - Optional explicit path to the BPF filter file. If provided and
|
|
16
|
-
* exists, it will be used. If not provided, falls back to searching local paths and then
|
|
17
|
-
* global npm install (for native builds where vendor directory isn't bundled).
|
|
18
|
-
*/
|
|
19
|
-
export declare function getPreGeneratedBpfPath(seccompBinaryPath?: string): string | null;
|
|
20
1
|
/**
|
|
21
2
|
* Get the path to the apply-seccomp binary from the vendor directory
|
|
22
3
|
* Returns the path if it exists, null otherwise
|
|
@@ -36,36 +17,4 @@ export declare function getPreGeneratedBpfPath(seccompBinaryPath?: string): stri
|
|
|
36
17
|
* then global npm install (for native builds where vendor directory isn't bundled).
|
|
37
18
|
*/
|
|
38
19
|
export declare function getApplySeccompBinaryPath(seccompBinaryPath?: string): string | null;
|
|
39
|
-
/**
|
|
40
|
-
* Get the path to a pre-generated seccomp BPF filter that blocks Unix domain socket creation
|
|
41
|
-
* Returns the path to the BPF filter file, or null if not available
|
|
42
|
-
*
|
|
43
|
-
* The filter blocks socket(AF_UNIX, ...) syscalls while allowing all other syscalls.
|
|
44
|
-
* This prevents creation of new Unix domain socket file descriptors.
|
|
45
|
-
*
|
|
46
|
-
* Security scope:
|
|
47
|
-
* - Blocks: socket(AF_UNIX, ...) syscall (creating new Unix socket FDs)
|
|
48
|
-
* - Does NOT block: Operations on inherited Unix socket FDs (bind, connect, sendto, etc.)
|
|
49
|
-
* - Does NOT block: Unix socket FDs passed via SCM_RIGHTS
|
|
50
|
-
* - For most sandboxing scenarios, blocking socket creation is sufficient
|
|
51
|
-
*
|
|
52
|
-
* Note: This blocks ALL Unix socket creation, regardless of path. The allowUnixSockets
|
|
53
|
-
* configuration is not supported on Linux due to seccomp-bpf limitations (it cannot
|
|
54
|
-
* read user-space memory to inspect socket paths).
|
|
55
|
-
*
|
|
56
|
-
* Requirements:
|
|
57
|
-
* - Pre-generated BPF filters included for x64 and ARM64 only
|
|
58
|
-
* - Other architectures are not supported
|
|
59
|
-
*
|
|
60
|
-
* @param seccompBinaryPath - Optional explicit path to the BPF filter file
|
|
61
|
-
* @returns Path to the pre-generated BPF filter file, or null if not available
|
|
62
|
-
*/
|
|
63
|
-
export declare function generateSeccompFilter(seccompBinaryPath?: string): string | null;
|
|
64
|
-
/**
|
|
65
|
-
* Clean up a seccomp filter file
|
|
66
|
-
* Since we only use pre-generated BPF files from vendor/, this is a no-op.
|
|
67
|
-
* Pre-generated files are never deleted.
|
|
68
|
-
* Kept for backward compatibility with existing code that calls it.
|
|
69
|
-
*/
|
|
70
|
-
export declare function cleanupSeccompFilter(_filterPath: string): void;
|
|
71
20
|
//# sourceMappingURL=generate-seccomp-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-seccomp-filter.d.ts","sourceRoot":"","sources":["../../src/sandbox/generate-seccomp-filter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-seccomp-filter.d.ts","sourceRoot":"","sources":["../../src/sandbox/generate-seccomp-filter.ts"],"names":[],"mappings":"AA6IA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,iBAAiB,CAAC,EAAE,MAAM,GACzB,MAAM,GAAG,IAAI,CASf"}
|
|
@@ -5,7 +5,6 @@ import { execSync } from 'node:child_process';
|
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { logForDebugging } from '../utils/debug.js';
|
|
7
7
|
// Cache for path lookups (key: explicit path or empty string, value: resolved path or null)
|
|
8
|
-
const bpfPathCache = new Map();
|
|
9
8
|
const applySeccompPathCache = new Map();
|
|
10
9
|
// Cache for global npm paths (computed once per process)
|
|
11
10
|
let cachedGlobalNpmPaths = null;
|
|
@@ -95,68 +94,6 @@ function getLocalSeccompPaths(filename) {
|
|
|
95
94
|
join(baseDir, '..', relativePath), // dist: dist/vendor/seccomp/...
|
|
96
95
|
];
|
|
97
96
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Get the path to a pre-generated BPF filter file from the vendor directory
|
|
100
|
-
* Returns the path if it exists, null otherwise
|
|
101
|
-
*
|
|
102
|
-
* Pre-generated BPF files are organized by architecture:
|
|
103
|
-
* - vendor/seccomp/{x64,arm64}/unix-block.bpf
|
|
104
|
-
*
|
|
105
|
-
* Tries multiple paths for resilience:
|
|
106
|
-
* 0. Explicit path provided via parameter (checked first if provided)
|
|
107
|
-
* 1. vendor/seccomp/{arch}/unix-block.bpf (bundled - when bundled into consuming packages)
|
|
108
|
-
* 2. ../../vendor/seccomp/{arch}/unix-block.bpf (package root - standard npm installs)
|
|
109
|
-
* 3. ../vendor/seccomp/{arch}/unix-block.bpf (dist/vendor - for bundlers)
|
|
110
|
-
* 4. Global npm install (if seccompBinaryPath not provided) - for native builds
|
|
111
|
-
*
|
|
112
|
-
* @param seccompBinaryPath - Optional explicit path to the BPF filter file. If provided and
|
|
113
|
-
* exists, it will be used. If not provided, falls back to searching local paths and then
|
|
114
|
-
* global npm install (for native builds where vendor directory isn't bundled).
|
|
115
|
-
*/
|
|
116
|
-
export function getPreGeneratedBpfPath(seccompBinaryPath) {
|
|
117
|
-
const cacheKey = seccompBinaryPath ?? '';
|
|
118
|
-
if (bpfPathCache.has(cacheKey)) {
|
|
119
|
-
return bpfPathCache.get(cacheKey);
|
|
120
|
-
}
|
|
121
|
-
const result = findBpfPath(seccompBinaryPath);
|
|
122
|
-
bpfPathCache.set(cacheKey, result);
|
|
123
|
-
return result;
|
|
124
|
-
}
|
|
125
|
-
// NOTE: This is a slow operation (synchronous fs lookups + execSync). Ensure calls
|
|
126
|
-
// are memoized at the top level rather than invoked repeatedly.
|
|
127
|
-
function findBpfPath(seccompBinaryPath) {
|
|
128
|
-
// Check explicit path first (highest priority)
|
|
129
|
-
if (seccompBinaryPath) {
|
|
130
|
-
if (fs.existsSync(seccompBinaryPath)) {
|
|
131
|
-
logForDebugging(`[SeccompFilter] Using BPF filter from explicit path: ${seccompBinaryPath}`);
|
|
132
|
-
return seccompBinaryPath;
|
|
133
|
-
}
|
|
134
|
-
logForDebugging(`[SeccompFilter] Explicit path provided but file not found: ${seccompBinaryPath}`);
|
|
135
|
-
}
|
|
136
|
-
const arch = getVendorArchitecture();
|
|
137
|
-
if (!arch) {
|
|
138
|
-
logForDebugging(`[SeccompFilter] Cannot find pre-generated BPF filter: unsupported architecture ${process.arch}`);
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
logForDebugging(`[SeccompFilter] Detected architecture: ${arch}`);
|
|
142
|
-
// Check local paths first (bundled or package install)
|
|
143
|
-
for (const bpfPath of getLocalSeccompPaths('unix-block.bpf')) {
|
|
144
|
-
if (fs.existsSync(bpfPath)) {
|
|
145
|
-
logForDebugging(`[SeccompFilter] Found pre-generated BPF filter: ${bpfPath} (${arch})`);
|
|
146
|
-
return bpfPath;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
// Fallback: check global npm install (for native builds without bundled vendor)
|
|
150
|
-
for (const globalBase of getGlobalNpmPaths()) {
|
|
151
|
-
const bpfPath = join(globalBase, 'vendor', 'seccomp', arch, 'unix-block.bpf');
|
|
152
|
-
if (fs.existsSync(bpfPath)) {
|
|
153
|
-
logForDebugging(`[SeccompFilter] Found pre-generated BPF filter in global install: ${bpfPath} (${arch})`);
|
|
154
|
-
return bpfPath;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
logForDebugging(`[SeccompFilter] Pre-generated BPF filter not found in any expected location (${arch})`);
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
97
|
/**
|
|
161
98
|
* Get the path to the apply-seccomp binary from the vendor directory
|
|
162
99
|
* Returns the path if it exists, null otherwise
|
|
@@ -217,47 +154,4 @@ function findApplySeccompPath(seccompBinaryPath) {
|
|
|
217
154
|
logForDebugging(`[SeccompFilter] apply-seccomp binary not found in any expected location (${arch})`);
|
|
218
155
|
return null;
|
|
219
156
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Get the path to a pre-generated seccomp BPF filter that blocks Unix domain socket creation
|
|
222
|
-
* Returns the path to the BPF filter file, or null if not available
|
|
223
|
-
*
|
|
224
|
-
* The filter blocks socket(AF_UNIX, ...) syscalls while allowing all other syscalls.
|
|
225
|
-
* This prevents creation of new Unix domain socket file descriptors.
|
|
226
|
-
*
|
|
227
|
-
* Security scope:
|
|
228
|
-
* - Blocks: socket(AF_UNIX, ...) syscall (creating new Unix socket FDs)
|
|
229
|
-
* - Does NOT block: Operations on inherited Unix socket FDs (bind, connect, sendto, etc.)
|
|
230
|
-
* - Does NOT block: Unix socket FDs passed via SCM_RIGHTS
|
|
231
|
-
* - For most sandboxing scenarios, blocking socket creation is sufficient
|
|
232
|
-
*
|
|
233
|
-
* Note: This blocks ALL Unix socket creation, regardless of path. The allowUnixSockets
|
|
234
|
-
* configuration is not supported on Linux due to seccomp-bpf limitations (it cannot
|
|
235
|
-
* read user-space memory to inspect socket paths).
|
|
236
|
-
*
|
|
237
|
-
* Requirements:
|
|
238
|
-
* - Pre-generated BPF filters included for x64 and ARM64 only
|
|
239
|
-
* - Other architectures are not supported
|
|
240
|
-
*
|
|
241
|
-
* @param seccompBinaryPath - Optional explicit path to the BPF filter file
|
|
242
|
-
* @returns Path to the pre-generated BPF filter file, or null if not available
|
|
243
|
-
*/
|
|
244
|
-
export function generateSeccompFilter(seccompBinaryPath) {
|
|
245
|
-
const preGeneratedBpf = getPreGeneratedBpfPath(seccompBinaryPath);
|
|
246
|
-
if (preGeneratedBpf) {
|
|
247
|
-
logForDebugging('[SeccompFilter] Using pre-generated BPF filter');
|
|
248
|
-
return preGeneratedBpf;
|
|
249
|
-
}
|
|
250
|
-
logForDebugging('[SeccompFilter] Pre-generated BPF filter not available for this architecture. ' +
|
|
251
|
-
'Only x64 and arm64 are supported.', { level: 'error' });
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Clean up a seccomp filter file
|
|
256
|
-
* Since we only use pre-generated BPF files from vendor/, this is a no-op.
|
|
257
|
-
* Pre-generated files are never deleted.
|
|
258
|
-
* Kept for backward compatibility with existing code that calls it.
|
|
259
|
-
*/
|
|
260
|
-
export function cleanupSeccompFilter(_filterPath) {
|
|
261
|
-
// No-op: pre-generated BPF files are never cleaned up
|
|
262
|
-
}
|
|
263
157
|
//# sourceMappingURL=generate-seccomp-filter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-seccomp-filter.js","sourceRoot":"","sources":["../../src/sandbox/generate-seccomp-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,4FAA4F;AAC5F,MAAM,
|
|
1
|
+
{"version":3,"file":"generate-seccomp-filter.js","sourceRoot":"","sources":["../../src/sandbox/generate-seccomp-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,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I,EAAE,CAC7E,CAAA;IAED,uDAAuD;IACvD,KAAK,MAAM,UAAU,IAAI,oBAAoB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC/D,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,eAAe,CACb,+CAA+C,UAAU,KAAK,IAAI,GAAG,CACtE,CAAA;YACD,OAAO,UAAU,CAAA;QACnB,CAAC;IACH,CAAC;IAED,gFAAgF;IAChF,KAAK,MAAM,UAAU,IAAI,iBAAiB,EAAE,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,IAAI,CACrB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,eAAe,CAChB,CAAA;QACD,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC9B,eAAe,CACb,iEAAiE,UAAU,KAAK,IAAI,GAAG,CACxF,CAAA;YACD,OAAO,UAAU,CAAA;QACnB,CAAC;IACH,CAAC;IAED,eAAe,CACb,4EAA4E,IAAI,GAAG,CACpF,CAAA;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChildProcess } from 'node:child_process';
|
|
2
2
|
import type { FsReadRestrictionConfig, FsWriteRestrictionConfig } from './sandbox-schemas.js';
|
|
3
|
+
import type { SeccompConfig } from './sandbox-config.js';
|
|
3
4
|
export interface LinuxNetworkBridgeContext {
|
|
4
5
|
httpSocketPath: string;
|
|
5
6
|
socksSocketPath: string;
|
|
@@ -29,10 +30,7 @@ export interface LinuxSandboxParams {
|
|
|
29
30
|
/** Allow writes to .git/config files (default: false) */
|
|
30
31
|
allowGitConfig?: boolean;
|
|
31
32
|
/** Custom seccomp binary paths */
|
|
32
|
-
seccompConfig?:
|
|
33
|
-
bpfPath?: string;
|
|
34
|
-
applyPath?: string;
|
|
35
|
-
};
|
|
33
|
+
seccompConfig?: SeccompConfig;
|
|
36
34
|
/** Abort signal to cancel the ripgrep scan */
|
|
37
35
|
abortSignal?: AbortSignal;
|
|
38
36
|
}
|
|
@@ -66,7 +64,6 @@ export declare function cleanupBwrapMountPoints(opts?: {
|
|
|
66
64
|
export type LinuxDependencyStatus = {
|
|
67
65
|
hasBwrap: boolean;
|
|
68
66
|
hasSocat: boolean;
|
|
69
|
-
hasSeccompBpf: boolean;
|
|
70
67
|
hasSeccompApply: boolean;
|
|
71
68
|
};
|
|
72
69
|
/**
|
|
@@ -79,17 +76,11 @@ export type SandboxDependencyCheck = {
|
|
|
79
76
|
/**
|
|
80
77
|
* Get detailed status of Linux sandbox dependencies
|
|
81
78
|
*/
|
|
82
|
-
export declare function getLinuxDependencyStatus(seccompConfig?:
|
|
83
|
-
bpfPath?: string;
|
|
84
|
-
applyPath?: string;
|
|
85
|
-
}): LinuxDependencyStatus;
|
|
79
|
+
export declare function getLinuxDependencyStatus(seccompConfig?: SeccompConfig): LinuxDependencyStatus;
|
|
86
80
|
/**
|
|
87
81
|
* Check sandbox dependencies and return structured result
|
|
88
82
|
*/
|
|
89
|
-
export declare function checkLinuxDependencies(seccompConfig?:
|
|
90
|
-
bpfPath?: string;
|
|
91
|
-
applyPath?: string;
|
|
92
|
-
}): SandboxDependencyCheck;
|
|
83
|
+
export declare function checkLinuxDependencies(seccompConfig?: SeccompConfig): SandboxDependencyCheck;
|
|
93
84
|
/**
|
|
94
85
|
* Initialize the Linux network bridge for sandbox networking
|
|
95
86
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linux-sandbox-utils.d.ts","sourceRoot":"","sources":["../../src/sandbox/linux-sandbox-utils.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAYtD,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"linux-sandbox-utils.d.ts","sourceRoot":"","sources":["../../src/sandbox/linux-sandbox-utils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