@ai-ecoverse/slicc-kernel 1.150.1 → 1.151.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 -2
- package/dist/kernel-worker.js +13 -10
- package/dist/kernel-worker.js.map +2 -2
- package/dist/node-process-worker.js +3 -2
- package/dist/node-process-worker.js.map +2 -2
- package/dist/node.js +13 -10
- package/dist/node.js.map +2 -2
- package/dist/process-worker.js +3 -2
- package/dist/process-worker.js.map +2 -2
- package/dist/types/kernel/net/tls-client.d.ts +1 -0
- package/dist/types/kernel/net/tls-server.d.ts +2 -0
- package/dist/types/kernel/net/tls-uplink.d.ts +2 -1
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -508,8 +508,8 @@ The module's default export (or its `main` export) is called with a context and
|
|
|
508
508
|
- **A TLS server** ([#1401](https://github.com/ai-ecoverse/slicc-kernel/issues/1401)), with the program's own certificate and key: `net.listen({ port, host, tls: { cert, key, passphrase, alpn, ca, requestCert, rejectUnauthorized } })` (and `sync.net.listen`) gives a listener whose connections are already secured, and `net.secure(conn, { server: true, cert, key, … })` secures one accepted connection. `net.secure(conn, tls)` without `server: true` is the client upgrade, as `connect({ socket })`.
|
|
509
509
|
- `cert` and `key` take the same forms as a client certificate, and are refused the same way, at `listen` (or `secure`) before anything is accepted: a key for another certificate is `ERR_OSSL_X509_KEY_VALUES_MISMATCH`, a wrong passphrase `ERR_OSSL_BAD_DECRYPT`.
|
|
510
510
|
- `alpn` is the server's list in order of preference; the first one the client also offers wins, and a client that offers ALPN but none of these fails the handshake.
|
|
511
|
-
- `requestCert`
|
|
512
|
-
- A connection's `tls` is `{ path: 'kernel', protocol, alpnProtocol, servername (the SNI the client sent, or ''), authorized (whether a client certificate verified), authorizationError?, peerCertificates (the client's chain) }`.
|
|
511
|
+
- `requestCert` asks for a client certificate, checked against `ca` (the roots it must reach) or, without `ca`, the kernel's bundled roots, as Node's default store ([#1503](https://github.com/ai-ecoverse/slicc-kernel/issues/1503)). With it the handshake fails without a client certificate that verifies, unless `rejectUnauthorized: false`, which only asks for one and reports the verdict.
|
|
512
|
+
- A connection's `tls` is `{ path: 'kernel', protocol, cipher ({ name, standardName, version }, as a client's; [#1500](https://github.com/ai-ecoverse/slicc-kernel/issues/1500)), alpnProtocol, servername (the SNI the client sent, or ''), authorized (whether a client certificate verified), authorizationError?, peerCertificates (the client's chain) }`.
|
|
513
513
|
- On a `listen({ tls })` listener, the kernel handshakes accepted connections concurrently, from the first `accept` on, and `accept` (and `for await`) yields each as its handshake finishes, so a client that connects and stays silent doesn't hold up the next. It holds at most `backlog` (up to 64) connections in a handshake or handshaken but not yet taken; beyond that it stops accepting, leaving the rest in the kernel's backlog, until one finishes or is taken. A connection whose handshake fails is closed and never yielded. `secure()` rejects instead.
|
|
514
514
|
- `handshakeTimeout` (milliseconds, 120000 by default, as Node's) ends a handshake that hasn't finished with `ERR_TLS_HANDSHAKE_TIMEOUT`. A listener closes that connection. After `secure()` rejects, the connection stays open and is the program's to answer or close, as with Node's `tlsClientError` ([#1504](https://github.com/ai-ecoverse/slicc-kernel/issues/1504)).
|
|
515
515
|
- A client that sends a plain HTTP request instead of a ClientHello fails the handshake with `ERR_SSL_HTTP_REQUEST`, as in Node. A handshake, server or loopback client, waits without holding the program's other calls, and an aborted `accept({ signal })` or `connect({ signal })` ends it. A signal delivered to the program doesn't interrupt a handshake, as with `SA_RESTART`.
|
package/dist/kernel-worker.js
CHANGED
|
@@ -7915,7 +7915,7 @@ function satisfies(version, range2) {
|
|
|
7915
7915
|
}
|
|
7916
7916
|
|
|
7917
7917
|
// src/version.ts
|
|
7918
|
-
var KERNEL_VERSION = true ? "1.
|
|
7918
|
+
var KERNEL_VERSION = true ? "1.151.0" : "0.0.0-dev";
|
|
7919
7919
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7920
7920
|
function procVersion() {
|
|
7921
7921
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -18924,8 +18924,10 @@ async function tlsServer(conn, session, clientCerts) {
|
|
|
18924
18924
|
await serverHandshake(conn, session, inbox, () => first);
|
|
18925
18925
|
const chain2 = session.peerChain();
|
|
18926
18926
|
const code = clientCerts ? verifyCode(session.verifyResult) : void 0;
|
|
18927
|
+
const protocol = session.version === 772 ? "TLSv1.3" : "TLSv1.2";
|
|
18927
18928
|
const info = {
|
|
18928
|
-
protocol
|
|
18929
|
+
protocol,
|
|
18930
|
+
cipher: cipherOf(session.ciphersuite, protocol),
|
|
18929
18931
|
alpnProtocol: session.alpn ?? false,
|
|
18930
18932
|
servername: session.sni,
|
|
18931
18933
|
authorized: clientCerts && chain2.length > 0 && code === void 0,
|
|
@@ -22124,9 +22126,8 @@ function storeOf(engine, ca) {
|
|
|
22124
22126
|
throw new KernelError("EINVAL", `ERR_INVALID_ARG_VALUE: ca: ${err.message}`);
|
|
22125
22127
|
}
|
|
22126
22128
|
}
|
|
22127
|
-
function flagsOf(req
|
|
22129
|
+
function flagsOf(req) {
|
|
22128
22130
|
if (!req.requestCert) return 0;
|
|
22129
|
-
if (!store) throw new KernelError("EINVAL", "ERR_INVALID_ARG_VALUE: requestCert needs a ca");
|
|
22130
22131
|
return req.rejectUnauthorized === false ? TLS_SERVER_REQUEST_CERT : TLS_SERVER_REQUIRE_CERT;
|
|
22131
22132
|
}
|
|
22132
22133
|
function timeoutOf(req) {
|
|
@@ -22162,10 +22163,11 @@ async function serverOf(proc, req) {
|
|
|
22162
22163
|
throw err;
|
|
22163
22164
|
}
|
|
22164
22165
|
const leaf = leafOf(engine, cert);
|
|
22165
|
-
let
|
|
22166
|
+
let mine;
|
|
22166
22167
|
try {
|
|
22167
|
-
|
|
22168
|
-
const flags2 = flagsOf(req
|
|
22168
|
+
mine = req.ca && req.ca.length > 0 ? storeOf(engine, req.ca) : void 0;
|
|
22169
|
+
const flags2 = flagsOf(req);
|
|
22170
|
+
const store = mine ?? (flags2 ? await defaultStore(engine, supportOf(proc.net).roots) : void 0);
|
|
22169
22171
|
return {
|
|
22170
22172
|
engine,
|
|
22171
22173
|
leaf,
|
|
@@ -22175,12 +22177,12 @@ async function serverOf(proc, req) {
|
|
|
22175
22177
|
timeoutMs: timeoutOf(req),
|
|
22176
22178
|
release() {
|
|
22177
22179
|
leaf.release();
|
|
22178
|
-
|
|
22180
|
+
mine?.release();
|
|
22179
22181
|
}
|
|
22180
22182
|
};
|
|
22181
22183
|
} catch (err) {
|
|
22182
22184
|
leaf.release();
|
|
22183
|
-
|
|
22185
|
+
mine?.release();
|
|
22184
22186
|
throw err;
|
|
22185
22187
|
}
|
|
22186
22188
|
}
|
|
@@ -22209,7 +22211,8 @@ async function serveSecure(proc, socket, req) {
|
|
|
22209
22211
|
servername: info.servername,
|
|
22210
22212
|
authorized: info.authorized,
|
|
22211
22213
|
...info.authorizationError ? { authorizationError: info.authorizationError } : {},
|
|
22212
|
-
peerCertificates: info.peerCertificates.map(encode)
|
|
22214
|
+
peerCertificates: info.peerCertificates.map(encode),
|
|
22215
|
+
cipher: info.cipher
|
|
22213
22216
|
};
|
|
22214
22217
|
} finally {
|
|
22215
22218
|
if (!shared) server.release();
|