sandboxedjs 0.1.5 → 0.1.6
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/package.json +1 -1
package/README.md
CHANGED
|
@@ -652,6 +652,25 @@ Honest list of what does not work:
|
|
|
652
652
|
This affects older toolchains — Vite 4 and its contemporaries. Current Vite ships its Rust
|
|
653
653
|
pipeline as WebAssembly and runs fine, dev server included, as do Express, Koa, Fastify-style
|
|
654
654
|
apps and plain `http` servers.
|
|
655
|
+
- **HTTP request bodies into the container are text, not bytes.** Nodepod decodes a request body
|
|
656
|
+
as UTF-8 on its way to an in-container server, so any byte above `0x7f` is replaced: five bytes
|
|
657
|
+
containing `0x89` and `0xff` arrive as nine. Uploading a JPEG or an MP4 by POSTing it to a
|
|
658
|
+
server running inside the sandbox produces a file of roughly the right size that will not open,
|
|
659
|
+
and reports no error. This affects `box.request()`, `box.expose()` and the request proxy alike.
|
|
660
|
+
|
|
661
|
+
Write the file instead — `box.fs.writeFile(path, bytes)` takes a `Uint8Array` and is exact,
|
|
662
|
+
which the binary round-trip tests assert byte for byte. To accept an upload from a browser,
|
|
663
|
+
receive it in *your* server and write the bytes into the container:
|
|
664
|
+
|
|
665
|
+
```js
|
|
666
|
+
// Express on the host, sandboxedjs holding the workspace.
|
|
667
|
+
app.post("/upload", async (req, res) => {
|
|
668
|
+
await box.fs.writeFile(`/workspace/uploads/${req.file.originalname}`, req.file.buffer);
|
|
669
|
+
res.json({ ok: true });
|
|
670
|
+
});
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
Text bodies — JSON APIs, form fields, GraphQL — are unaffected.
|
|
655
674
|
- **Python is MicroPython**, so C extensions (`numpy`, `pandas`, `cryptography`) are unavailable.
|
|
656
675
|
- **No real sockets.** HTTP servers work through the request proxy; raw TCP/UDP does not.
|
|
657
676
|
- **No real processes.** Processes are cooperative async tasks: `kill -9` cannot interrupt a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sandboxedjs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "A Linux-like container that runs entirely inside Node.js — POSIX shell, ~140 coreutils, Node.js and Python runtimes, virtual filesystem and networking. No Docker, no VM, no native modules.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|