kern-sandbox 0.2.1 → 0.2.2
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/index.js +14 -2
- package/package.json +1 -1
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.2.
|
|
39
|
+
const VERSION = "0.2.2";
|
|
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
|
|
@@ -980,7 +980,9 @@ const KERN_OOM_MARKER = "killed by the kernel's OOM killer";
|
|
|
980
980
|
* kern's own OOM sentence to stderr and was then stopped from outside came back `fault=oom` while the
|
|
981
981
|
* third byte said 0 - the inverted verdict the byte exists to close, re-opened by the sandboxed code in
|
|
982
982
|
* one line. Preferring the byte was not enough on its own: an outside kill takes the box BEFORE
|
|
983
|
-
* teardown, so a new binary also arrives with no byte.
|
|
983
|
+
* teardown, so a new binary also arrives with no byte. The remaining bound is measured: against v0.9.32
|
|
984
|
+
* a cell that writes the sentence and then chooses `exit 137` reports `oom`, and without the sentence
|
|
985
|
+
* `killed`. Mirrors `_oom_verdict`. */
|
|
984
986
|
function oomVerdict(oomSignal, stderr, kernWrotePayload) {
|
|
985
987
|
if (oomSignal !== null && oomSignal !== undefined) return oomSignal === 1;
|
|
986
988
|
if (!kernWrotePayload) return false;
|
|
@@ -1469,6 +1471,16 @@ class Sandbox {
|
|
|
1469
1471
|
* that will never exist would both litter the workspace and collide with itself. A dry argv is for
|
|
1470
1472
|
* COMPARING, never for running. */
|
|
1471
1473
|
_baseArgv(name, { network, timeoutS, isSetup = false, dry = false }) {
|
|
1474
|
+
// IDENTITY IS RE-ASSERTED PER BOX, not once per Sandbox, and an external reviewer is the reason. He
|
|
1475
|
+
// overwrote the verified binary IN PLACE with `/bin/true` while a Sandbox was open: the next call
|
|
1476
|
+
// correctly refused to call an empty run a success, and the message it refused with quoted the
|
|
1477
|
+
// version from the FIRST verification - stating that a file which now prints `true (GNU coreutils)
|
|
1478
|
+
// 9.4` had "reported 'kern v0.9.32-48-gb578943'". The verdict was right and the sentence was false.
|
|
1479
|
+
// Re-verifying here rather than repairing the sentence: the binary about to run was no longer the
|
|
1480
|
+
// binary that was checked. The memo is keyed on (realpath, dev, ino, size, mtimeMs), so an unchanged
|
|
1481
|
+
// file costs one stat and a map lookup, and a changed one pays a `--version` and is refused by name.
|
|
1482
|
+
// Mirrors the same call in `_base_argv`.
|
|
1483
|
+
if (!dry) verifyIsKern(this._kern);
|
|
1472
1484
|
const argv = [
|
|
1473
1485
|
this._kern, "box", name, "--image", this.image, "--ro",
|
|
1474
1486
|
"-v", `${this._ws}:${WORKSPACE}`, "--workdir", WORKSPACE,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kern-sandbox",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|