@ai-ecoverse/slicc-kernel 1.133.1 → 1.133.3

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.
@@ -6520,7 +6520,7 @@ var KERNEL_VERSION, OS_RELEASE;
6520
6520
  var init_version = __esm({
6521
6521
  "src/version.ts"() {
6522
6522
  "use strict";
6523
- KERNEL_VERSION = true ? "1.133.1" : "0.0.0-dev";
6523
+ KERNEL_VERSION = true ? "1.133.3" : "0.0.0-dev";
6524
6524
  OS_RELEASE = "6.0.0-slicc";
6525
6525
  }
6526
6526
  });
package/dist/node.js CHANGED
@@ -7403,7 +7403,7 @@ function satisfies(version, range2) {
7403
7403
  }
7404
7404
 
7405
7405
  // src/version.ts
7406
- var KERNEL_VERSION = true ? "1.133.1" : "0.0.0-dev";
7406
+ var KERNEL_VERSION = true ? "1.133.3" : "0.0.0-dev";
7407
7407
  var OS_RELEASE = "6.0.0-slicc";
7408
7408
  function procVersion() {
7409
7409
  return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
@@ -11674,7 +11674,11 @@ var MountFs = class _MountFs {
11674
11674
  }
11675
11675
  }
11676
11676
  async pread(path, offset, length2, version, redirects = 0) {
11677
- const real = await this.follow(path);
11677
+ const gone = (at) => (err) => {
11678
+ const stale = version !== void 0 && err.code === "ENOENT";
11679
+ throw stale ? errnoError("ESTALE", `${at} is gone from the host`) : err;
11680
+ };
11681
+ const real = await this.follow(path).catch(gone(path));
11678
11682
  const found = this.at(real);
11679
11683
  const { pread } = this.base;
11680
11684
  if (!found && pread) {
@@ -11687,7 +11691,7 @@ var MountFs = class _MountFs {
11687
11691
  }
11688
11692
  if (!found) return (await this.base.readFileBuffer(real)).slice(offset, offset + length2);
11689
11693
  const { mount, rel: rel2 } = found;
11690
- if ((await this.table.getattr(mount, real, rel2)).kind === "directory") {
11694
+ if ((await this.table.getattr(mount, real, rel2).catch(gone(real))).kind === "directory") {
11691
11695
  throw errnoError("EISDIR", real);
11692
11696
  }
11693
11697
  await this.table.commitOverlapping(real, offset, length2);
@@ -11699,10 +11703,7 @@ var MountFs = class _MountFs {
11699
11703
  truncate: false,
11700
11704
  exclusive: false,
11701
11705
  ...version !== void 0 ? { ifMatch: version } : {}
11702
- }).catch((err) => {
11703
- const gone = version !== void 0 && err.code === "ENOENT";
11704
- throw gone ? errnoError("ESTALE", `${real} is gone from the host`) : err;
11705
- });
11706
+ }).catch(gone(real));
11706
11707
  const chunk2 = mount.caps.maxIo ?? DEFAULT_IO;
11707
11708
  const chunks2 = [];
11708
11709
  let total = 0;
@@ -19341,10 +19342,32 @@ var KEY_ERRORS = [
19341
19342
  [-15232, "ERR_OSSL_BAD_DECRYPT"],
19342
19343
  [-15360, "ERR_OSSL_CRYPTO_INTERRUPTED_OR_CANCELLED"]
19343
19344
  ];
19344
- function keyRefused(err) {
19345
- const code = err instanceof TlsError ? err.code : 0;
19345
+ var PBE_OIDS = [
19346
+ [42, 134, 72, 134, 247, 13, 1, 5],
19347
+ [42, 134, 72, 134, 247, 13, 1, 12, 1]
19348
+ ];
19349
+ function hasBytes(hay, needle) {
19350
+ for (let i = 0; i + needle.length <= hay.length; i++) {
19351
+ if (needle.every((b, j) => hay[i + j] === b)) return true;
19352
+ }
19353
+ return false;
19354
+ }
19355
+ function encryptedKey(key) {
19356
+ if (key[0] === 48) return PBE_OIDS.some((oid2) => hasBytes(key, oid2));
19357
+ return new TextDecoder().decode(key).includes("ENCRYPTED");
19358
+ }
19359
+ var KEY_PARSE_RANGES = [
19360
+ [-16383, -14336],
19361
+ [-5375, -4096],
19362
+ [-28671, -24576],
19363
+ [-127, -96]
19364
+ ];
19365
+ var keyParse = (code) => code !== -15360 && KEY_PARSE_RANGES.some(([lo, hi]) => code >= lo && code <= hi);
19366
+ function keyRefused(err, locked) {
19367
+ const raw2 = err instanceof TlsError ? err.code : 0;
19368
+ const code = locked && keyParse(raw2) ? -15232 : raw2;
19346
19369
  const name2 = KEY_ERRORS.find(([n]) => n === code)?.[1] ?? "ERR_OSSL_UNSUPPORTED";
19347
- const text = code === -3 ? "the key does not match the certificate" : err.message;
19370
+ const text = code === -3 ? "the key does not match the certificate" : code === raw2 ? err.message : "bad decrypt";
19348
19371
  return new KernelError("EPROTO", `${name2}: ${text}`);
19349
19372
  }
19350
19373
  function takeCert(req) {
@@ -19375,7 +19398,7 @@ function withCert(session, cert) {
19375
19398
  try {
19376
19399
  session.ownCert(cert.chain, cert.key, cert.pass);
19377
19400
  } catch (err) {
19378
- throw keyRefused(err);
19401
+ throw keyRefused(err, cert.pass.length > 0 && encryptedKey(cert.key));
19379
19402
  }
19380
19403
  }
19381
19404
  function wipe(cert) {