@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
|
@@ -493,6 +493,35 @@ function normalize(path) {
|
|
|
493
493
|
}
|
|
494
494
|
return `/${out.join("/")}`;
|
|
495
495
|
}
|
|
496
|
+
function physical(fs, path) {
|
|
497
|
+
let done = [];
|
|
498
|
+
let todo = path.split("/").filter((part) => part !== "" && part !== ".");
|
|
499
|
+
let hops = 0;
|
|
500
|
+
while (todo.length > 0) {
|
|
501
|
+
const part = todo.shift();
|
|
502
|
+
if (part === "..") {
|
|
503
|
+
done.pop();
|
|
504
|
+
continue;
|
|
505
|
+
}
|
|
506
|
+
if (!todo.includes("..")) {
|
|
507
|
+
done.push(part);
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
const at = `/${[...done, part].join("/")}`;
|
|
511
|
+
const st = fs.lstat(at);
|
|
512
|
+
if (st.isSymbolicLink) {
|
|
513
|
+
if (++hops > MAX_LINKS) throw new WasiError("ELOOP");
|
|
514
|
+
const target = fs.readlink(at);
|
|
515
|
+
if (target.startsWith("/")) done = [];
|
|
516
|
+
todo = [...target.split("/").filter((p) => p !== "" && p !== "."), ...todo];
|
|
517
|
+
} else if (!st.isDirectory) {
|
|
518
|
+
throw new WasiError("ENOTDIR");
|
|
519
|
+
} else {
|
|
520
|
+
done.push(part);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return `/${done.join("/")}`;
|
|
524
|
+
}
|
|
496
525
|
function resolveUnder(dir, path) {
|
|
497
526
|
return normalize(path.startsWith("/") ? path : `${dir}/${path}`);
|
|
498
527
|
}
|
|
@@ -588,7 +617,7 @@ function pinnedIo(bridge, handle, mutating) {
|
|
|
588
617
|
truncate: (p, size) => mutating(() => truncate(p, size))
|
|
589
618
|
};
|
|
590
619
|
}
|
|
591
|
-
var WasiError, FileBuffer, LocalFile, MISS_TTL_MS;
|
|
620
|
+
var WasiError, FileBuffer, LocalFile, MAX_LINKS, MISS_TTL_MS;
|
|
592
621
|
var init_wasi_files = __esm({
|
|
593
622
|
"src/process/wasi/wasi-files.ts"() {
|
|
594
623
|
"use strict";
|
|
@@ -776,6 +805,7 @@ var init_wasi_files = __esm({
|
|
|
776
805
|
this.buffer.flush();
|
|
777
806
|
}
|
|
778
807
|
};
|
|
808
|
+
MAX_LINKS = 40;
|
|
779
809
|
MISS_TTL_MS = 20;
|
|
780
810
|
}
|
|
781
811
|
});
|
|
@@ -1429,8 +1459,8 @@ var init_wasi_fds = __esm({
|
|
|
1429
1459
|
}
|
|
1430
1460
|
}
|
|
1431
1461
|
resolve(dirfd, path) {
|
|
1432
|
-
|
|
1433
|
-
return
|
|
1462
|
+
const joined2 = path.startsWith("/") ? path : `${this.dir(dirfd).path}/${path}`;
|
|
1463
|
+
return joined2.split("/").includes("..") ? physical(this.fs, joined2) : normalize(joined2);
|
|
1434
1464
|
}
|
|
1435
1465
|
open(path, oflags, rights, fdflags) {
|
|
1436
1466
|
const device2 = deviceOf(path);
|
|
@@ -8805,9 +8835,9 @@ function procfsBridge(fs, tree) {
|
|
|
8805
8835
|
}
|
|
8806
8836
|
};
|
|
8807
8837
|
const readOnly = (paths, run) => {
|
|
8808
|
-
const
|
|
8838
|
+
const physical2 = shadowing();
|
|
8809
8839
|
for (const [p, follow2] of paths) {
|
|
8810
|
-
if (inProc(p) ||
|
|
8840
|
+
if (inProc(p) || physical2 && toProc(p, follow2) !== void 0) throw syncError("EROFS", p);
|
|
8811
8841
|
}
|
|
8812
8842
|
return run();
|
|
8813
8843
|
};
|