@ai-ecoverse/slicc-kernel 1.195.3 → 1.195.4

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.
@@ -5109,7 +5109,7 @@ function satisfies(version, range2) {
5109
5109
  }
5110
5110
 
5111
5111
  // src/version.ts
5112
- var KERNEL_VERSION = true ? "1.195.3" : "0.0.0-dev";
5112
+ var KERNEL_VERSION = true ? "1.195.4" : "0.0.0-dev";
5113
5113
  var OS_RELEASE = "6.0.0-slicc";
5114
5114
  function procVersion() {
5115
5115
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -18989,6 +18989,10 @@ var RAN_ONCE = "sudo: ran once; this command line can't be recorded as always";
18989
18989
  var ROOT_ONLY_MAX = 64;
18990
18990
  var OPERANDS_MAX = 256;
18991
18991
  var PATH_MAX = 4096;
18992
+ var LINKS_MAX = 40;
18993
+ function heldByRoot(st) {
18994
+ return st?.uid === 0 && (st.isSymbolicLink || (st.mode & 18) === 0);
18995
+ }
18992
18996
  function userWritable(bound3) {
18993
18997
  const files = Object.entries(bound3).map(([path, hex5]) => ({ path, sha256: hex5 }));
18994
18998
  return files.length > 0 ? { userWritable: files } : {};
@@ -19246,6 +19250,31 @@ var Sudo = class {
19246
19250
  }
19247
19251
  return true;
19248
19252
  }
19253
+ async trustedThrough(path) {
19254
+ const { fs } = this.o;
19255
+ if (!heldByRoot(await fs.lstat("/").catch(() => void 0))) return false;
19256
+ const queue = normalizePath(path).split("/").filter(Boolean);
19257
+ const done4 = [];
19258
+ for (let hops = 0; queue.length > 0; ) {
19259
+ const part = queue.shift();
19260
+ if (part === "." || part === "..") {
19261
+ if (part === "..") done4.pop();
19262
+ continue;
19263
+ }
19264
+ const at = `/${[...done4, part].join("/")}`;
19265
+ const st = await fs.lstat(at).catch(() => void 0);
19266
+ if (!heldByRoot(st)) return false;
19267
+ if (!st?.isSymbolicLink) {
19268
+ done4.push(part);
19269
+ continue;
19270
+ }
19271
+ if (++hops > LINKS_MAX) return false;
19272
+ const target = await fs.readlink(at);
19273
+ if (target.startsWith("/")) done4.length = 0;
19274
+ queue.unshift(...target.split("/").filter(Boolean));
19275
+ }
19276
+ return true;
19277
+ }
19249
19278
  async rootOnly(cwd, args) {
19250
19279
  const { fs } = this.o;
19251
19280
  const found = {};
@@ -36873,7 +36902,7 @@ var Launcher = class {
36873
36902
  const real2 = await this.sudoer.real(path);
36874
36903
  const hex5 = pinned2[real2];
36875
36904
  if (hex5 !== void 0) return { [real2]: hex5 };
36876
- if (await this.sudoer.trusted(real2)) return {};
36905
+ if (await this.sudoer.trustedThrough(path)) return {};
36877
36906
  throw new ChangedError(changedText(real2), real2);
36878
36907
  }
36879
36908
  async pinnedBytes(pin, bytes) {