@ai-ecoverse/slicc-kernel 1.155.0 → 1.157.0
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.
- package/README.md +2 -0
- package/dist/kernel-worker.js +41 -8
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-driver-worker.js.map +2 -2
- package/dist/node-process-worker.js +21 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +41 -8
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +12 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/kernel/net/tls-client.d.ts +2 -0
- package/dist/types/process/js/js-context.d.ts +6 -0
- package/dist/types/process/js/js-sync.d.ts +7 -1
- package/package.json +2 -2
package/dist/node.js
CHANGED
|
@@ -3588,7 +3588,7 @@ function satisfies(version, range2) {
|
|
|
3588
3588
|
}
|
|
3589
3589
|
|
|
3590
3590
|
// src/version.ts
|
|
3591
|
-
var KERNEL_VERSION = true ? "1.
|
|
3591
|
+
var KERNEL_VERSION = true ? "1.157.0" : "0.0.0-dev";
|
|
3592
3592
|
var OS_RELEASE = "6.0.0-slicc";
|
|
3593
3593
|
function procVersion() {
|
|
3594
3594
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -15383,6 +15383,7 @@ function openSession(o) {
|
|
|
15383
15383
|
var Ciphertext = class {
|
|
15384
15384
|
queue = [];
|
|
15385
15385
|
ended = false;
|
|
15386
|
+
opening = new Uint8Array(0);
|
|
15386
15387
|
conn;
|
|
15387
15388
|
session;
|
|
15388
15389
|
constructor(conn, session) {
|
|
@@ -15391,11 +15392,19 @@ var Ciphertext = class {
|
|
|
15391
15392
|
}
|
|
15392
15393
|
hand(bytes) {
|
|
15393
15394
|
if (bytes.length > 0) this.queue.push(bytes);
|
|
15395
|
+
this.note(bytes);
|
|
15396
|
+
}
|
|
15397
|
+
note(bytes) {
|
|
15398
|
+
if (this.opening.length >= OPENING) return;
|
|
15399
|
+
const next3 = new Uint8Array(Math.min(OPENING, this.opening.length + bytes.length));
|
|
15400
|
+
next3.set(this.opening);
|
|
15401
|
+
next3.set(bytes.subarray(0, next3.length - this.opening.length), this.opening.length);
|
|
15402
|
+
this.opening = next3;
|
|
15394
15403
|
}
|
|
15395
15404
|
async more() {
|
|
15396
15405
|
if (this.queue.length === 0 && !this.ended) {
|
|
15397
15406
|
const bytes = await this.conn.read();
|
|
15398
|
-
if (bytes) this.
|
|
15407
|
+
if (bytes) this.hand(bytes);
|
|
15399
15408
|
else this.ended = true;
|
|
15400
15409
|
}
|
|
15401
15410
|
if (this.queue.length === 0) {
|
|
@@ -15425,11 +15434,38 @@ async function send(conn, session) {
|
|
|
15425
15434
|
}
|
|
15426
15435
|
}
|
|
15427
15436
|
}
|
|
15428
|
-
|
|
15437
|
+
var OPENING = 6;
|
|
15438
|
+
var PLAIN_MAX = 16384;
|
|
15439
|
+
var ENCRYPTED_MAX = PLAIN_MAX + 320;
|
|
15440
|
+
var HTTP_METHODS = ["GET ", "POST ", "HEAD ", "PUT ", "PATCH", "OPTIO", "DELET", "TRACE"];
|
|
15441
|
+
function headerClass(head) {
|
|
15442
|
+
const [type, major, minor, hi, lo] = head;
|
|
15443
|
+
if (major === 0 && minor === 2) return ["ERR_SSL_WRONG_VERSION_NUMBER", "wrong version number"];
|
|
15444
|
+
const length2 = hi << 8 | lo;
|
|
15445
|
+
if (length2 > ENCRYPTED_MAX) return ["ERR_SSL_PACKET_LENGTH_TOO_LONG", "packet length too long"];
|
|
15446
|
+
if (major !== 3) {
|
|
15447
|
+
const text = new TextDecoder("latin1").decode(head.subarray(0, 5));
|
|
15448
|
+
if (HTTP_METHODS.some((m) => text.startsWith(m)))
|
|
15449
|
+
return ["ERR_SSL_HTTP_REQUEST", "http request"];
|
|
15450
|
+
return ["ERR_SSL_WRONG_VERSION_NUMBER", "wrong version number"];
|
|
15451
|
+
}
|
|
15452
|
+
if (length2 > PLAIN_MAX) return ["ERR_SSL_DATA_LENGTH_TOO_LONG", "data length too long"];
|
|
15453
|
+
if (type === 22 && head.length > 5 && head[5] !== 2)
|
|
15454
|
+
return ["ERR_SSL_UNEXPECTED_MESSAGE", "unexpected message"];
|
|
15455
|
+
return void 0;
|
|
15456
|
+
}
|
|
15457
|
+
function recordRefusal(opening2) {
|
|
15458
|
+
if (opening2.length < 5) return void 0;
|
|
15459
|
+
const found = headerClass(opening2);
|
|
15460
|
+
return found && new KernelError("EPROTO", `${found[0]}: ${found[1]}`);
|
|
15461
|
+
}
|
|
15462
|
+
function refused2(engine, session, err, opening2) {
|
|
15429
15463
|
const flags2 = session.verifyResult;
|
|
15430
15464
|
const code = verifyCode(flags2);
|
|
15431
15465
|
if (code && flags2 !== -1)
|
|
15432
15466
|
return new KernelError("EPROTO", `${code}: ${engine.verifyInfo(flags2).trim()}`);
|
|
15467
|
+
const record2 = recordRefusal(opening2);
|
|
15468
|
+
if (record2) return record2;
|
|
15433
15469
|
const text = err instanceof TlsError ? err.message : String(err);
|
|
15434
15470
|
return new KernelError("EPROTO", `ERR_SSL_HANDSHAKE_FAILURE: ${text}${alertOf(session)}`);
|
|
15435
15471
|
}
|
|
@@ -15444,15 +15480,12 @@ async function handshake(conn, o, session, inbox) {
|
|
|
15444
15480
|
done4 = session.handshake();
|
|
15445
15481
|
} catch (err) {
|
|
15446
15482
|
await send(conn, session).catch(() => void 0);
|
|
15447
|
-
throw refused2(o.engine, session, err);
|
|
15483
|
+
throw refused2(o.engine, session, err, inbox.opening);
|
|
15448
15484
|
}
|
|
15449
15485
|
await send(conn, session);
|
|
15450
15486
|
if (done4) return;
|
|
15451
15487
|
if (!await inbox.more()) {
|
|
15452
|
-
throw new KernelError(
|
|
15453
|
-
"ECONNRESET",
|
|
15454
|
-
"the server closed the connection during the TLS handshake"
|
|
15455
|
-
);
|
|
15488
|
+
throw recordRefusal(inbox.opening) ?? new KernelError("ECONNRESET", "the server closed the connection during the TLS handshake");
|
|
15456
15489
|
}
|
|
15457
15490
|
}
|
|
15458
15491
|
}
|