@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.
@@ -9280,7 +9280,7 @@ function satisfies(version, range2) {
9280
9280
  }
9281
9281
 
9282
9282
  // src/version.ts
9283
- var KERNEL_VERSION = true ? "1.195.3" : "0.0.0-dev";
9283
+ var KERNEL_VERSION = true ? "1.195.4" : "0.0.0-dev";
9284
9284
  var OS_RELEASE = "6.0.0-slicc";
9285
9285
  function procVersion() {
9286
9286
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -22136,6 +22136,10 @@ var RAN_ONCE = "sudo: ran once; this command line can't be recorded as always";
22136
22136
  var ROOT_ONLY_MAX = 64;
22137
22137
  var OPERANDS_MAX = 256;
22138
22138
  var PATH_MAX = 4096;
22139
+ var LINKS_MAX = 40;
22140
+ function heldByRoot(st) {
22141
+ return st?.uid === 0 && (st.isSymbolicLink || (st.mode & 18) === 0);
22142
+ }
22139
22143
  function userWritable(bound3) {
22140
22144
  const files = Object.entries(bound3).map(([path, hex4]) => ({ path, sha256: hex4 }));
22141
22145
  return files.length > 0 ? { userWritable: files } : {};
@@ -22393,6 +22397,31 @@ var Sudo = class {
22393
22397
  }
22394
22398
  return true;
22395
22399
  }
22400
+ async trustedThrough(path) {
22401
+ const { fs } = this.o;
22402
+ if (!heldByRoot(await fs.lstat("/").catch(() => void 0))) return false;
22403
+ const queue = normalizePath(path).split("/").filter(Boolean);
22404
+ const done5 = [];
22405
+ for (let hops = 0; queue.length > 0; ) {
22406
+ const part = queue.shift();
22407
+ if (part === "." || part === "..") {
22408
+ if (part === "..") done5.pop();
22409
+ continue;
22410
+ }
22411
+ const at = `/${[...done5, part].join("/")}`;
22412
+ const st = await fs.lstat(at).catch(() => void 0);
22413
+ if (!heldByRoot(st)) return false;
22414
+ if (!st?.isSymbolicLink) {
22415
+ done5.push(part);
22416
+ continue;
22417
+ }
22418
+ if (++hops > LINKS_MAX) return false;
22419
+ const target = await fs.readlink(at);
22420
+ if (target.startsWith("/")) done5.length = 0;
22421
+ queue.unshift(...target.split("/").filter(Boolean));
22422
+ }
22423
+ return true;
22424
+ }
22396
22425
  async rootOnly(cwd, args) {
22397
22426
  const { fs } = this.o;
22398
22427
  const found = {};
@@ -37290,7 +37319,7 @@ var Launcher = class {
37290
37319
  const real = await this.sudoer.real(path);
37291
37320
  const hex4 = pinned2[real];
37292
37321
  if (hex4 !== void 0) return { [real]: hex4 };
37293
- if (await this.sudoer.trusted(real)) return {};
37322
+ if (await this.sudoer.trustedThrough(path)) return {};
37294
37323
  throw new ChangedError(changedText(real), real);
37295
37324
  }
37296
37325
  async pinnedBytes(pin, bytes) {