@ai-ecoverse/slicc-kernel 1.196.28 → 1.196.29

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.
@@ -9383,7 +9383,7 @@ var init_version = __esm({
9383
9383
  "src/version.ts"() {
9384
9384
  "use strict";
9385
9385
  init_captured_globals();
9386
- KERNEL_VERSION = true ? "1.196.28" : "0.0.0-dev";
9386
+ KERNEL_VERSION = true ? "1.196.29" : "0.0.0-dev";
9387
9387
  OS_RELEASE = "6.0.0-slicc";
9388
9388
  }
9389
9389
  });
@@ -9382,7 +9382,7 @@ var init_version = __esm({
9382
9382
  "src/version.ts"() {
9383
9383
  "use strict";
9384
9384
  init_captured_globals();
9385
- KERNEL_VERSION = true ? "1.196.28" : "0.0.0-dev";
9385
+ KERNEL_VERSION = true ? "1.196.29" : "0.0.0-dev";
9386
9386
  OS_RELEASE = "6.0.0-slicc";
9387
9387
  }
9388
9388
  });
package/dist/node.js CHANGED
@@ -7757,7 +7757,7 @@ function satisfies(version, range2) {
7757
7757
  }
7758
7758
 
7759
7759
  // src/version.ts
7760
- var KERNEL_VERSION = true ? "1.196.28" : "0.0.0-dev";
7760
+ var KERNEL_VERSION = true ? "1.196.29" : "0.0.0-dev";
7761
7761
  var OS_RELEASE = "6.0.0-slicc";
7762
7762
  function procVersion() {
7763
7763
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -20640,25 +20640,41 @@ var Sudo = class {
20640
20640
  else if (part !== ".") at = joinName(at, part);
20641
20641
  }
20642
20642
  }
20643
- async trustedThrough(path, destination, fs = this.o.fs, uid = 0) {
20644
- if (!heldBy(await fs.lstat("/").catch(() => void 0), uid)) return false;
20643
+ trustedThrough(path, destination, fs = this.o.fs, uid = 0) {
20644
+ return this.heldRoute(path, fs, { uid, destination });
20645
+ }
20646
+ async heldRoute(path, fs, {
20647
+ uid = 0,
20648
+ destination,
20649
+ allowMissing = false
20650
+ }) {
20651
+ const root = await fs.lstat("/").catch(() => void 0);
20652
+ if (!root?.isDirectory || !heldBy(root, uid)) return false;
20645
20653
  const queue = path.split("/").filter(Boolean);
20646
20654
  const done4 = [];
20647
20655
  for (let hops = 0; queue.length > 0; ) {
20648
20656
  const part = queue.shift();
20649
- if (part === "." || part === "..") {
20650
- if (part === "..") done4.pop();
20657
+ if (part === ".") continue;
20658
+ if (part === "..") {
20659
+ done4.pop();
20651
20660
  continue;
20652
20661
  }
20653
20662
  const at = `/${[...done4, part].join("/")}`;
20654
- const st = await fs.lstat(at).catch(() => void 0);
20663
+ let st;
20664
+ try {
20665
+ st = await fs.lstat(at);
20666
+ } catch (err) {
20667
+ return allowMissing && err?.code === "ENOENT" && !queue.includes("..");
20668
+ }
20655
20669
  if (!heldBy(st, uid)) return false;
20656
- if (!st?.isSymbolicLink) {
20670
+ if (!st.isSymbolicLink) {
20671
+ if (queue.length && !st.isDirectory) return false;
20657
20672
  done4.push(part);
20658
20673
  continue;
20659
20674
  }
20660
20675
  if (++hops > MAX_LINKS) return false;
20661
- const target = await fs.readlink(at);
20676
+ const target = await fs.readlink(at).catch(() => void 0);
20677
+ if (!target) return false;
20662
20678
  if (target.startsWith("/")) done4.length = 0;
20663
20679
  queue.unshift(...target.split("/").filter(Boolean));
20664
20680
  }
@@ -20834,7 +20850,7 @@ var Sudo = class {
20834
20850
  {
20835
20851
  real: (at) => this.real(at),
20836
20852
  trusted: (at) => this.trustedThrough(at, void 0, fs),
20837
- trustedEnvPath: (at) => this.trusted(at, true),
20853
+ trustedEnvPath: (at) => this.heldRoute(at, this.o.fs, { allowMissing: true }),
20838
20854
  read: (at) => fs.readFileBuffer(at)
20839
20855
  },
20840
20856
  snapshots
@@ -20852,7 +20868,7 @@ var Sudo = class {
20852
20868
  const { path } = rule2.cmnd;
20853
20869
  reads.resetSelection();
20854
20870
  const bound3 = await this.bound(path, "/", path, pid, reads);
20855
- if (bound3) return Object.keys(bound3.hashes).length > 0;
20871
+ if (bound3) return bound3.writableEnvPath === true || Object.keys(bound3.hashes).length > 0;
20856
20872
  return !await this.trusted(path, true);
20857
20873
  }
20858
20874
  async searched(fs, cred, path) {