@ai-ecoverse/slicc-kernel 1.136.2 → 1.136.4
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 +23 -3
- package/dist/kernel-worker.js +188 -33
- package/dist/kernel-worker.js.map +4 -4
- package/dist/node-process-worker.js +1 -1
- package/dist/node.js +188 -33
- package/dist/node.js.map +4 -4
- package/dist/process-worker.js +1 -1
- package/dist/types/kernel/net/sealed-binding.d.ts +2 -0
- package/dist/types/kernel/net/sealed-conn.d.ts +1 -0
- package/dist/types/kernel/net/sealed-pg.d.ts +5 -0
- package/dist/types/kernel/net/sealed-scram.d.ts +8 -0
- package/dist/types/kernel/process.d.ts +1 -0
- package/package.json +3 -3
|
@@ -6699,7 +6699,7 @@ var KERNEL_VERSION, OS_RELEASE;
|
|
|
6699
6699
|
var init_version = __esm({
|
|
6700
6700
|
"src/version.ts"() {
|
|
6701
6701
|
"use strict";
|
|
6702
|
-
KERNEL_VERSION = true ? "1.136.
|
|
6702
|
+
KERNEL_VERSION = true ? "1.136.4" : "0.0.0-dev";
|
|
6703
6703
|
OS_RELEASE = "6.0.0-slicc";
|
|
6704
6704
|
}
|
|
6705
6705
|
});
|
package/dist/node.js
CHANGED
|
@@ -7486,7 +7486,7 @@ function satisfies(version, range2) {
|
|
|
7486
7486
|
}
|
|
7487
7487
|
|
|
7488
7488
|
// src/version.ts
|
|
7489
|
-
var KERNEL_VERSION = true ? "1.136.
|
|
7489
|
+
var KERNEL_VERSION = true ? "1.136.4" : "0.0.0-dev";
|
|
7490
7490
|
var OS_RELEASE = "6.0.0-slicc";
|
|
7491
7491
|
function procVersion() {
|
|
7492
7492
|
return `Linux version ${OS_RELEASE} (slicc-kernel ${KERNEL_VERSION}) #1 SMP PREEMPT_DYNAMIC
|
|
@@ -18412,6 +18412,66 @@ async function anchorFor(engine, chain2, host, found) {
|
|
|
18412
18412
|
return void 0;
|
|
18413
18413
|
}
|
|
18414
18414
|
|
|
18415
|
+
// src/kernel/net/sealed-binding.ts
|
|
18416
|
+
var HASH_OF_SIGNATURE = {
|
|
18417
|
+
"1.2.840.113549.1.1.4": "SHA-256",
|
|
18418
|
+
"1.2.840.113549.1.1.5": "SHA-256",
|
|
18419
|
+
"1.2.840.10045.4.1": "SHA-256",
|
|
18420
|
+
"1.2.840.10040.4.3": "SHA-256",
|
|
18421
|
+
"1.2.840.113549.1.1.11": "SHA-256",
|
|
18422
|
+
"1.2.840.10045.4.3.2": "SHA-256",
|
|
18423
|
+
"1.2.840.113549.1.1.12": "SHA-384",
|
|
18424
|
+
"1.2.840.10045.4.3.3": "SHA-384",
|
|
18425
|
+
"1.2.840.113549.1.1.13": "SHA-512",
|
|
18426
|
+
"1.2.840.10045.4.3.4": "SHA-512"
|
|
18427
|
+
};
|
|
18428
|
+
function tlv3(der2, at) {
|
|
18429
|
+
const tag = der2[at];
|
|
18430
|
+
let len = der2[at + 1];
|
|
18431
|
+
if (tag === void 0 || len === void 0) return void 0;
|
|
18432
|
+
let start2 = at + 2;
|
|
18433
|
+
if (len & 128) {
|
|
18434
|
+
const n = len & 127;
|
|
18435
|
+
if (n === 0 || n > 4) return void 0;
|
|
18436
|
+
len = 0;
|
|
18437
|
+
for (let i = 0; i < n; i++) len = len * 256 + (der2[start2 + i] ?? 0);
|
|
18438
|
+
start2 += n;
|
|
18439
|
+
}
|
|
18440
|
+
const end = start2 + len;
|
|
18441
|
+
return end <= der2.length ? { tag, start: start2, end } : void 0;
|
|
18442
|
+
}
|
|
18443
|
+
function oidText(bytes) {
|
|
18444
|
+
const first = bytes[0] ?? 0;
|
|
18445
|
+
const parts2 = [Math.floor(first / 40), first % 40];
|
|
18446
|
+
let value2 = 0;
|
|
18447
|
+
for (const b of bytes.subarray(1)) {
|
|
18448
|
+
value2 = value2 * 128 + (b & 127);
|
|
18449
|
+
if ((b & 128) === 0) {
|
|
18450
|
+
parts2.push(value2);
|
|
18451
|
+
value2 = 0;
|
|
18452
|
+
}
|
|
18453
|
+
}
|
|
18454
|
+
return parts2.join(".");
|
|
18455
|
+
}
|
|
18456
|
+
function signatureOid(cert) {
|
|
18457
|
+
const outer = tlv3(cert, 0);
|
|
18458
|
+
if (outer?.tag !== 48) return void 0;
|
|
18459
|
+
const tbs = tlv3(cert, outer.start);
|
|
18460
|
+
if (tbs?.tag !== 48) return void 0;
|
|
18461
|
+
const algorithm = tlv3(cert, tbs.end);
|
|
18462
|
+
if (algorithm?.tag !== 48) return void 0;
|
|
18463
|
+
const oid2 = tlv3(cert, algorithm.start);
|
|
18464
|
+
if (oid2?.tag !== 6) return void 0;
|
|
18465
|
+
return oidText(cert.subarray(oid2.start, oid2.end));
|
|
18466
|
+
}
|
|
18467
|
+
async function endPointBinding(cert) {
|
|
18468
|
+
if (!cert) return void 0;
|
|
18469
|
+
const oid2 = signatureOid(cert);
|
|
18470
|
+
const hash = oid2 === void 0 ? void 0 : HASH_OF_SIGNATURE[oid2];
|
|
18471
|
+
if (!hash) return void 0;
|
|
18472
|
+
return new Uint8Array(await crypto.subtle.digest(hash, cert));
|
|
18473
|
+
}
|
|
18474
|
+
|
|
18415
18475
|
// node_modules/@ai-ecoverse/slicc-scrub/dist/index.js
|
|
18416
18476
|
var FRAGMENT = 16;
|
|
18417
18477
|
var MIN_VALUE = 8;
|
|
@@ -19147,25 +19207,35 @@ function base64Of(bytes) {
|
|
|
19147
19207
|
for (const b of bytes) bin += String.fromCharCode(b);
|
|
19148
19208
|
return btoa(bin);
|
|
19149
19209
|
}
|
|
19150
|
-
function
|
|
19151
|
-
const m = /^n,,(n=[^,]*,r=[^,]+)$/.exec(message3);
|
|
19152
|
-
return m ? m[1] : void 0;
|
|
19210
|
+
function clientFirstOf(message3) {
|
|
19211
|
+
const m = /^((?:n|y|p=[A-Za-z0-9.-]+),,)(n=[^,]*,r=[^,]+)$/.exec(message3);
|
|
19212
|
+
return m ? { header: m[1], bare: m[2] } : void 0;
|
|
19213
|
+
}
|
|
19214
|
+
var latinBytes = (text) => Uint8Array.from(text, (c) => c.charCodeAt(0));
|
|
19215
|
+
function channelOf(header4, binding) {
|
|
19216
|
+
const head = latinBytes(header4);
|
|
19217
|
+
const all = new Uint8Array(head.length + (binding?.length ?? 0));
|
|
19218
|
+
all.set(head);
|
|
19219
|
+
if (binding) all.set(binding, head.length);
|
|
19220
|
+
return base64Of(all);
|
|
19153
19221
|
}
|
|
19154
19222
|
var SERVER_FIRST = /^r=([^,]+),s=([^,]+),i=(\d{1,6})$/;
|
|
19155
|
-
var CLIENT_FINAL = /^(c=
|
|
19223
|
+
var CLIENT_FINAL = /^(c=([A-Za-z0-9+/]+={0,2}),r=([^,]+)),p=([^,]+)$/;
|
|
19156
19224
|
var SCRAM_MAX = 1024;
|
|
19157
19225
|
function exchangeOf(clientFirst, serverFirst, clientFinal) {
|
|
19158
|
-
const
|
|
19226
|
+
const first = clientFirstOf(clientFirst);
|
|
19227
|
+
const bare = first?.bare;
|
|
19159
19228
|
const sf = SERVER_FIRST.exec(serverFirst);
|
|
19160
19229
|
const fin = CLIENT_FINAL.exec(clientFinal);
|
|
19161
19230
|
if (!bare || !sf || !fin || [bare, serverFirst, clientFinal].some((t) => t.length > SCRAM_MAX))
|
|
19162
19231
|
return void 0;
|
|
19232
|
+
const channel = base64Bytes(fin[2]);
|
|
19163
19233
|
const cnonce = bare.slice(bare.indexOf(",r=") + 3);
|
|
19164
19234
|
const nonce = sf[1];
|
|
19165
19235
|
const salt = base64Bytes(sf[2]);
|
|
19166
19236
|
const iterations = Number(sf[3]);
|
|
19167
|
-
const proof = base64Bytes(fin[
|
|
19168
|
-
const ok4 = fin[
|
|
19237
|
+
const proof = base64Bytes(fin[4]);
|
|
19238
|
+
const ok4 = channel !== void 0 && latin(channel).startsWith(first.header) && fin[3] === nonce && nonce.startsWith(cnonce) && iterations >= 1 && iterations <= 1e5 && salt !== void 0 && proof?.length === 32;
|
|
19169
19239
|
if (!ok4) return void 0;
|
|
19170
19240
|
return {
|
|
19171
19241
|
exchange: {
|
|
@@ -19175,9 +19245,16 @@ function exchangeOf(clientFirst, serverFirst, clientFinal) {
|
|
|
19175
19245
|
salt,
|
|
19176
19246
|
iterations
|
|
19177
19247
|
},
|
|
19178
|
-
proof
|
|
19248
|
+
proof,
|
|
19249
|
+
channel,
|
|
19250
|
+
nonce
|
|
19179
19251
|
};
|
|
19180
19252
|
}
|
|
19253
|
+
function latin(bytes) {
|
|
19254
|
+
let out = "";
|
|
19255
|
+
for (const b of bytes) out += String.fromCharCode(b);
|
|
19256
|
+
return out;
|
|
19257
|
+
}
|
|
19181
19258
|
async function hmac(key, data) {
|
|
19182
19259
|
const k = await crypto.subtle.importKey(
|
|
19183
19260
|
"raw",
|
|
@@ -19244,16 +19321,23 @@ function sniffPg(start2) {
|
|
|
19244
19321
|
const length2 = int32(bytes, 0);
|
|
19245
19322
|
return length2 >= 8 && length2 <= PG_MESSAGE_MAX && int32(bytes, 4) === PROTOCOL_3 ? "yes" : "no";
|
|
19246
19323
|
}
|
|
19324
|
+
var PLAIN = "SCRAM-SHA-256";
|
|
19247
19325
|
var PLUS = "SCRAM-SHA-256-PLUS";
|
|
19326
|
+
var END_POINT = "p=tls-server-end-point,,";
|
|
19248
19327
|
var SASL = 10;
|
|
19249
19328
|
var SASL_CONTINUE = 11;
|
|
19250
19329
|
var SASL_FINAL = 12;
|
|
19251
|
-
function
|
|
19330
|
+
function latin2(bytes) {
|
|
19252
19331
|
let out = "";
|
|
19253
19332
|
for (const b of bytes) out += String.fromCharCode(b);
|
|
19254
19333
|
return out;
|
|
19255
19334
|
}
|
|
19256
19335
|
var PgServer = class {
|
|
19336
|
+
binding;
|
|
19337
|
+
plus = false;
|
|
19338
|
+
constructor(binding) {
|
|
19339
|
+
this.binding = binding;
|
|
19340
|
+
}
|
|
19257
19341
|
buffer = new Uint8Array(0);
|
|
19258
19342
|
skip = 0;
|
|
19259
19343
|
cleartext = false;
|
|
@@ -19267,20 +19351,22 @@ var PgServer = class {
|
|
|
19267
19351
|
if (this.expect && code !== SASL_FINAL) this.failed = true;
|
|
19268
19352
|
this.cleartext = message3.length === 9 && code === CLEARTEXT;
|
|
19269
19353
|
if (code === SASL) return this.mechanisms(message3);
|
|
19270
|
-
else if (code === SASL_CONTINUE) this.serverFirst =
|
|
19354
|
+
else if (code === SASL_CONTINUE) this.serverFirst = latin2(message3.subarray(9));
|
|
19271
19355
|
else if (code === SASL_FINAL) this.final(message3);
|
|
19272
19356
|
return message3;
|
|
19273
19357
|
}
|
|
19274
19358
|
mechanisms(message3) {
|
|
19275
19359
|
this.sasl = true;
|
|
19276
|
-
const
|
|
19277
|
-
|
|
19360
|
+
const offered = latin2(message3.subarray(9)).split("\0").filter((n) => n !== "");
|
|
19361
|
+
this.plus = offered.includes(PLUS);
|
|
19362
|
+
const names2 = offered.filter((n) => n !== PLUS || this.binding !== void 0);
|
|
19363
|
+
return frame3(82, `${latin2(message3.subarray(5, 9))}${names2.map((n) => `${n}\0`).join("")}\0`);
|
|
19278
19364
|
}
|
|
19279
19365
|
final(message3) {
|
|
19280
19366
|
const expect = this.expect;
|
|
19281
19367
|
if (!expect) return;
|
|
19282
19368
|
this.expect = void 0;
|
|
19283
|
-
const data =
|
|
19369
|
+
const data = latin2(message3.subarray(9));
|
|
19284
19370
|
if (data !== expect.real || expect.fake.length !== expect.real.length) {
|
|
19285
19371
|
this.failed = true;
|
|
19286
19372
|
return;
|
|
@@ -19355,9 +19441,9 @@ function pgLength(bytes, started) {
|
|
|
19355
19441
|
const length2 = int32(bytes, started ? 1 : 0);
|
|
19356
19442
|
return started ? 1 + length2 : length2;
|
|
19357
19443
|
}
|
|
19358
|
-
var MECHANISMS = /* @__PURE__ */ new Set([
|
|
19444
|
+
var MECHANISMS = /* @__PURE__ */ new Set([PLAIN, PLUS]);
|
|
19359
19445
|
async function cleartext(message3, asks) {
|
|
19360
|
-
const body =
|
|
19446
|
+
const body = latin2(message3.subarray(5));
|
|
19361
19447
|
if (!body.endsWith("\0") || body.indexOf("\0") !== body.length - 1)
|
|
19362
19448
|
return { bytes: message3, done: true };
|
|
19363
19449
|
const password = body.slice(0, -1);
|
|
@@ -19369,14 +19455,30 @@ async function cleartext(message3, asks) {
|
|
|
19369
19455
|
return { bytes: frame3(112, `${replaced(password, values)}\0`), values, done: true };
|
|
19370
19456
|
}
|
|
19371
19457
|
function initial(message3) {
|
|
19372
|
-
const body =
|
|
19458
|
+
const body = latin2(message3.subarray(5));
|
|
19373
19459
|
const nul = body.indexOf("\0");
|
|
19374
|
-
|
|
19460
|
+
const mechanism = body.slice(0, nul);
|
|
19461
|
+
if (nul < 0 || !MECHANISMS.has(mechanism) || body.length < nul + 5) return void 0;
|
|
19375
19462
|
const data = message3.subarray(5 + nul + 5);
|
|
19376
|
-
return int32(message3, 5 + nul + 1) === data.length ?
|
|
19463
|
+
return int32(message3, 5 + nul + 1) === data.length ? { mechanism, data: latin2(data) } : void 0;
|
|
19464
|
+
}
|
|
19465
|
+
function int32Text(n) {
|
|
19466
|
+
return String.fromCharCode(n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, n & 255);
|
|
19467
|
+
}
|
|
19468
|
+
function serverHeader(header4, server) {
|
|
19469
|
+
if (header4 === "n,,") return header4;
|
|
19470
|
+
if (header4 === "y,," && !server.plus) return header4;
|
|
19471
|
+
if (header4 === END_POINT && server.binding) return header4;
|
|
19472
|
+
return server.plus && server.binding ? END_POINT : "n,,";
|
|
19473
|
+
}
|
|
19474
|
+
function rewritten(first, header4) {
|
|
19475
|
+
const parsed2 = clientFirstOf(first.data);
|
|
19476
|
+
if (!parsed2 || parsed2.header === header4) return first;
|
|
19477
|
+
return { mechanism: header4 === END_POINT ? PLUS : PLAIN, data: `${header4}${parsed2.bare}` };
|
|
19377
19478
|
}
|
|
19378
19479
|
var PgClient = class {
|
|
19379
19480
|
clientFirst;
|
|
19481
|
+
header = "n,,";
|
|
19380
19482
|
server;
|
|
19381
19483
|
asks;
|
|
19382
19484
|
constructor(server, asks) {
|
|
@@ -19391,17 +19493,28 @@ var PgClient = class {
|
|
|
19391
19493
|
return cleartext(message3, this.asks);
|
|
19392
19494
|
}
|
|
19393
19495
|
if (server.sasl && this.clientFirst === void 0) {
|
|
19394
|
-
|
|
19395
|
-
|
|
19496
|
+
const first = initial(message3);
|
|
19497
|
+
const parsed2 = first && clientFirstOf(first.data);
|
|
19498
|
+
if (!first || !parsed2) return { bytes: message3, done: true };
|
|
19499
|
+
this.clientFirst = first.data;
|
|
19500
|
+
this.header = serverHeader(parsed2.header, server);
|
|
19501
|
+
const sent = rewritten(first, this.header);
|
|
19502
|
+
if (sent === first) return { bytes: message3, done: false };
|
|
19503
|
+
return {
|
|
19504
|
+
bytes: frame3(112, `${sent.mechanism}\0${int32Text(sent.data.length)}${sent.data}`),
|
|
19505
|
+
done: false
|
|
19506
|
+
};
|
|
19396
19507
|
}
|
|
19397
19508
|
if (this.clientFirst !== void 0 && server.serverFirst !== void 0)
|
|
19398
19509
|
return this.final(message3, this.clientFirst, server.serverFirst);
|
|
19399
19510
|
return { bytes: message3, done: true };
|
|
19400
19511
|
}
|
|
19401
19512
|
async final(message3, first, serverFirst) {
|
|
19402
|
-
const got = exchangeOf(first, serverFirst,
|
|
19513
|
+
const got = exchangeOf(first, serverFirst, latin2(message3.subarray(5)));
|
|
19403
19514
|
if (!got) return { bytes: message3, done: true };
|
|
19404
19515
|
const x = got.exchange;
|
|
19516
|
+
const binding = this.header === END_POINT ? this.server.binding : void 0;
|
|
19517
|
+
const serverFinal = `c=${channelOf(this.header, binding)},r=${got.nonce}`;
|
|
19405
19518
|
const values = usable(
|
|
19406
19519
|
await this.asks.scram({
|
|
19407
19520
|
clientFirstBare: x.clientFirstBare,
|
|
@@ -19411,16 +19524,19 @@ var PgClient = class {
|
|
|
19411
19524
|
})
|
|
19412
19525
|
);
|
|
19413
19526
|
const [entry, ...more] = Object.entries(values);
|
|
19414
|
-
|
|
19527
|
+
const own = { bytes: frame3(112, `${serverFinal},p=${base64Of(got.proof)}`), done: true };
|
|
19528
|
+
if (!entry || more.length > 0)
|
|
19529
|
+
return serverFinal === x.clientFinalBare ? { bytes: message3, done: true } : own;
|
|
19415
19530
|
const [placeholder, value2] = entry;
|
|
19416
19531
|
const fake = await scramKeys(placeholder, x);
|
|
19417
|
-
if (!sameBytes(fake.proof, got.proof))
|
|
19418
|
-
|
|
19532
|
+
if (!sameBytes(fake.proof, got.proof))
|
|
19533
|
+
return serverFinal === x.clientFinalBare ? { bytes: message3, done: true } : own;
|
|
19534
|
+
const real = await scramKeys(saslprep(value2), { ...x, clientFinalBare: serverFinal });
|
|
19419
19535
|
this.server.expect = {
|
|
19420
19536
|
real: `v=${base64Of(real.serverSignature)}`,
|
|
19421
19537
|
fake: `v=${base64Of(fake.serverSignature)}`
|
|
19422
19538
|
};
|
|
19423
|
-
const bytes = frame3(112, `${
|
|
19539
|
+
const bytes = frame3(112, `${serverFinal},p=${base64Of(real.proof)}`);
|
|
19424
19540
|
for (const k of [real.proof, real.serverSignature, fake.proof, fake.serverSignature]) k.fill(0);
|
|
19425
19541
|
return { bytes, values, done: true };
|
|
19426
19542
|
}
|
|
@@ -19819,7 +19935,7 @@ function idle() {
|
|
|
19819
19935
|
return new Promise((resolve2) => setTimeout(() => resolve2(IDLE2), SCRUB_IDLE_MS));
|
|
19820
19936
|
}
|
|
19821
19937
|
function sealedConn(conn, s) {
|
|
19822
|
-
const pg = new PgServer();
|
|
19938
|
+
const pg = new PgServer(s.binding);
|
|
19823
19939
|
const scope = s.broker.sessions.scope(s.pid, s.host);
|
|
19824
19940
|
const writer = substitutes(s) ? new SessionWriter(conn, s, pg, scope) : void 0;
|
|
19825
19941
|
const observed = {
|
|
@@ -20110,6 +20226,8 @@ function secure(prepared, seal) {
|
|
|
20110
20226
|
const session = sealing({ ...seal, engine }, raw2, made2.info, prepared.options.servername);
|
|
20111
20227
|
if (!session) return made2;
|
|
20112
20228
|
made2.info.substitutes = substitutes(session);
|
|
20229
|
+
if (made2.info.substitutes && session.verified)
|
|
20230
|
+
session.binding = await endPointBinding(made2.info.peerCertificates[0]);
|
|
20113
20231
|
return { conn: sealedConn(made2.conn, session), info: made2.info };
|
|
20114
20232
|
} finally {
|
|
20115
20233
|
prepared.own?.release();
|
|
@@ -22143,6 +22261,18 @@ var WasmProcess = class {
|
|
|
22143
22261
|
throw err;
|
|
22144
22262
|
}
|
|
22145
22263
|
}
|
|
22264
|
+
async complain(line) {
|
|
22265
|
+
const stderr = this.fds.has(2) ? this.fds.get(2).file : void 0;
|
|
22266
|
+
if (!stderr?.write || stderr.sealed || stderr.clipboard) return false;
|
|
22267
|
+
const bytes = new TextEncoder().encode(`${line}
|
|
22268
|
+
`);
|
|
22269
|
+
const timeout = new Promise((r) => setTimeout(() => r(0), 1e3));
|
|
22270
|
+
const sent = await Promise.race([stderr.write(bytes, AbortSignal.timeout(1e3)), timeout]).then(
|
|
22271
|
+
(n) => n,
|
|
22272
|
+
() => 0
|
|
22273
|
+
);
|
|
22274
|
+
return sent > 0;
|
|
22275
|
+
}
|
|
22146
22276
|
async clipboardComplaint(err) {
|
|
22147
22277
|
const name2 = this.options.clipboardName;
|
|
22148
22278
|
if (name2 === void 0 || !(err instanceof KernelError) || err.detail === void 0) return;
|
|
@@ -23618,6 +23748,29 @@ function outOfMemory(opts, data) {
|
|
|
23618
23748
|
}
|
|
23619
23749
|
return true;
|
|
23620
23750
|
}
|
|
23751
|
+
function workerError(event) {
|
|
23752
|
+
return String(event.message ?? "worker error");
|
|
23753
|
+
}
|
|
23754
|
+
var CrashSlot = class {
|
|
23755
|
+
status;
|
|
23756
|
+
reported = false;
|
|
23757
|
+
report;
|
|
23758
|
+
constructor(report) {
|
|
23759
|
+
this.report = report;
|
|
23760
|
+
}
|
|
23761
|
+
take(status, message3, finish) {
|
|
23762
|
+
if (this.status) return;
|
|
23763
|
+
this.status = status;
|
|
23764
|
+
const done4 = () => {
|
|
23765
|
+
this.reported = true;
|
|
23766
|
+
finish(...status);
|
|
23767
|
+
};
|
|
23768
|
+
void this.report(message3).then(done4, done4);
|
|
23769
|
+
}
|
|
23770
|
+
};
|
|
23771
|
+
async function crashReport(process2, onError, message3) {
|
|
23772
|
+
if (!await process2.complain(message3)) onError?.(message3);
|
|
23773
|
+
}
|
|
23621
23774
|
function spawnWasmProcess(opts) {
|
|
23622
23775
|
const { promise: ready2, resolve: started } = readiness(opts.program.abi);
|
|
23623
23776
|
const sab = new SharedArrayBuffer(SAB_HEADER_BYTES + SAB_DEFAULT_WINDOW_BYTES);
|
|
@@ -23668,9 +23821,11 @@ function spawnWasmProcess(opts) {
|
|
|
23668
23821
|
const jsThreads = jsThreadsOf(opts, process2, token, dispatch2, clocks, header4);
|
|
23669
23822
|
const { promise: exited, resolve: settle } = Promise.withResolvers();
|
|
23670
23823
|
let done4 = false;
|
|
23824
|
+
const crash = new CrashSlot((message3) => crashReport(process2, opts.onError, message3));
|
|
23671
23825
|
let endedBy;
|
|
23672
23826
|
const finish = (code, sig) => {
|
|
23673
23827
|
if (done4) return;
|
|
23828
|
+
if (crash.status && !crash.reported) return;
|
|
23674
23829
|
done4 = true;
|
|
23675
23830
|
started(true);
|
|
23676
23831
|
clocks.freeze();
|
|
@@ -23699,8 +23854,9 @@ function spawnWasmProcess(opts) {
|
|
|
23699
23854
|
} else if (data?.type === WASM_PROCESS_EXIT) {
|
|
23700
23855
|
finish(...dying.status(data.code));
|
|
23701
23856
|
} else if (data?.type === WASM_PROCESS_ERROR) {
|
|
23702
|
-
|
|
23703
|
-
finish(...
|
|
23857
|
+
const status = dying.status(data.code);
|
|
23858
|
+
if (dying.ending) finish(...status);
|
|
23859
|
+
else crash.take(status, String(data.message), finish);
|
|
23704
23860
|
} else if (data?.type === WASM_THREAD_SPAWN && data.thread) {
|
|
23705
23861
|
spawnThread(data.thread);
|
|
23706
23862
|
} else if (data?.type === JS_THREAD_SPAWN && jsThreads) {
|
|
@@ -23710,8 +23866,7 @@ function spawnWasmProcess(opts) {
|
|
|
23710
23866
|
const onMessage = (event) => handle(event.data);
|
|
23711
23867
|
const onError = (event) => {
|
|
23712
23868
|
event.preventDefault();
|
|
23713
|
-
|
|
23714
|
-
finish(CRASHED);
|
|
23869
|
+
crash.take([CRASHED], workerError(event), finish);
|
|
23715
23870
|
};
|
|
23716
23871
|
worker.addEventListener("message", onMessage);
|
|
23717
23872
|
worker.addEventListener("error", onError);
|
|
@@ -26621,7 +26776,7 @@ var RULE = new RegExp(
|
|
|
26621
26776
|
String.raw`^(NOPASSWD\s+)?(\S+)\s+(?:\(([^()\s]+)\)\s+)?(?:Cwd\s+(${WORD})\s+)?Cmnd(?:\s+(.*))?$`
|
|
26622
26777
|
);
|
|
26623
26778
|
var TERM = /^[A-Za-z0-9._+-]+$/;
|
|
26624
|
-
var
|
|
26779
|
+
var PLAIN2 = /^[A-Za-z0-9_@%+=:,./-]+$/;
|
|
26625
26780
|
var USAGE = "usage: sudo [-n] [-u user] [--] command [args...]\n sudo -l";
|
|
26626
26781
|
function failed2(errno3, error) {
|
|
26627
26782
|
return { error, errno: errno3 };
|
|
@@ -26648,7 +26803,7 @@ function splitWords(text) {
|
|
|
26648
26803
|
return words2;
|
|
26649
26804
|
}
|
|
26650
26805
|
function quoteWord(word) {
|
|
26651
|
-
return
|
|
26806
|
+
return PLAIN2.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
26652
26807
|
}
|
|
26653
26808
|
function validWho(who) {
|
|
26654
26809
|
if (who === "ALL") return true;
|