@ai-ecoverse/slicc-kernel 1.53.0 → 1.53.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.
@@ -8061,8 +8061,11 @@ var init_procfs = __esm({
8061
8061
  });
8062
8062
 
8063
8063
  // src/process/realm-user.ts
8064
- function ownByCaller(Fs, cred) {
8065
- const owner = { uid: cred?.euid ?? 0, gid: cred?.egid ?? 0 };
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 };
8066
8069
  const { stat, fstat } = Fs;
8067
8070
  const owned = (attr2) => ({ ...attr2, uid: owner.uid, gid: owner.gid });
8068
8071
  if (typeof stat === "function") {
@@ -8071,9 +8074,12 @@ function ownByCaller(Fs, cred) {
8071
8074
  if (typeof fstat === "function") Fs.fstat = (fd) => owned(fstat.call(Fs, fd));
8072
8075
  return owner;
8073
8076
  }
8077
+ var LEGACY_OWNER, CRED_ABI;
8074
8078
  var init_realm_user = __esm({
8075
8079
  "src/process/realm-user.ts"() {
8076
8080
  "use strict";
8081
+ LEGACY_OWNER = Object.freeze({ uid: 1e3, gid: 1e3 });
8082
+ CRED_ABI = /\bslicc_cred_js\b/;
8077
8083
  }
8078
8084
  });
8079
8085
 
@@ -8442,7 +8448,7 @@ async function runWasmProcess(init, port3, deps = {}) {
8442
8448
  describeFork: () => describeForFork(running.FS, sys, streams, livePath),
8443
8449
  inherit: (actions) => describeInherited(running.FS, sys, streams, livePath, actions),
8444
8450
  stdioPromoter: () => vfsPromoter(running.FS, sys, streams, livePath),
8445
- owner: ownByCaller(running.FS, init.cred)
8451
+ owner: ownByCaller(running.FS, init.cred, credAbi(init.program.glue))
8446
8452
  });
8447
8453
  running.sliccKernel.http = createHttpKernel(transport);
8448
8454
  running.sliccKernel.hostname = hostnameOf(init.env);
@@ -11319,6 +11325,15 @@ var NODE_SLOTS = [
11319
11325
  "setImmediate",
11320
11326
  "clearImmediate"
11321
11327
  ];
11328
+ function zeroedBuffers(buffer) {
11329
+ const alloc = buffer.alloc.bind(buffer);
11330
+ const fixed = (value2) => ({ value: value2, writable: false, configurable: false });
11331
+ Object.defineProperties(buffer, {
11332
+ allocUnsafe: fixed((size) => alloc(size)),
11333
+ allocUnsafeSlow: fixed((size) => alloc(size)),
11334
+ poolSize: fixed(0)
11335
+ });
11336
+ }
11322
11337
  function refused(specifier) {
11323
11338
  return Object.assign(new Error(`slicc-kernel: a JS program cannot import ${specifier}`), {
11324
11339
  code: "ERR_ACCESS_DENIED"
@@ -11335,6 +11350,7 @@ function refuseModules() {
11335
11350
  });
11336
11351
  }
11337
11352
  function nodeLockdown(scope2 = globalThis) {
11353
+ zeroedBuffers(Buffer);
11338
11354
  lockdown(scope2);
11339
11355
  hide(scope2, NODE_GLOBALS);
11340
11356
  vacate(scope2, NODE_SLOTS);