@voratiq/sandbox-runtime 0.0.29-voratiq0

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 (85) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +12 -0
  4. package/README.md +17 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +158 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/index.d.ts +12 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +9 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/sandbox/generate-seccomp-filter.d.ts +65 -0
  14. package/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -0
  15. package/dist/sandbox/generate-seccomp-filter.js +185 -0
  16. package/dist/sandbox/generate-seccomp-filter.js.map +1 -0
  17. package/dist/sandbox/http-proxy.d.ts +14 -0
  18. package/dist/sandbox/http-proxy.d.ts.map +1 -0
  19. package/dist/sandbox/http-proxy.js +238 -0
  20. package/dist/sandbox/http-proxy.js.map +1 -0
  21. package/dist/sandbox/linux-sandbox-utils.d.ts +121 -0
  22. package/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -0
  23. package/dist/sandbox/linux-sandbox-utils.js +723 -0
  24. package/dist/sandbox/linux-sandbox-utils.js.map +1 -0
  25. package/dist/sandbox/macos-sandbox-utils.d.ts +57 -0
  26. package/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -0
  27. package/dist/sandbox/macos-sandbox-utils.js +611 -0
  28. package/dist/sandbox/macos-sandbox-utils.js.map +1 -0
  29. package/dist/sandbox/observability.d.ts +56 -0
  30. package/dist/sandbox/observability.d.ts.map +1 -0
  31. package/dist/sandbox/observability.js +140 -0
  32. package/dist/sandbox/observability.js.map +1 -0
  33. package/dist/sandbox/sandbox-config.d.ts +277 -0
  34. package/dist/sandbox/sandbox-config.d.ts.map +1 -0
  35. package/dist/sandbox/sandbox-config.js +166 -0
  36. package/dist/sandbox/sandbox-config.js.map +1 -0
  37. package/dist/sandbox/sandbox-manager.d.ts +50 -0
  38. package/dist/sandbox/sandbox-manager.d.ts.map +1 -0
  39. package/dist/sandbox/sandbox-manager.js +816 -0
  40. package/dist/sandbox/sandbox-manager.js.map +1 -0
  41. package/dist/sandbox/sandbox-schemas.d.ts +53 -0
  42. package/dist/sandbox/sandbox-schemas.d.ts.map +1 -0
  43. package/dist/sandbox/sandbox-schemas.js +3 -0
  44. package/dist/sandbox/sandbox-schemas.js.map +1 -0
  45. package/dist/sandbox/sandbox-utils.d.ts +83 -0
  46. package/dist/sandbox/sandbox-utils.d.ts.map +1 -0
  47. package/dist/sandbox/sandbox-utils.js +343 -0
  48. package/dist/sandbox/sandbox-utils.js.map +1 -0
  49. package/dist/sandbox/sandbox-violation-store.d.ts +19 -0
  50. package/dist/sandbox/sandbox-violation-store.d.ts.map +1 -0
  51. package/dist/sandbox/sandbox-violation-store.js +54 -0
  52. package/dist/sandbox/sandbox-violation-store.js.map +1 -0
  53. package/dist/sandbox/socks-proxy.d.ts +14 -0
  54. package/dist/sandbox/socks-proxy.d.ts.map +1 -0
  55. package/dist/sandbox/socks-proxy.js +109 -0
  56. package/dist/sandbox/socks-proxy.js.map +1 -0
  57. package/dist/utils/config-loader.d.ts +11 -0
  58. package/dist/utils/config-loader.d.ts.map +1 -0
  59. package/dist/utils/config-loader.js +60 -0
  60. package/dist/utils/config-loader.js.map +1 -0
  61. package/dist/utils/debug.d.ts +7 -0
  62. package/dist/utils/debug.d.ts.map +1 -0
  63. package/dist/utils/debug.js +25 -0
  64. package/dist/utils/debug.js.map +1 -0
  65. package/dist/utils/platform.d.ts +15 -0
  66. package/dist/utils/platform.d.ts.map +1 -0
  67. package/dist/utils/platform.js +49 -0
  68. package/dist/utils/platform.js.map +1 -0
  69. package/dist/utils/ripgrep.d.ts +20 -0
  70. package/dist/utils/ripgrep.d.ts.map +1 -0
  71. package/dist/utils/ripgrep.js +51 -0
  72. package/dist/utils/ripgrep.js.map +1 -0
  73. package/dist/vendor/seccomp/arm64/apply-seccomp +0 -0
  74. package/dist/vendor/seccomp/arm64/unix-block.bpf +0 -0
  75. package/dist/vendor/seccomp/x64/apply-seccomp +0 -0
  76. package/dist/vendor/seccomp/x64/unix-block.bpf +0 -0
  77. package/dist/vendor/seccomp-src/apply-seccomp.c +98 -0
  78. package/dist/vendor/seccomp-src/seccomp-unix-block.c +97 -0
  79. package/package.json +90 -0
  80. package/vendor/seccomp/arm64/apply-seccomp +0 -0
  81. package/vendor/seccomp/arm64/unix-block.bpf +0 -0
  82. package/vendor/seccomp/x64/apply-seccomp +0 -0
  83. package/vendor/seccomp/x64/unix-block.bpf +0 -0
  84. package/vendor/seccomp-src/apply-seccomp.c +98 -0
  85. package/vendor/seccomp-src/seccomp-unix-block.c +97 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ All notable changes to this Voratiq-maintained fork are documented here.
4
+
5
+ ## 0.0.29-voratiq0 - 2026-01-22
6
+
7
+ - Upstream baseline: b07da4039c1ce9447b812d9ff17dc3fabb270bd1 (0.0.29).
8
+ - Updated fork package metadata and documentation for the Voratiq-maintained release line.
9
+ - Allowed macOS sandbox to query `configd` for DNS resolution.
10
+ - Added network/fs observability events with scrubbing and spawn‑scoped callbacks.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 Anthropic
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,12 @@
1
+ Voratiq Sandbox Runtime
2
+
3
+ Copyright (c) 2026 Voratiq
4
+
5
+ This distribution includes substantial portions of the Anthropic Sandbox Runtime,
6
+ which is Copyright (c) 2025 Anthropic PBC and licensed under the Apache License,
7
+ Version 2.0. The original project is available at
8
+ https://github.com/anthropic-experimental/sandbox-runtime.
9
+
10
+ This software may include third-party components distributed under their own
11
+ licenses. See `package.json` and the accompanying license files in the vendor
12
+ directory for additional details.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ > This is the Voratiq-maintained fork of the Anthropic Sandbox Runtime. It tracks `anthropic-experimental/sandbox-runtime` while layering in Voratiq branding, macOS `configd` allowances, and optional debug telemetry.
2
+
3
+ # Anthropic Sandbox Runtime (srt)
4
+
5
+ A lightweight sandboxing tool for enforcing filesystem and network restrictions on arbitrary processes at the OS level, without requiring a container.
6
+
7
+ `srt` uses native OS sandboxing primitives (`sandbox-exec` on macOS, `bubblewrap` on Linux) and proxy-based network filtering. It can be used to sandbox the behaviour of agents, local MCP servers, bash commands and arbitrary processes.
8
+
9
+ > **Beta Research Preview**
10
+ >
11
+ > The Sandbox Runtime is a research preview developed for [Claude Code](https://www.claude.com/product/claude-code) to enable safer AI agents. It's being made available as an early open source preview to help the broader ecosystem build more secure agentic systems. As this is an early research preview, APIs and configuration formats may evolve. We welcome feedback and contributions to make AI agents safer by default!
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install -g @voratiq/sandbox-runtime
17
+ ```
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,158 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { SandboxManager } from './index.js';
4
+ import { spawn } from 'child_process';
5
+ import { logForDebugging } from './utils/debug.js';
6
+ import { loadConfig, loadConfigFromString } from './utils/config-loader.js';
7
+ import * as readline from 'readline';
8
+ import * as fs from 'fs';
9
+ import * as path from 'path';
10
+ import * as os from 'os';
11
+ /**
12
+ * Get default config path
13
+ */
14
+ function getDefaultConfigPath() {
15
+ return path.join(os.homedir(), '.srt-settings.json');
16
+ }
17
+ /**
18
+ * Create a minimal default config if no config file exists
19
+ */
20
+ function getDefaultConfig() {
21
+ return {
22
+ network: {
23
+ allowedDomains: [],
24
+ deniedDomains: [],
25
+ },
26
+ filesystem: {
27
+ denyRead: [],
28
+ allowWrite: [],
29
+ denyWrite: [],
30
+ },
31
+ };
32
+ }
33
+ async function main() {
34
+ const program = new Command();
35
+ program
36
+ .name('srt')
37
+ .description('Run commands in a sandbox with network and filesystem restrictions')
38
+ .version(process.env.npm_package_version || '1.0.0');
39
+ // Default command - run command in sandbox
40
+ program
41
+ .argument('[command...]', 'command to run in the sandbox')
42
+ .option('-d, --debug', 'enable debug logging')
43
+ .option('-s, --settings <path>', 'path to config file (default: ~/.srt-settings.json)')
44
+ .option('-c <command>', 'run command string directly (like sh -c), no escaping applied')
45
+ .option('--control-fd <fd>', 'read config updates from file descriptor (JSON lines protocol)', parseInt)
46
+ .allowUnknownOption()
47
+ .action(async (commandArgs, options) => {
48
+ try {
49
+ // Enable debug logging if requested
50
+ if (options.debug) {
51
+ process.env.DEBUG = 'true';
52
+ }
53
+ // Load config from file
54
+ const configPath = options.settings || getDefaultConfigPath();
55
+ let runtimeConfig = loadConfig(configPath);
56
+ if (!runtimeConfig) {
57
+ logForDebugging(`No config found at ${configPath}, using default config`);
58
+ runtimeConfig = getDefaultConfig();
59
+ }
60
+ // Initialize sandbox with config
61
+ logForDebugging('Initializing sandbox...');
62
+ await SandboxManager.initialize(runtimeConfig);
63
+ // Set up control fd for dynamic config updates if specified
64
+ let controlReader = null;
65
+ if (options.controlFd !== undefined) {
66
+ try {
67
+ const controlStream = fs.createReadStream('', {
68
+ fd: options.controlFd,
69
+ });
70
+ controlReader = readline.createInterface({
71
+ input: controlStream,
72
+ crlfDelay: Infinity,
73
+ });
74
+ controlReader.on('line', line => {
75
+ const newConfig = loadConfigFromString(line);
76
+ if (newConfig) {
77
+ logForDebugging(`Config updated from control fd: ${JSON.stringify(newConfig)}`);
78
+ SandboxManager.updateConfig(newConfig);
79
+ }
80
+ else if (line.trim()) {
81
+ // Only log non-empty lines that failed to parse
82
+ logForDebugging(`Invalid config on control fd (ignored): ${line}`);
83
+ }
84
+ });
85
+ controlReader.on('error', err => {
86
+ logForDebugging(`Control fd error: ${err.message}`);
87
+ });
88
+ logForDebugging(`Listening for config updates on fd ${options.controlFd}`);
89
+ }
90
+ catch (err) {
91
+ logForDebugging(`Failed to open control fd ${options.controlFd}: ${err instanceof Error ? err.message : String(err)}`);
92
+ }
93
+ }
94
+ // Cleanup control reader on exit
95
+ process.on('exit', () => {
96
+ controlReader?.close();
97
+ });
98
+ // Determine command string based on mode
99
+ let command;
100
+ if (options.c) {
101
+ // -c mode: use command string directly, no escaping
102
+ command = options.c;
103
+ logForDebugging(`Command string mode (-c): ${command}`);
104
+ }
105
+ else if (commandArgs.length > 0) {
106
+ // Default mode: simple join
107
+ command = commandArgs.join(' ');
108
+ logForDebugging(`Original command: ${command}`);
109
+ }
110
+ else {
111
+ console.error('Error: No command specified. Use -c <command> or provide command arguments.');
112
+ process.exit(1);
113
+ }
114
+ logForDebugging(JSON.stringify(SandboxManager.getNetworkRestrictionConfig(), null, 2));
115
+ // Wrap the command with sandbox restrictions
116
+ const sandboxedCommand = await SandboxManager.wrapWithSandbox(command);
117
+ // Execute the sandboxed command
118
+ const child = spawn(sandboxedCommand, {
119
+ shell: true,
120
+ stdio: 'inherit',
121
+ });
122
+ // Handle process exit
123
+ child.on('exit', (code, signal) => {
124
+ if (signal) {
125
+ if (signal === 'SIGINT' || signal === 'SIGTERM') {
126
+ process.exit(0);
127
+ }
128
+ else {
129
+ console.error(`Process killed by signal: ${signal}`);
130
+ process.exit(1);
131
+ }
132
+ }
133
+ process.exit(code ?? 0);
134
+ });
135
+ child.on('error', error => {
136
+ console.error(`Failed to execute command: ${error.message}`);
137
+ process.exit(1);
138
+ });
139
+ // Handle cleanup on interrupt
140
+ process.on('SIGINT', () => {
141
+ child.kill('SIGINT');
142
+ });
143
+ process.on('SIGTERM', () => {
144
+ child.kill('SIGTERM');
145
+ });
146
+ }
147
+ catch (error) {
148
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
149
+ process.exit(1);
150
+ }
151
+ });
152
+ program.parse();
153
+ }
154
+ main().catch(error => {
155
+ console.error('Fatal error:', error);
156
+ process.exit(1);
157
+ });
158
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AACpC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AACxB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB;;GAEG;AACH,SAAS,oBAAoB;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,oBAAoB,CAAC,CAAA;AACtD,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB;IACvB,OAAO;QACL,OAAO,EAAE;YACP,cAAc,EAAE,EAAE;YAClB,aAAa,EAAE,EAAE;SAClB;QACD,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;SACd;KACF,CAAA;AACH,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAA;IAE7B,OAAO;SACJ,IAAI,CAAC,KAAK,CAAC;SACX,WAAW,CACV,oEAAoE,CACrE;SACA,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,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KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;gBAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC,CAAC,CAAA;YAEF,8BAA8B;YAC9B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;gBACxB,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACtB,CAAC,CAAC,CAAA;YAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;gBACzB,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACvB,CAAC,CAAC,CAAA;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACnE,CAAA;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC,CACF,CAAA;IAEH,OAAO,CAAC,KAAK,EAAE,CAAA;AACjB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ export { SandboxManager } from './sandbox/sandbox-manager.js';
2
+ export { SandboxViolationStore } from './sandbox/sandbox-violation-store.js';
3
+ export type { SandboxSpawnOptions } from './sandbox/sandbox-manager.js';
4
+ export type { SandboxRuntimeConfig, NetworkConfig, FilesystemConfig, IgnoreViolationsConfig, } from './sandbox/sandbox-config.js';
5
+ export { SandboxRuntimeConfigSchema, NetworkConfigSchema, FilesystemConfigSchema, IgnoreViolationsConfigSchema, RipgrepConfigSchema, } from './sandbox/sandbox-config.js';
6
+ export type { SandboxAskCallback, FsReadRestrictionConfig, FsWriteRestrictionConfig, NetworkRestrictionConfig, NetworkHostPattern, } from './sandbox/sandbox-schemas.js';
7
+ export type { SandboxViolationEvent } from './sandbox/macos-sandbox-utils.js';
8
+ export type { SandboxEvents, SandboxEvent, NetworkEvent, FsViolationEvent, NetworkDecision, NetworkDecisionReason, NetworkRoute, FsViolationOperation, FsViolationReason, } from './sandbox/observability.js';
9
+ export { getDefaultWritePaths } from './sandbox/sandbox-utils.js';
10
+ export { getWslVersion } from './utils/platform.js';
11
+ export type { Platform } from './utils/platform.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAC5E,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAGvE,YAAY,EACV,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AAGpC,YAAY,EACV,kBAAkB,EAClB,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,8BAA8B,CAAA;AAGrC,YAAY,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAA;AAG7E,YAAY,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,4BAA4B,CAAA;AAGnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,YAAY,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ // Library exports
2
+ export { SandboxManager } from './sandbox/sandbox-manager.js';
3
+ export { SandboxViolationStore } from './sandbox/sandbox-violation-store.js';
4
+ export { SandboxRuntimeConfigSchema, NetworkConfigSchema, FilesystemConfigSchema, IgnoreViolationsConfigSchema, RipgrepConfigSchema, } from './sandbox/sandbox-config.js';
5
+ // Utility functions
6
+ export { getDefaultWritePaths } from './sandbox/sandbox-utils.js';
7
+ // Platform utilities
8
+ export { getWslVersion } from './utils/platform.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kBAAkB;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAW5E,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,6BAA6B,CAAA;AA2BpC,oBAAoB;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,qBAAqB;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,65 @@
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. Expected 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
+ *
14
+ * @param expectedPath - Optional path to check first (highest priority)
15
+ */
16
+ export declare function getPreGeneratedBpfPath(expectedPath?: string): string | null;
17
+ /**
18
+ * Get the path to the apply-seccomp binary from the vendor directory
19
+ * Returns the path if it exists, null otherwise
20
+ *
21
+ * Pre-built apply-seccomp binaries are organized by architecture:
22
+ * - vendor/seccomp/{x64,arm64}/apply-seccomp
23
+ *
24
+ * Tries multiple paths for resilience:
25
+ * 0. Expected path provided via parameter (checked first if provided)
26
+ * 1. vendor/seccomp/{arch}/apply-seccomp (bundled - when bundled into consuming packages)
27
+ * 2. ../../vendor/seccomp/{arch}/apply-seccomp (package root - standard npm installs)
28
+ * 3. ../vendor/seccomp/{arch}/apply-seccomp (dist/vendor - for bundlers)
29
+ *
30
+ * @param expectedPath - Optional path to check first (highest priority)
31
+ */
32
+ export declare function getApplySeccompBinaryPath(expectedPath?: string): string | null;
33
+ /**
34
+ * Get the path to a pre-generated seccomp BPF filter that blocks Unix domain socket creation
35
+ * Returns the path to the BPF filter file, or null if not available
36
+ *
37
+ * The filter blocks socket(AF_UNIX, ...) syscalls while allowing all other syscalls.
38
+ * This prevents creation of new Unix domain socket file descriptors.
39
+ *
40
+ * Security scope:
41
+ * - Blocks: socket(AF_UNIX, ...) syscall (creating new Unix socket FDs)
42
+ * - Does NOT block: Operations on inherited Unix socket FDs (bind, connect, sendto, etc.)
43
+ * - Does NOT block: Unix socket FDs passed via SCM_RIGHTS
44
+ * - For most sandboxing scenarios, blocking socket creation is sufficient
45
+ *
46
+ * Note: This blocks ALL Unix socket creation, regardless of path. The allowUnixSockets
47
+ * configuration is not supported on Linux due to seccomp-bpf limitations (it cannot
48
+ * read user-space memory to inspect socket paths).
49
+ *
50
+ * Requirements:
51
+ * - Pre-generated BPF filters included for x64 and ARM64 only
52
+ * - Other architectures are not supported
53
+ *
54
+ * @param expectedPath - Optional path to check first (highest priority)
55
+ * @returns Path to the pre-generated BPF filter file, or null if not available
56
+ */
57
+ export declare function generateSeccompFilter(expectedPath?: string): string | null;
58
+ /**
59
+ * Clean up a seccomp filter file
60
+ * Since we only use pre-generated BPF files from vendor/, this is a no-op.
61
+ * Pre-generated files are never deleted.
62
+ * Kept for backward compatibility with existing code that calls it.
63
+ */
64
+ export declare function cleanupSeccompFilter(_filterPath: string): void;
65
+ //# sourceMappingURL=generate-seccomp-filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-seccomp-filter.d.ts","sourceRoot":"","sources":["../../src/sandbox/generate-seccomp-filter.ts"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkD3E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,IAAI,CAoDf;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa1E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAE9D"}