@ai-ecoverse/slicc-kernel 1.151.0 → 1.152.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 +5 -0
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +232 -49
- package/dist/kernel-worker.js.map +3 -3
- package/dist/node-process-worker.js +96 -18
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +232 -49
- package/dist/node.js.map +3 -3
- package/dist/process-worker.js +96 -18
- package/dist/process-worker.js.map +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/kernel/net/tls-client.d.ts +13 -2
- package/dist/types/kernel/net/tls-engine.d.ts +9 -2
- package/dist/types/kernel/net/tls-server.d.ts +17 -2
- package/dist/types/kernel/socket-syscalls.d.ts +10 -0
- package/dist/types/kernel/socket.d.ts +1 -0
- package/dist/types/process/js/js-net.d.ts +21 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -509,10 +509,15 @@ The module's default export (or its `main` export) is called with a context and
|
|
|
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
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 refused client gets the server's alert ([#1499](https://github.com/ai-ecoverse/slicc-kernel/issues/1499), tls-engine 4.2.0-9): 116 (certificate_required) for none on TLS 1.3 and 40 (handshake_failure) on TLS 1.2, and the verifier's alert, such as 48 (unknown_ca), for one that doesn't verify. A kernel client reads it as `ERR_SSL_FATAL_ALERT` with `alert`.
|
|
512
513
|
- 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
514
|
- 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
515
|
- `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
516
|
- 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`.
|
|
517
|
+
- **Choosing per connection** ([#1501](https://github.com/ai-ecoverse/slicc-kernel/issues/1501), [#1502](https://github.com/ai-ecoverse/slicc-kernel/issues/1502), tls-engine 4.2.0-9's `TLS_SERVER_SELECT`), for Node's `SNICallback`, `addContext` and `ALPNCallback`: `tls.select({ servername, protocols })` on `listen` or `secure` is called once the client's ClientHello is in, with the SNI (or `''`) and the protocols the client offers. It returns (or resolves with) `{ context, alpn }` or `{ refuse }`:
|
|
518
|
+
- `context` is a certificate from `net.tlsContext({ cert, key, passphrase })` (or its `fd`); without it the listener's own `cert` serves, and with `select` that one is optional. `alpn` is one of `protocols`, or none; another is `EINVAL` and refuses the handshake. `select` and a fixed `alpn` list together are `EINVAL` (`ERR_TLS_ALPN_CALLBACK_WITH_PROTOCOLS`), as in Node.
|
|
519
|
+
- `refuse` sends a fatal alert and ends the handshake: `'unrecognized_name'` (112), `'no_application_protocol'` (120), `'handshake_failure'` (40), `'access_denied'` (49) or `'internal_error'` (80), or the number. A `select` that throws refuses with 40, and one that doesn't answer within `handshakeTimeout` times the handshake out. On a listener the connection is dropped and the listener keeps accepting; `secure()` rejects with the error.
|
|
520
|
+
- **A context is a descriptor of the process that made it**, in its fd table and counted against its limit: it's close-on-exec, a forked child shares it, and the engine frees it when the last descriptor on it closes (`close()`, or the process ends). `select` can only name a context its own process holds: any other number, another process's context or a descriptor that isn't a context, is `EBADF`, and the handshake is refused without touching that key. A process holds at most 64 contexts (`EMFILE` beyond). Its key is handled as `listen`'s.
|
|
516
521
|
- **The key:** the kernel hands it to the engine once per listener (once per `secure()` call) and wipes its own copies; the engine keeps its copy until the listener is closed, and not in errors, logs, `ps`, `/proc` or the page. A forked child that inherits the listener shares that one copy, and it's freed when the last process closes it. **The program's own `key` string or `Buffer` stays in its realm**: JavaScript strings can't be wiped, so the kernel can't erase what the program holds.
|
|
517
522
|
- **Sealed values in an A2 session** ([#1090](https://github.com/ai-ecoverse/slicc-kernel/issues/1090)) are substituted only at a credential position, only in a session the kernel verified itself (by its bundled roots, or by a vault anchor), and only as the vault allows. `substitutes` means the session **may** substitute: a placeholder at a recognized position will be offered to the vault, and whether a value comes back is the vault's and the anchor check's decision. It's true when all of these hold:
|
|
518
523
|
- `verified` is true, or the engine can verify a chain on its own (wasm-tls-engine 4.2.0-5's `tls_chain_verify`) and the server name isn't an IP literal, so a vault anchor may verify the session (below);
|