@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.
@@ -3813,8 +3813,11 @@ var init_procfs = __esm({
3813
3813
  });
3814
3814
 
3815
3815
  // src/process/realm-user.ts
3816
- function ownByCaller(Fs, cred) {
3817
- const owner = { uid: cred?.euid ?? 0, gid: cred?.egid ?? 0 };
3816
+ function credAbi(glue) {
3817
+ return CRED_ABI.test(glue);
3818
+ }
3819
+ function ownByCaller(Fs, cred, abi = true) {
3820
+ const owner = abi ? { uid: cred?.euid ?? 0, gid: cred?.egid ?? 0 } : { ...LEGACY_OWNER };
3818
3821
  const { stat, fstat } = Fs;
3819
3822
  const owned = (attr2) => ({ ...attr2, uid: owner.uid, gid: owner.gid });
3820
3823
  if (typeof stat === "function") {
@@ -3823,9 +3826,12 @@ function ownByCaller(Fs, cred) {
3823
3826
  if (typeof fstat === "function") Fs.fstat = (fd) => owned(fstat.call(Fs, fd));
3824
3827
  return owner;
3825
3828
  }
3829
+ var LEGACY_OWNER, CRED_ABI;
3826
3830
  var init_realm_user = __esm({
3827
3831
  "src/process/realm-user.ts"() {
3828
3832
  "use strict";
3833
+ LEGACY_OWNER = Object.freeze({ uid: 1e3, gid: 1e3 });
3834
+ CRED_ABI = /\bslicc_cred_js\b/;
3829
3835
  }
3830
3836
  });
3831
3837
 
@@ -4194,7 +4200,7 @@ async function runWasmProcess(init, port2, deps = {}) {
4194
4200
  describeFork: () => describeForFork(running.FS, sys, streams, livePath),
4195
4201
  inherit: (actions) => describeInherited(running.FS, sys, streams, livePath, actions),
4196
4202
  stdioPromoter: () => vfsPromoter(running.FS, sys, streams, livePath),
4197
- owner: ownByCaller(running.FS, init.cred)
4203
+ owner: ownByCaller(running.FS, init.cred, credAbi(init.program.glue))
4198
4204
  });
4199
4205
  running.sliccKernel.http = createHttpKernel(transport);
4200
4206
  running.sliccKernel.hostname = hostnameOf(init.env);
@@ -11128,19 +11134,35 @@ function hide(target, names) {
11128
11134
  }
11129
11135
  }
11130
11136
  }
11137
+ function vacate(target, names) {
11138
+ for (const name2 of names) {
11139
+ for (let at = target; at && at !== Object.prototype; ) {
11140
+ if (Object.getOwnPropertyDescriptor(at, name2)?.configurable) Reflect.deleteProperty(at, name2);
11141
+ at = Object.getPrototypeOf(at);
11142
+ }
11143
+ Reflect.defineProperty(target, name2, {
11144
+ value: void 0,
11145
+ writable: true,
11146
+ enumerable: false,
11147
+ configurable: true
11148
+ });
11149
+ if (Reflect.get(target, name2) !== void 0) {
11150
+ throw new Error(`slicc-kernel: cannot withhold ${name2} from a JS program`);
11151
+ }
11152
+ }
11153
+ }
11131
11154
  function lockdown(scope2 = globalThis) {
11132
11155
  hide(scope2, BLOCKED_GLOBALS);
11156
+ vacate(scope2, OPEN_SLOTS);
11133
11157
  const navigator = scope2.navigator;
11134
11158
  if (navigator && typeof navigator === "object") hide(navigator, BLOCKED_NAVIGATOR);
11135
11159
  }
11136
- var BLOCKED_GLOBALS, BLOCKED_NAVIGATOR;
11160
+ var BLOCKED_GLOBALS, BLOCKED_NAVIGATOR, OPEN_SLOTS;
11137
11161
  var init_lockdown = __esm({
11138
11162
  "src/process/js/lockdown.ts"() {
11139
11163
  "use strict";
11140
11164
  BLOCKED_GLOBALS = [
11141
- "fetch",
11142
11165
  "XMLHttpRequest",
11143
- "WebSocket",
11144
11166
  "WebSocketStream",
11145
11167
  "WebTransport",
11146
11168
  "EventSource",
@@ -11155,6 +11177,7 @@ var init_lockdown = __esm({
11155
11177
  "close"
11156
11178
  ];
11157
11179
  BLOCKED_NAVIGATOR = ["storage", "locks", "serviceWorker"];
11180
+ OPEN_SLOTS = ["fetch", "WebSocket"];
11158
11181
  }
11159
11182
  });
11160
11183