@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.
@@ -9998,7 +9998,7 @@ function satisfies(version, range2) {
9998
9998
  }
9999
9999
 
10000
10000
  // src/version.ts
10001
- var KERNEL_VERSION = true ? "1.196.28" : "0.0.0-dev";
10001
+ var KERNEL_VERSION = true ? "1.196.29" : "0.0.0-dev";
10002
10002
  var OS_RELEASE = "6.0.0-slicc";
10003
10003
  function procVersion() {
10004
10004
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -23995,25 +23995,41 @@ var Sudo = class {
23995
23995
  else if (part !== ".") at = joinName(at, part);
23996
23996
  }
23997
23997
  }
23998
- async trustedThrough(path, destination, fs = this.o.fs, uid = 0) {
23999
- if (!heldBy(await fs.lstat("/").catch(() => void 0), uid)) return false;
23998
+ trustedThrough(path, destination, fs = this.o.fs, uid = 0) {
23999
+ return this.heldRoute(path, fs, { uid, destination });
24000
+ }
24001
+ async heldRoute(path, fs, {
24002
+ uid = 0,
24003
+ destination,
24004
+ allowMissing = false
24005
+ }) {
24006
+ const root = await fs.lstat("/").catch(() => void 0);
24007
+ if (!root?.isDirectory || !heldBy(root, uid)) return false;
24000
24008
  const queue = path.split("/").filter(Boolean);
24001
24009
  const done5 = [];
24002
24010
  for (let hops = 0; queue.length > 0; ) {
24003
24011
  const part = queue.shift();
24004
- if (part === "." || part === "..") {
24005
- if (part === "..") done5.pop();
24012
+ if (part === ".") continue;
24013
+ if (part === "..") {
24014
+ done5.pop();
24006
24015
  continue;
24007
24016
  }
24008
24017
  const at = `/${[...done5, part].join("/")}`;
24009
- const st = await fs.lstat(at).catch(() => void 0);
24018
+ let st;
24019
+ try {
24020
+ st = await fs.lstat(at);
24021
+ } catch (err) {
24022
+ return allowMissing && err?.code === "ENOENT" && !queue.includes("..");
24023
+ }
24010
24024
  if (!heldBy(st, uid)) return false;
24011
- if (!st?.isSymbolicLink) {
24025
+ if (!st.isSymbolicLink) {
24026
+ if (queue.length && !st.isDirectory) return false;
24012
24027
  done5.push(part);
24013
24028
  continue;
24014
24029
  }
24015
24030
  if (++hops > MAX_LINKS) return false;
24016
- const target = await fs.readlink(at);
24031
+ const target = await fs.readlink(at).catch(() => void 0);
24032
+ if (!target) return false;
24017
24033
  if (target.startsWith("/")) done5.length = 0;
24018
24034
  queue.unshift(...target.split("/").filter(Boolean));
24019
24035
  }
@@ -24189,7 +24205,7 @@ var Sudo = class {
24189
24205
  {
24190
24206
  real: (at) => this.real(at),
24191
24207
  trusted: (at) => this.trustedThrough(at, void 0, fs),
24192
- trustedEnvPath: (at) => this.trusted(at, true),
24208
+ trustedEnvPath: (at) => this.heldRoute(at, this.o.fs, { allowMissing: true }),
24193
24209
  read: (at) => fs.readFileBuffer(at)
24194
24210
  },
24195
24211
  snapshots
@@ -24207,7 +24223,7 @@ var Sudo = class {
24207
24223
  const { path } = rule.cmnd;
24208
24224
  reads.resetSelection();
24209
24225
  const bound3 = await this.bound(path, "/", path, pid, reads);
24210
- if (bound3) return Object.keys(bound3.hashes).length > 0;
24226
+ if (bound3) return bound3.writableEnvPath === true || Object.keys(bound3.hashes).length > 0;
24211
24227
  return !await this.trusted(path, true);
24212
24228
  }
24213
24229
  async searched(fs, cred, path) {