kern-sandbox 0.1.37 → 0.1.38
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 +19 -0
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -249,6 +249,25 @@ explicit flags that **override** a profile's values (and the `memoryMb` default
|
|
|
249
249
|
`memory`, so pass `memoryMb: null` to let the profile apply). The **MCP server** (`kern-mcp`, for Claude
|
|
250
250
|
Desktop / Cursor) ships in the Python package `kern-sandbox` (`pip install kern-sandbox`).
|
|
251
251
|
|
|
252
|
+
## Egress: the setting between no network and the host's
|
|
253
|
+
|
|
254
|
+
`network: false` gives the run phase no network and `network: true` gives it the host's. `egressAllow`
|
|
255
|
+
is the middle one, and usually the one an agent wants:
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
await withSandbox({ egressAllow: ["pypi.org", "files.pythonhosted.org"] }, async (sbx) => { /* ... */ });
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The box stays in its own network namespace and reaches the internet only through kern's filtering
|
|
262
|
+
proxy, which permits those domains and nothing else: a workload can fetch from an index you chose and
|
|
263
|
+
cannot exfiltrate elsewhere. Mutually exclusive with `network: true`. The `setup` box keeps full
|
|
264
|
+
network to install dependencies; the allowlist governs the run phase, which is the one executing code
|
|
265
|
+
you did not read.
|
|
266
|
+
|
|
267
|
+
`kernel()` returns a `Kernel`, and a refused mount throws `MountRefused` rather than the generic
|
|
268
|
+
`SandboxError`, so a caller can tell "this sandbox will not do that" from "the sandbox broke".
|
|
269
|
+
`DEFAULT_TMPFS_MB` and `version` are exported for callers that assert on them.
|
|
270
|
+
|
|
252
271
|
## Prewarming: a box ready before the call arrives
|
|
253
272
|
|
|
254
273
|
`prewarm: N` keeps N boxes started in advance, each holding a booted interpreter that has run nothing,
|
package/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const crypto = require("crypto");
|
|
|
36
36
|
const zlib = require("zlib");
|
|
37
37
|
const { spawn, spawnSync } = require("child_process");
|
|
38
38
|
|
|
39
|
-
const VERSION = "0.1.
|
|
39
|
+
const VERSION = "0.1.38";
|
|
40
40
|
|
|
41
41
|
const DEFAULT_IMAGE = "python:3.12-slim";
|
|
42
42
|
const WORKSPACE = "/workspace"; // where the persistent workspace is mounted inside every box
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kern-sandbox",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "kern is a fast, rootless sandbox and virtual resource runtime for any workload, including untrusted and AI-generated code; kern-sandbox is its Node/TypeScript binding. Run untrusted or agent-generated code (Python/JS/Bash) in a real, kernel-enforced box in single-digit milliseconds, with no cloud, no account and no VM.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sandbox",
|