@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.
@@ -8223,7 +8223,7 @@ var init_version = __esm({
8223
8223
  "src/version.ts"() {
8224
8224
  "use strict";
8225
8225
  init_captured_globals();
8226
- KERNEL_VERSION = true ? "1.195.3" : "0.0.0-dev";
8226
+ KERNEL_VERSION = true ? "1.195.4" : "0.0.0-dev";
8227
8227
  OS_RELEASE = "6.0.0-slicc";
8228
8228
  }
8229
8229
  });
@@ -8222,7 +8222,7 @@ var init_version = __esm({
8222
8222
  "src/version.ts"() {
8223
8223
  "use strict";
8224
8224
  init_captured_globals();
8225
- KERNEL_VERSION = true ? "1.195.3" : "0.0.0-dev";
8225
+ KERNEL_VERSION = true ? "1.195.4" : "0.0.0-dev";
8226
8226
  OS_RELEASE = "6.0.0-slicc";
8227
8227
  }
8228
8228
  });
package/dist/node.js CHANGED
@@ -7512,7 +7512,7 @@ function satisfies(version, range2) {
7512
7512
  }
7513
7513
 
7514
7514
  // src/version.ts
7515
- var KERNEL_VERSION = true ? "1.195.3" : "0.0.0-dev";
7515
+ var KERNEL_VERSION = true ? "1.195.4" : "0.0.0-dev";
7516
7516
  var OS_RELEASE = "6.0.0-slicc";
7517
7517
  function procVersion() {
7518
7518
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -19288,6 +19288,10 @@ var RAN_ONCE = "sudo: ran once; this command line can't be recorded as always";
19288
19288
  var ROOT_ONLY_MAX = 64;
19289
19289
  var OPERANDS_MAX = 256;
19290
19290
  var PATH_MAX = 4096;
19291
+ var LINKS_MAX = 40;
19292
+ function heldByRoot(st) {
19293
+ return st?.uid === 0 && (st.isSymbolicLink || (st.mode & 18) === 0);
19294
+ }
19291
19295
  function userWritable(bound3) {
19292
19296
  const files = Object.entries(bound3).map(([path, hex4]) => ({ path, sha256: hex4 }));
19293
19297
  return files.length > 0 ? { userWritable: files } : {};
@@ -19545,6 +19549,31 @@ var Sudo = class {
19545
19549
  }
19546
19550
  return true;
19547
19551
  }
19552
+ async trustedThrough(path) {
19553
+ const { fs } = this.o;
19554
+ if (!heldByRoot(await fs.lstat("/").catch(() => void 0))) return false;
19555
+ const queue = normalizePath(path).split("/").filter(Boolean);
19556
+ const done4 = [];
19557
+ for (let hops = 0; queue.length > 0; ) {
19558
+ const part = queue.shift();
19559
+ if (part === "." || part === "..") {
19560
+ if (part === "..") done4.pop();
19561
+ continue;
19562
+ }
19563
+ const at = `/${[...done4, part].join("/")}`;
19564
+ const st = await fs.lstat(at).catch(() => void 0);
19565
+ if (!heldByRoot(st)) return false;
19566
+ if (!st?.isSymbolicLink) {
19567
+ done4.push(part);
19568
+ continue;
19569
+ }
19570
+ if (++hops > LINKS_MAX) return false;
19571
+ const target = await fs.readlink(at);
19572
+ if (target.startsWith("/")) done4.length = 0;
19573
+ queue.unshift(...target.split("/").filter(Boolean));
19574
+ }
19575
+ return true;
19576
+ }
19548
19577
  async rootOnly(cwd, args) {
19549
19578
  const { fs } = this.o;
19550
19579
  const found = {};
@@ -37251,7 +37280,7 @@ var Launcher = class {
37251
37280
  const real = await this.sudoer.real(path);
37252
37281
  const hex4 = pinned2[real];
37253
37282
  if (hex4 !== void 0) return { [real]: hex4 };
37254
- if (await this.sudoer.trusted(real)) return {};
37283
+ if (await this.sudoer.trustedThrough(path)) return {};
37255
37284
  throw new ChangedError(changedText(real), real);
37256
37285
  }
37257
37286
  async pinnedBytes(pin, bytes) {