@ai-ecoverse/slicc-kernel 1.56.1 → 1.56.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/README.md +2 -0
- package/dist/kernel-worker.js +30 -2
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +35 -5
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +30 -2
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +35 -5
- package/dist/process-worker.js.map +3 -3
- package/package.json +1 -1
package/dist/process-worker.js
CHANGED
|
@@ -4472,6 +4472,35 @@ function normalize(path) {
|
|
|
4472
4472
|
}
|
|
4473
4473
|
return `/${out.join("/")}`;
|
|
4474
4474
|
}
|
|
4475
|
+
function physical(fs, path) {
|
|
4476
|
+
let done = [];
|
|
4477
|
+
let todo = path.split("/").filter((part) => part !== "" && part !== ".");
|
|
4478
|
+
let hops = 0;
|
|
4479
|
+
while (todo.length > 0) {
|
|
4480
|
+
const part = todo.shift();
|
|
4481
|
+
if (part === "..") {
|
|
4482
|
+
done.pop();
|
|
4483
|
+
continue;
|
|
4484
|
+
}
|
|
4485
|
+
if (!todo.includes("..")) {
|
|
4486
|
+
done.push(part);
|
|
4487
|
+
continue;
|
|
4488
|
+
}
|
|
4489
|
+
const at = `/${[...done, part].join("/")}`;
|
|
4490
|
+
const st = fs.lstat(at);
|
|
4491
|
+
if (st.isSymbolicLink) {
|
|
4492
|
+
if (++hops > MAX_LINKS) throw new WasiError("ELOOP");
|
|
4493
|
+
const target = fs.readlink(at);
|
|
4494
|
+
if (target.startsWith("/")) done = [];
|
|
4495
|
+
todo = [...target.split("/").filter((p) => p !== "" && p !== "."), ...todo];
|
|
4496
|
+
} else if (!st.isDirectory) {
|
|
4497
|
+
throw new WasiError("ENOTDIR");
|
|
4498
|
+
} else {
|
|
4499
|
+
done.push(part);
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
return `/${done.join("/")}`;
|
|
4503
|
+
}
|
|
4475
4504
|
function resolveUnder(dir, path) {
|
|
4476
4505
|
return normalize(path.startsWith("/") ? path : `${dir}/${path}`);
|
|
4477
4506
|
}
|
|
@@ -4567,7 +4596,7 @@ function pinnedIo2(bridge, handle, mutating) {
|
|
|
4567
4596
|
truncate: (p, size) => mutating(() => truncate(p, size))
|
|
4568
4597
|
};
|
|
4569
4598
|
}
|
|
4570
|
-
var WasiError, FileBuffer, LocalFile, MISS_TTL_MS;
|
|
4599
|
+
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS;
|
|
4571
4600
|
var init_wasi_files = __esm({
|
|
4572
4601
|
"src/process/wasi/wasi-files.ts"() {
|
|
4573
4602
|
"use strict";
|
|
@@ -4755,6 +4784,7 @@ var init_wasi_files = __esm({
|
|
|
4755
4784
|
this.buffer.flush();
|
|
4756
4785
|
}
|
|
4757
4786
|
};
|
|
4787
|
+
MAX_LINKS = 40;
|
|
4758
4788
|
MISS_TTL_MS = 20;
|
|
4759
4789
|
}
|
|
4760
4790
|
});
|
|
@@ -5220,8 +5250,8 @@ var init_wasi_fds = __esm({
|
|
|
5220
5250
|
}
|
|
5221
5251
|
}
|
|
5222
5252
|
resolve(dirfd, path) {
|
|
5223
|
-
|
|
5224
|
-
return
|
|
5253
|
+
const joined2 = path.startsWith("/") ? path : `${this.dir(dirfd).path}/${path}`;
|
|
5254
|
+
return joined2.split("/").includes("..") ? physical(this.fs, joined2) : normalize(joined2);
|
|
5225
5255
|
}
|
|
5226
5256
|
open(path, oflags, rights, fdflags) {
|
|
5227
5257
|
const device2 = deviceOf(path);
|
|
@@ -6892,9 +6922,9 @@ function procfsBridge(fs, tree) {
|
|
|
6892
6922
|
}
|
|
6893
6923
|
};
|
|
6894
6924
|
const readOnly = (paths, run) => {
|
|
6895
|
-
const
|
|
6925
|
+
const physical2 = shadowing();
|
|
6896
6926
|
for (const [p, follow2] of paths) {
|
|
6897
|
-
if (inProc(p) ||
|
|
6927
|
+
if (inProc(p) || physical2 && toProc(p, follow2) !== void 0) throw syncError("EROFS", p);
|
|
6898
6928
|
}
|
|
6899
6929
|
return run();
|
|
6900
6930
|
};
|