kern-sandbox 0.2.12 → 0.2.13

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 (2) hide show
  1. package/index.js +18 -2
  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.12";
39
+ const VERSION = "0.2.13";
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
@@ -2812,12 +2812,28 @@ class Kernel {
2812
2812
  "the kernel box was killed, and its memory cap was not enforced here (no cgroup delegation), so no memory limit was in force to attribute it to",
2813
2813
  rc,
2814
2814
  ];
2815
- if (this._sbx.memoryMb !== null)
2815
+ if (this._sbx.memoryMb !== null) {
2816
+ // A BINARY THAT DOES NOT REPORT THE SIGNAL CANNOT HAVE THIS SENTENCE PUT IN ITS MOUTH. MEASURED on
2817
+ // the released 0.9.32, which is what `install.sh` serves today: it writes two of the four teardown
2818
+ // bytes, so `workloadSignal` is null, and a cell that SEGFAULTED and a cell whose syscall the
2819
+ // seccomp filter refused both landed here and were told "an external kill", which is false for
2820
+ // both. The verdict cannot improve without the byte; the sentence can say so.
2821
+ if (kernWrotePayload && workloadSignal === null)
2822
+ return [
2823
+ "killed",
2824
+ "the kernel box was killed and the kernel reported no OOM against its memory cap. THIS kern " +
2825
+ "does not report which signal ended the box (it writes 2 of the 4 teardown bytes), so an " +
2826
+ "external kill, a crash in your own code and a syscall the sandbox refused are " +
2827
+ "indistinguishable from here: a newer kern separates them, and until then read the box's " +
2828
+ "stderr before concluding it was killed from outside",
2829
+ rc,
2830
+ ];
2816
2831
  return [
2817
2832
  "killed",
2818
2833
  "the kernel box was killed and the kernel reported no OOM against its memory cap: an external kill (`kern stop`, a signal, or the host running out of memory), not the box exceeding its own memory",
2819
2834
  rc,
2820
2835
  ];
2836
+ }
2821
2837
  return ["killed", "the kernel box exited", rc];
2822
2838
  }
2823
2839
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kern-sandbox",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
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",