kern-sandbox 0.1.8 → 0.1.9
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 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# kern-sandbox (Node.js / TypeScript)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**[kern](https://github.com/getkern/kern)** is a fast, rootless, daemonless Linux sandbox runtime: a real,
|
|
4
|
+
kernel-enforced box that starts in **~2 ms**, from one **~1.6 MB** binary, with no daemon. **kern-sandbox**
|
|
5
|
+
is its Node / TypeScript binding: run untrusted or agent-generated code in a fresh, isolated box, from Node.
|
|
4
6
|
|
|
5
7
|
On npm: [`npm install kern-sandbox`](https://www.npmjs.com/package/kern-sandbox). For Python, the same
|
|
6
8
|
package is on PyPI: [`kern-sandbox`](https://pypi.org/project/kern-sandbox/).
|
|
7
9
|
|
|
8
10
|
It is a thin, dependency-free wrapper around the [`kern`](https://github.com/getkern/kern) binary:
|
|
9
11
|
a fresh, isolated box per call, network off by default, hard resource caps, and a timeout the binding
|
|
10
|
-
itself enforces.
|
|
12
|
+
itself enforces. Kernel-enforced isolation (namespaces, cgroups v2, seccomp), local, about 1.6 MB, with no cloud, no account, no VM.
|
|
11
13
|
|
|
12
14
|
```js
|
|
13
15
|
const kern = require("kern-sandbox");
|
|
@@ -79,6 +81,7 @@ const r = await kern.runCode("console.log([1,2,3].map(x => x * x))", {
|
|
|
79
81
|
|---|---|
|
|
80
82
|
| `stdout`, `stderr` | captured output (each capped at `maxOutputBytes`) |
|
|
81
83
|
| `exitCode` | the process exit code |
|
|
84
|
+
| `durationMs` | wall-clock duration of the call, in ms |
|
|
82
85
|
| `success` | `true` iff `exitCode === 0` **and** no sandbox fault |
|
|
83
86
|
| `fault` | a sandbox event, or `null`. `{ type, message }` |
|
|
84
87
|
| `files` | files created/modified in the workspace this call |
|
|
@@ -170,7 +173,7 @@ Capture never touches `stdout`/`stderr`/`exitCode`; a statement returning `None`
|
|
|
170
173
|
can still WRITE an artifact to the workspace and `readFile` it if you prefer.
|
|
171
174
|
|
|
172
175
|
**Warm kernel (kill the interpreter boot).** Each `runCode` starts a **fresh** interpreter, paying the
|
|
173
|
-
CPython boot (~
|
|
176
|
+
CPython boot (~12 ms) every call. When you run many cells that share state (a REPL, a notebook, an
|
|
174
177
|
agent's tool loop), open a `kernel()`: ONE warm interpreter in a long-lived box, fed cells over a pipe.
|
|
175
178
|
In-memory state persists across cells and the per-cell cost drops from ~16 ms to **sub-millisecond**
|
|
176
179
|
(~300x). Same rich `results` capture as `runCode`.
|
|
@@ -208,8 +211,9 @@ clear error otherwise). The Python binding uses the stdlib `tarfile` and has no
|
|
|
208
211
|
|
|
209
212
|
kern is a **kernel-boundary** sandbox for **your own or semi-trusted** code (CI, dev, edge, your
|
|
210
213
|
agents' code). Its seccomp filter is a **denylist**: right for semi-trusted agent code, **not** a hard
|
|
211
|
-
boundary against deliberately hostile multi-tenant code. For that, reach for a microVM (Firecracker
|
|
212
|
-
gVisor. See the project's
|
|
214
|
+
boundary against deliberately hostile multi-tenant code. For that, reach for a microVM (Firecracker /
|
|
215
|
+
Kata) or gVisor. A deny-by-default allowlist mode is on the roadmap. See the project's
|
|
216
|
+
[SECURITY.md](https://github.com/getkern/kern/blob/main/SECURITY.md).
|
|
213
217
|
|
|
214
218
|
## License
|
|
215
219
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kern-sandbox",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.9",
|
|
4
|
+
"description": "kern is a fast, rootless, daemonless Linux sandbox runtime; kern-sandbox is its Node/TypeScript binding. Run untrusted or agent-generated code (Python/JS/Bash) in a real, kernel-enforced box, ~2 ms, no cloud, no account, no VM.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sandbox",
|
|
7
7
|
"kern",
|