@ai-ecoverse/slicc-kernel 1.52.0 → 1.53.1
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 -2
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +9 -5
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +29 -23
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +9 -5
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +29 -6
- package/dist/process-worker.js.map +2 -2
- package/package.json +2 -1
|
@@ -42,19 +42,35 @@ function hide(target, names) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
function vacate(target, names) {
|
|
46
|
+
for (const name2 of names) {
|
|
47
|
+
for (let at = target; at && at !== Object.prototype; ) {
|
|
48
|
+
if (Object.getOwnPropertyDescriptor(at, name2)?.configurable) Reflect.deleteProperty(at, name2);
|
|
49
|
+
at = Object.getPrototypeOf(at);
|
|
50
|
+
}
|
|
51
|
+
Reflect.defineProperty(target, name2, {
|
|
52
|
+
value: void 0,
|
|
53
|
+
writable: true,
|
|
54
|
+
enumerable: false,
|
|
55
|
+
configurable: true
|
|
56
|
+
});
|
|
57
|
+
if (Reflect.get(target, name2) !== void 0) {
|
|
58
|
+
throw new Error(`slicc-kernel: cannot withhold ${name2} from a JS program`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
45
62
|
function lockdown(scope2 = globalThis) {
|
|
46
63
|
hide(scope2, BLOCKED_GLOBALS);
|
|
64
|
+
vacate(scope2, OPEN_SLOTS);
|
|
47
65
|
const navigator = scope2.navigator;
|
|
48
66
|
if (navigator && typeof navigator === "object") hide(navigator, BLOCKED_NAVIGATOR);
|
|
49
67
|
}
|
|
50
|
-
var BLOCKED_GLOBALS, BLOCKED_NAVIGATOR;
|
|
68
|
+
var BLOCKED_GLOBALS, BLOCKED_NAVIGATOR, OPEN_SLOTS;
|
|
51
69
|
var init_lockdown = __esm({
|
|
52
70
|
"src/process/js/lockdown.ts"() {
|
|
53
71
|
"use strict";
|
|
54
72
|
BLOCKED_GLOBALS = [
|
|
55
|
-
"fetch",
|
|
56
73
|
"XMLHttpRequest",
|
|
57
|
-
"WebSocket",
|
|
58
74
|
"WebSocketStream",
|
|
59
75
|
"WebTransport",
|
|
60
76
|
"EventSource",
|
|
@@ -69,6 +85,7 @@ var init_lockdown = __esm({
|
|
|
69
85
|
"close"
|
|
70
86
|
];
|
|
71
87
|
BLOCKED_NAVIGATOR = ["storage", "locks", "serviceWorker"];
|
|
88
|
+
OPEN_SLOTS = ["fetch", "WebSocket"];
|
|
72
89
|
}
|
|
73
90
|
});
|
|
74
91
|
|
|
@@ -8044,8 +8061,11 @@ var init_procfs = __esm({
|
|
|
8044
8061
|
});
|
|
8045
8062
|
|
|
8046
8063
|
// src/process/realm-user.ts
|
|
8047
|
-
function
|
|
8048
|
-
|
|
8064
|
+
function credAbi(glue) {
|
|
8065
|
+
return CRED_ABI.test(glue);
|
|
8066
|
+
}
|
|
8067
|
+
function ownByCaller(Fs, cred, abi = true) {
|
|
8068
|
+
const owner = abi ? { uid: cred?.euid ?? 0, gid: cred?.egid ?? 0 } : { ...LEGACY_OWNER };
|
|
8049
8069
|
const { stat, fstat } = Fs;
|
|
8050
8070
|
const owned = (attr2) => ({ ...attr2, uid: owner.uid, gid: owner.gid });
|
|
8051
8071
|
if (typeof stat === "function") {
|
|
@@ -8054,9 +8074,12 @@ function ownByCaller(Fs, cred) {
|
|
|
8054
8074
|
if (typeof fstat === "function") Fs.fstat = (fd) => owned(fstat.call(Fs, fd));
|
|
8055
8075
|
return owner;
|
|
8056
8076
|
}
|
|
8077
|
+
var LEGACY_OWNER, CRED_ABI;
|
|
8057
8078
|
var init_realm_user = __esm({
|
|
8058
8079
|
"src/process/realm-user.ts"() {
|
|
8059
8080
|
"use strict";
|
|
8081
|
+
LEGACY_OWNER = Object.freeze({ uid: 1e3, gid: 1e3 });
|
|
8082
|
+
CRED_ABI = /\bslicc_cred_js\b/;
|
|
8060
8083
|
}
|
|
8061
8084
|
});
|
|
8062
8085
|
|
|
@@ -8425,7 +8448,7 @@ async function runWasmProcess(init, port3, deps = {}) {
|
|
|
8425
8448
|
describeFork: () => describeForFork(running.FS, sys, streams, livePath),
|
|
8426
8449
|
inherit: (actions) => describeInherited(running.FS, sys, streams, livePath, actions),
|
|
8427
8450
|
stdioPromoter: () => vfsPromoter(running.FS, sys, streams, livePath),
|
|
8428
|
-
owner: ownByCaller(running.FS, init.cred)
|
|
8451
|
+
owner: ownByCaller(running.FS, init.cred, credAbi(init.program.glue))
|
|
8429
8452
|
});
|
|
8430
8453
|
running.sliccKernel.http = createHttpKernel(transport);
|
|
8431
8454
|
running.sliccKernel.hostname = hostnameOf(init.env);
|
|
@@ -11302,23 +11325,6 @@ var NODE_SLOTS = [
|
|
|
11302
11325
|
"setImmediate",
|
|
11303
11326
|
"clearImmediate"
|
|
11304
11327
|
];
|
|
11305
|
-
function vacate(target, names) {
|
|
11306
|
-
for (const name2 of names) {
|
|
11307
|
-
for (let at = target; at && at !== Object.prototype; ) {
|
|
11308
|
-
if (Object.getOwnPropertyDescriptor(at, name2)?.configurable) Reflect.deleteProperty(at, name2);
|
|
11309
|
-
at = Object.getPrototypeOf(at);
|
|
11310
|
-
}
|
|
11311
|
-
Reflect.defineProperty(target, name2, {
|
|
11312
|
-
value: void 0,
|
|
11313
|
-
writable: true,
|
|
11314
|
-
enumerable: false,
|
|
11315
|
-
configurable: true
|
|
11316
|
-
});
|
|
11317
|
-
if (Reflect.get(target, name2) !== void 0) {
|
|
11318
|
-
throw new Error(`slicc-kernel: cannot withhold ${name2} from a JS program`);
|
|
11319
|
-
}
|
|
11320
|
-
}
|
|
11321
|
-
}
|
|
11322
11328
|
function refused(specifier) {
|
|
11323
11329
|
return Object.assign(new Error(`slicc-kernel: a JS program cannot import ${specifier}`), {
|
|
11324
11330
|
code: "ERR_ACCESS_DENIED"
|