@ai-ecoverse/slicc-kernel 1.125.12 → 1.126.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 +12 -3
- package/dist/index.js.map +2 -2
- package/dist/kernel-worker.js +96 -12
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +90 -25
- package/dist/node-process-worker.js.map +3 -3
- package/dist/node.js +96 -12
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +90 -25
- 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 +4 -0
- package/dist/types/kernel/net/tls-uplink.d.ts +2 -1
- package/dist/types/kernel/sealed-session.d.ts +44 -0
- package/dist/types/kernel/sealed.d.ts +3 -0
- package/dist/types/process/js/js-context.d.ts +15 -3
- package/dist/types/process/js/js-io.d.ts +3 -0
- package/dist/types/process/js/js-net.d.ts +1 -0
- package/dist/types/process/js/js-sync.d.ts +5 -3
- package/dist/types/process/js/js-tty.d.ts +11 -1
- package/package.json +1 -1
package/dist/node.js
CHANGED
|
@@ -7153,7 +7153,7 @@ function satisfies(version, range2) {
|
|
|
7153
7153
|
}
|
|
7154
7154
|
|
|
7155
7155
|
// src/version.ts
|
|
7156
|
-
var KERNEL_VERSION = true ? "1.
|
|
7156
|
+
var KERNEL_VERSION = true ? "1.126.0" : "0.0.0-dev";
|
|
7157
7157
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7158
7158
|
function procVersion() {
|
|
7159
7159
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -8426,10 +8426,10 @@ function tunnelRequestUrl(req, origin) {
|
|
|
8426
8426
|
throw new HttpError(400, "malformed request target");
|
|
8427
8427
|
}
|
|
8428
8428
|
const hosts = fieldValues(req.headers, "host");
|
|
8429
|
-
const
|
|
8429
|
+
const hostOk2 = hosts.every(
|
|
8430
8430
|
(h) => URL.canParse(`https://${h}`) && new URL(`https://${h}`).host === base.host
|
|
8431
8431
|
);
|
|
8432
|
-
if (url.origin !== base.origin || !
|
|
8432
|
+
if (url.origin !== base.origin || !hostOk2) {
|
|
8433
8433
|
throw new HttpError(421, `this tunnel is for ${base.host}`);
|
|
8434
8434
|
}
|
|
8435
8435
|
return url.href;
|
|
@@ -17599,6 +17599,10 @@ function controlsOf(o, session, protocol, chain2, shape) {
|
|
|
17599
17599
|
...o.insecure ? insecureOf(session, chain2, shape) : { hostnameMatches: checked || !session.nameMismatch }
|
|
17600
17600
|
};
|
|
17601
17601
|
}
|
|
17602
|
+
function verdictOf(o, session) {
|
|
17603
|
+
if (o.bundled !== true || isIP(o.servername) || session.verifyResult !== 0) return false;
|
|
17604
|
+
return o.checkHostname !== false || !session.nameMismatch;
|
|
17605
|
+
}
|
|
17602
17606
|
async function infoOf(o, session) {
|
|
17603
17607
|
const flags2 = session.verifyResult;
|
|
17604
17608
|
const code = verifyCode(flags2);
|
|
@@ -17611,7 +17615,9 @@ async function infoOf(o, session) {
|
|
|
17611
17615
|
authorized: code === void 0,
|
|
17612
17616
|
...code ? { authorizationError: code, authorizationText: o.engine.verifyInfo(flags2).trim() } : {},
|
|
17613
17617
|
peerCertificates: chain2,
|
|
17614
|
-
...controlsOf(o, session, protocol, chain2, shape)
|
|
17618
|
+
...controlsOf(o, session, protocol, chain2, shape),
|
|
17619
|
+
verified: verdictOf(o, session),
|
|
17620
|
+
handshakeAt: Date.now()
|
|
17615
17621
|
};
|
|
17616
17622
|
}
|
|
17617
17623
|
var FATAL_ALERT = -30592;
|
|
@@ -17729,6 +17735,7 @@ function sessionOf(info, servername) {
|
|
|
17729
17735
|
return {
|
|
17730
17736
|
path: "kernel",
|
|
17731
17737
|
substitutes: false,
|
|
17738
|
+
verified: info.verified,
|
|
17732
17739
|
protocol: info.protocol,
|
|
17733
17740
|
alpnProtocol: info.alpnProtocol,
|
|
17734
17741
|
authorized: info.authorized,
|
|
@@ -17842,7 +17849,8 @@ async function prepareWith(support, req, servername, cert) {
|
|
|
17842
17849
|
insecure: req.insecure === true,
|
|
17843
17850
|
...req.sni === false ? { sni: false } : {},
|
|
17844
17851
|
...req.checkHostname === false ? { checkHostname: false } : {},
|
|
17845
|
-
clientCertificate: cert !== void 0
|
|
17852
|
+
clientCertificate: cert !== void 0,
|
|
17853
|
+
bundled: own === void 0
|
|
17846
17854
|
};
|
|
17847
17855
|
let session;
|
|
17848
17856
|
try {
|
|
@@ -22582,6 +22590,79 @@ function scrubStdio(fds, scrubber) {
|
|
|
22582
22590
|
}
|
|
22583
22591
|
}
|
|
22584
22592
|
|
|
22593
|
+
// src/kernel/sealed-session.ts
|
|
22594
|
+
var SESSION_WINDOW_MS = 6e4;
|
|
22595
|
+
var SESSION_PLACEHOLDERS = 16;
|
|
22596
|
+
var SESSION_PLACEHOLDER = /^fnox_proxy_[0-9a-f]{24}$/;
|
|
22597
|
+
var SESSION_ID = /^[A-Za-z0-9_-]{16,128}$/;
|
|
22598
|
+
var TOKEN5 = "[!#$%&'*+.^_`|~0-9a-z-]+";
|
|
22599
|
+
var HEADER = new RegExp(`^header:${TOKEN5}$`);
|
|
22600
|
+
var METHOD = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
|
|
22601
|
+
var TARGET = /^[\x21-\x7e]+$/;
|
|
22602
|
+
var EXIT = /^(page|proxy|tailscale|device:[\x21-\x7e]+)$/;
|
|
22603
|
+
var HOST = /^[a-z0-9.:-]+$/;
|
|
22604
|
+
var UNSAFE = /[\r\n\0]/;
|
|
22605
|
+
var POSITIONS = {
|
|
22606
|
+
http1: (position) => HEADER.test(position),
|
|
22607
|
+
smtp: (position) => position === "auth-plain" || position === "auth-login",
|
|
22608
|
+
pg: (position) => position === "password-cleartext"
|
|
22609
|
+
};
|
|
22610
|
+
function boundHost(servername) {
|
|
22611
|
+
const lower = servername.toLowerCase();
|
|
22612
|
+
return lower.endsWith(".") ? lower.slice(0, -1) : lower;
|
|
22613
|
+
}
|
|
22614
|
+
function headOk(f) {
|
|
22615
|
+
if (f.protocol !== "http1") return f.head === void 0;
|
|
22616
|
+
const head = f.head;
|
|
22617
|
+
return head !== void 0 && typeof head.method === "string" && METHOD.test(head.method) && typeof head.path === "string" && TARGET.test(head.path);
|
|
22618
|
+
}
|
|
22619
|
+
function placeholdersOk(list) {
|
|
22620
|
+
if (!Array.isArray(list) || list.length === 0 || list.length > SESSION_PLACEHOLDERS) return false;
|
|
22621
|
+
return new Set(list).size === list.length && list.every((p) => typeof p === "string" && SESSION_PLACEHOLDER.test(p));
|
|
22622
|
+
}
|
|
22623
|
+
function hostOk(host) {
|
|
22624
|
+
return typeof host === "string" && HOST.test(host) && boundHost(host) === host;
|
|
22625
|
+
}
|
|
22626
|
+
function sessionAskable(f, now) {
|
|
22627
|
+
if (!Object.hasOwn(POSITIONS, f.protocol) || typeof f.position !== "string") return false;
|
|
22628
|
+
if (!POSITIONS[f.protocol](f.position)) return false;
|
|
22629
|
+
if (typeof f.session !== "string" || !SESSION_ID.test(f.session)) return false;
|
|
22630
|
+
if (f.verified !== true || !hostOk(f.host) || typeof f.handshakeAt !== "number") return false;
|
|
22631
|
+
if (!Number.isInteger(f.port) || f.port < 1 || f.port > 65535) return false;
|
|
22632
|
+
const age = now - f.handshakeAt;
|
|
22633
|
+
if (!Number.isFinite(age) || age < 0 || age > SESSION_WINDOW_MS) return false;
|
|
22634
|
+
return typeof f.exit === "string" && EXIT.test(f.exit) && placeholdersOk(f.placeholders) && headOk(f);
|
|
22635
|
+
}
|
|
22636
|
+
function sessionRequest(f) {
|
|
22637
|
+
return {
|
|
22638
|
+
v: 1,
|
|
22639
|
+
op: "sessionMaterialize",
|
|
22640
|
+
caller: f.stamp,
|
|
22641
|
+
stamp: f.stamp,
|
|
22642
|
+
session: f.session,
|
|
22643
|
+
host: f.host,
|
|
22644
|
+
port: f.port,
|
|
22645
|
+
protocol: f.protocol,
|
|
22646
|
+
position: f.position,
|
|
22647
|
+
verified: true,
|
|
22648
|
+
handshakeAt: f.handshakeAt,
|
|
22649
|
+
exit: f.exit,
|
|
22650
|
+
placeholders: [...f.placeholders],
|
|
22651
|
+
...f.head ? { head: { method: f.head.method, path: f.head.path } } : {}
|
|
22652
|
+
};
|
|
22653
|
+
}
|
|
22654
|
+
function sessionValues(reply, asked) {
|
|
22655
|
+
if (typeof reply !== "object" || reply === null || Array.isArray(reply)) return void 0;
|
|
22656
|
+
const { error, values } = reply;
|
|
22657
|
+
if (error !== void 0 || typeof values !== "object" || values === null) return void 0;
|
|
22658
|
+
const out = {};
|
|
22659
|
+
for (const ph of asked) {
|
|
22660
|
+
const value2 = values[ph];
|
|
22661
|
+
if (typeof value2 === "string" && value2.length > 0 && !UNSAFE.test(value2)) out[ph] = value2;
|
|
22662
|
+
}
|
|
22663
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
22664
|
+
}
|
|
22665
|
+
|
|
22585
22666
|
// src/kernel/sealed.ts
|
|
22586
22667
|
var SEALED_MAX_BYTES = 64 * 1024;
|
|
22587
22668
|
var SEALED_TIMEOUT_MS = 1e4;
|
|
@@ -22776,6 +22857,15 @@ var SealedBroker = class {
|
|
|
22776
22857
|
};
|
|
22777
22858
|
}
|
|
22778
22859
|
async consume(fields) {
|
|
22860
|
+
const req = { ...fields, v: 1, op: "materializeConsume", caller: fields.stamp };
|
|
22861
|
+
return this.ask(req, swapOf);
|
|
22862
|
+
}
|
|
22863
|
+
async sessionMaterialize(fields, now = Date.now()) {
|
|
22864
|
+
if (!sessionAskable(fields, now)) return void 0;
|
|
22865
|
+
const req = sessionRequest(fields);
|
|
22866
|
+
return this.ask(req, (reply) => sessionValues(reply, req.placeholders));
|
|
22867
|
+
}
|
|
22868
|
+
async ask(req, parse) {
|
|
22779
22869
|
const { hook } = this;
|
|
22780
22870
|
if (!hook) return void 0;
|
|
22781
22871
|
const control = new AbortController();
|
|
@@ -22783,14 +22873,8 @@ var SealedBroker = class {
|
|
|
22783
22873
|
const stopped = new Promise((resolve2) => {
|
|
22784
22874
|
control.signal.addEventListener("abort", () => resolve2(void 0), { once: true });
|
|
22785
22875
|
});
|
|
22786
|
-
const req = {
|
|
22787
|
-
...fields,
|
|
22788
|
-
v: 1,
|
|
22789
|
-
op: "materializeConsume",
|
|
22790
|
-
caller: fields.stamp
|
|
22791
|
-
};
|
|
22792
22876
|
try {
|
|
22793
|
-
const asked = Promise.resolve().then(() => hook(req, { signal: control.signal })).then(
|
|
22877
|
+
const asked = Promise.resolve().then(() => hook(req, { signal: control.signal })).then(parse, () => void 0);
|
|
22794
22878
|
return await Promise.race([asked, stopped]);
|
|
22795
22879
|
} finally {
|
|
22796
22880
|
clearTimeout(timer);
|