@rogatio/cli 6.20.2 → 6.20.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/dist/editor/index.js +16 -16
- package/dist/node/index.js +169 -91
- package/package.json +4 -4
package/dist/editor/index.js
CHANGED
|
@@ -263,6 +263,14 @@ var HTTP_METHODS = Object.freeze([
|
|
|
263
263
|
"CONNECT",
|
|
264
264
|
"TRACE"
|
|
265
265
|
]);
|
|
266
|
+
function compileReplacementRegex(value) {
|
|
267
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
268
|
+
try {
|
|
269
|
+
return new RegExp(value, "u");
|
|
270
|
+
} catch {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
266
274
|
function hasLoneSurrogate(value) {
|
|
267
275
|
for (let i = 0; i < value.length; i += 1) {
|
|
268
276
|
const code = value.charCodeAt(i);
|
|
@@ -1519,17 +1527,13 @@ function createRequestBodyRuleType() {
|
|
|
1519
1527
|
path: `${rulePath}/requestBody/pattern`,
|
|
1520
1528
|
message: "Regex pattern must not contain lone UTF-16 surrogates."
|
|
1521
1529
|
});
|
|
1522
|
-
} else {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
path: `${rulePath}/requestBody/pattern`,
|
|
1530
|
-
message: "Regex pattern must be a valid regular expression."
|
|
1531
|
-
});
|
|
1532
|
-
}
|
|
1530
|
+
} else if (compileReplacementRegex(action.pattern) === null) {
|
|
1531
|
+
diagnostics.push({
|
|
1532
|
+
code: "editor.request-body-pattern",
|
|
1533
|
+
severity: "error",
|
|
1534
|
+
path: `${rulePath}/requestBody/pattern`,
|
|
1535
|
+
message: "Regex pattern must be a valid regular expression."
|
|
1536
|
+
});
|
|
1533
1537
|
}
|
|
1534
1538
|
if (typeof action.replacement !== "string" || action.replacement.length > LIMITS.maxRequestBodyReplacementLength) {
|
|
1535
1539
|
diagnostics.push({
|
|
@@ -1677,11 +1681,7 @@ function validateRegexReplacements(replacements, rulePath) {
|
|
|
1677
1681
|
replacements.forEach((entry, index) => {
|
|
1678
1682
|
const patternPath = `${rulePath}/responseBody/replacements/${index}/pattern`;
|
|
1679
1683
|
const replacementPath = `${rulePath}/responseBody/replacements/${index}/replacement`;
|
|
1680
|
-
|
|
1681
|
-
if (typeof entry?.pattern !== "string" || entry.pattern.length === 0 || entry.pattern.length > LIMITS.maxResponseBodyPatternLength)
|
|
1682
|
-
throw new Error();
|
|
1683
|
-
new RegExp(entry.pattern, "u");
|
|
1684
|
-
} catch {
|
|
1684
|
+
if (typeof entry?.pattern !== "string" || entry.pattern.length === 0 || entry.pattern.length > LIMITS.maxResponseBodyPatternLength || compileReplacementRegex(entry.pattern) === null) {
|
|
1685
1685
|
diagnostics.push({
|
|
1686
1686
|
code: "editor.response-body-pattern",
|
|
1687
1687
|
severity: "error",
|
package/dist/node/index.js
CHANGED
|
@@ -628,6 +628,14 @@ function compileUrlRegex(value) {
|
|
|
628
628
|
return null;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
+
function compileReplacementRegex(value) {
|
|
632
|
+
if (typeof value !== "string" || value.length === 0) return null;
|
|
633
|
+
try {
|
|
634
|
+
return new RegExp(value, "u");
|
|
635
|
+
} catch {
|
|
636
|
+
return null;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
631
639
|
var label = {
|
|
632
640
|
type: "string",
|
|
633
641
|
minLength: 1,
|
|
@@ -959,7 +967,7 @@ var projectSchemaDefinition = {
|
|
|
959
967
|
type: "string",
|
|
960
968
|
minLength: 1,
|
|
961
969
|
maxLength: LIMITS.maxResponseBodyPatternLength,
|
|
962
|
-
format: "rogatio-
|
|
970
|
+
format: "rogatio-replacement-regex"
|
|
963
971
|
},
|
|
964
972
|
replacement: {
|
|
965
973
|
type: "string",
|
|
@@ -1035,7 +1043,7 @@ var projectSchemaDefinition = {
|
|
|
1035
1043
|
type: "string",
|
|
1036
1044
|
minLength: 1,
|
|
1037
1045
|
maxLength: LIMITS.maxRequestBodyPatternLength,
|
|
1038
|
-
format: "rogatio-
|
|
1046
|
+
format: "rogatio-replacement-regex"
|
|
1039
1047
|
},
|
|
1040
1048
|
replacement: {
|
|
1041
1049
|
type: "string",
|
|
@@ -1200,6 +1208,10 @@ ajv.addFormat("rogatio-url-regex", {
|
|
|
1200
1208
|
type: "string",
|
|
1201
1209
|
validate: (value) => compileUrlRegex(value) !== null
|
|
1202
1210
|
});
|
|
1211
|
+
ajv.addFormat("rogatio-replacement-regex", {
|
|
1212
|
+
type: "string",
|
|
1213
|
+
validate: (value) => compileReplacementRegex(value) !== null
|
|
1214
|
+
});
|
|
1203
1215
|
function ajvIssues(errors) {
|
|
1204
1216
|
return (errors ?? []).map((error) => ({
|
|
1205
1217
|
// Ajv reports a `required` violation against the object that lacks the
|
|
@@ -1525,7 +1537,7 @@ function semanticIssues(project) {
|
|
|
1525
1537
|
} else {
|
|
1526
1538
|
for (let index = 0; index < action2.replacements.length; index += 1) {
|
|
1527
1539
|
const replacement = action2.replacements[index];
|
|
1528
|
-
if (
|
|
1540
|
+
if (compileReplacementRegex(replacement.pattern) === null) {
|
|
1529
1541
|
issues.push({
|
|
1530
1542
|
instancePath: `${actionPath}/replacements/${index}/pattern`,
|
|
1531
1543
|
keyword: "response-body-pattern",
|
|
@@ -1611,7 +1623,7 @@ function semanticIssues(project) {
|
|
|
1611
1623
|
message: `Regex pattern exceeds the maximum length of ${LIMITS.maxRequestBodyPatternLength} characters.`,
|
|
1612
1624
|
params: { limit: LIMITS.maxRequestBodyPatternLength }
|
|
1613
1625
|
});
|
|
1614
|
-
} else if (
|
|
1626
|
+
} else if (compileReplacementRegex(action2.pattern) === null) {
|
|
1615
1627
|
issues.push({
|
|
1616
1628
|
instancePath: `${actionPath}/pattern`,
|
|
1617
1629
|
keyword: "request-body-pattern",
|
|
@@ -2283,21 +2295,23 @@ import { basename, dirname as dirname2, isAbsolute as isAbsolute2, join as join2
|
|
|
2283
2295
|
import { X509Certificate } from "node:crypto";
|
|
2284
2296
|
import { generateKeyPairSync, webcrypto } from "node:crypto";
|
|
2285
2297
|
import { spawn, spawnSync } from "node:child_process";
|
|
2286
|
-
import { accessSync, constants as
|
|
2287
|
-
import { mkdtemp
|
|
2288
|
-
import { tmpdir } from "node:os";
|
|
2289
|
-
import { dirname as dirname3, join as
|
|
2298
|
+
import { accessSync, constants as constants3 } from "node:fs";
|
|
2299
|
+
import { mkdtemp as mkdtemp2, rm as rm3 } from "node:fs/promises";
|
|
2300
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
2301
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
2290
2302
|
import { join as posixJoin } from "node:path/posix";
|
|
2303
|
+
import { constants as constants2 } from "node:fs";
|
|
2304
|
+
import { lstat as lstat2, mkdtemp, open as open3, rm as rm2 } from "node:fs/promises";
|
|
2305
|
+
import { tmpdir } from "node:os";
|
|
2306
|
+
import { join as join3 } from "node:path";
|
|
2291
2307
|
import { spawn as spawn2, spawnSync as spawnSync2 } from "node:child_process";
|
|
2292
|
-
import { accessSync as accessSync2, constants as
|
|
2308
|
+
import { accessSync as accessSync2, constants as constants4, mkdirSync, unlinkSync } from "node:fs";
|
|
2293
2309
|
import { dirname as dirname4 } from "node:path";
|
|
2294
2310
|
import { join as posixJoin2 } from "node:path/posix";
|
|
2295
2311
|
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
2296
|
-
import { accessSync as accessSync3, constants as
|
|
2297
|
-
import { tmpdir as tmpdir2 } from "node:os";
|
|
2298
|
-
import { join as join4 } from "node:path";
|
|
2312
|
+
import { accessSync as accessSync3, constants as constants5 } from "node:fs";
|
|
2299
2313
|
import { join as posixJoin3 } from "node:path/posix";
|
|
2300
|
-
import { constants as
|
|
2314
|
+
import { constants as constants6 } from "node:fs";
|
|
2301
2315
|
import { open as open4, realpath as realpath2 } from "node:fs/promises";
|
|
2302
2316
|
import { isAbsolute as isAbsolute3 } from "node:path";
|
|
2303
2317
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -23153,6 +23167,84 @@ function createRequestBodyTrustController(options = {}) {
|
|
|
23153
23167
|
}
|
|
23154
23168
|
return { install, uninstall, status, verify: verify2 };
|
|
23155
23169
|
}
|
|
23170
|
+
var INSTALL_CERT_NAME = "ca.crt";
|
|
23171
|
+
function optionalFlag(flag) {
|
|
23172
|
+
return typeof flag === "number" ? flag : 0;
|
|
23173
|
+
}
|
|
23174
|
+
function exclusiveWriteFlags() {
|
|
23175
|
+
return constants2.O_WRONLY | constants2.O_CREAT | constants2.O_EXCL | constants2.O_TRUNC | optionalFlag(constants2.O_NOFOLLOW);
|
|
23176
|
+
}
|
|
23177
|
+
function readFlags() {
|
|
23178
|
+
return constants2.O_RDONLY | optionalFlag(constants2.O_NOFOLLOW) | optionalFlag(constants2.O_NONBLOCK);
|
|
23179
|
+
}
|
|
23180
|
+
function refuseCertificateFile(message) {
|
|
23181
|
+
throw new TrustError("trust.internal", message, [
|
|
23182
|
+
"certificate-file-rejected"
|
|
23183
|
+
]);
|
|
23184
|
+
}
|
|
23185
|
+
async function writeExclusiveCertificate(certPath, pem) {
|
|
23186
|
+
const handle = await open3(certPath, exclusiveWriteFlags(), 384);
|
|
23187
|
+
try {
|
|
23188
|
+
await handle.writeFile(Buffer.from(pem, "utf8"));
|
|
23189
|
+
await handle.chmod(384);
|
|
23190
|
+
} finally {
|
|
23191
|
+
await handle.close();
|
|
23192
|
+
}
|
|
23193
|
+
}
|
|
23194
|
+
async function assertCertificateReady(certPath, pem) {
|
|
23195
|
+
let info;
|
|
23196
|
+
try {
|
|
23197
|
+
info = await lstat2(certPath);
|
|
23198
|
+
} catch {
|
|
23199
|
+
refuseCertificateFile("certificate file is not a regular file");
|
|
23200
|
+
}
|
|
23201
|
+
if (!info.isFile() || info.isSymbolicLink() || info.isFIFO()) {
|
|
23202
|
+
refuseCertificateFile("certificate file is not a regular file");
|
|
23203
|
+
}
|
|
23204
|
+
let handle;
|
|
23205
|
+
try {
|
|
23206
|
+
handle = await open3(certPath, readFlags());
|
|
23207
|
+
const opened = await handle.stat();
|
|
23208
|
+
if (!opened.isFile() || opened.isFIFO() || opened.isSymbolicLink()) {
|
|
23209
|
+
refuseCertificateFile("certificate file is not a regular file");
|
|
23210
|
+
}
|
|
23211
|
+
const bytes = await handle.readFile();
|
|
23212
|
+
if (!bytes.equals(Buffer.from(pem, "utf8"))) {
|
|
23213
|
+
refuseCertificateFile(
|
|
23214
|
+
"certificate file does not match the certificate to install"
|
|
23215
|
+
);
|
|
23216
|
+
}
|
|
23217
|
+
if (!isInstallableCaCertificate(bytes.toString("utf8"))) {
|
|
23218
|
+
throw new TrustError("trust.internal", "invalid-ca-certificate", [
|
|
23219
|
+
"invalid-ca-certificate"
|
|
23220
|
+
]);
|
|
23221
|
+
}
|
|
23222
|
+
} catch (error) {
|
|
23223
|
+
if (error instanceof TrustError) throw error;
|
|
23224
|
+
refuseCertificateFile("certificate file is not a regular file");
|
|
23225
|
+
} finally {
|
|
23226
|
+
await handle?.close().catch(() => void 0);
|
|
23227
|
+
}
|
|
23228
|
+
}
|
|
23229
|
+
async function withInstallCertificateFile(pem, use) {
|
|
23230
|
+
if (!isInstallableCaCertificate(pem)) {
|
|
23231
|
+
throw new TrustError("trust.internal", "invalid-ca-certificate", [
|
|
23232
|
+
"invalid-ca-certificate"
|
|
23233
|
+
]);
|
|
23234
|
+
}
|
|
23235
|
+
const directory = await mkdtemp(join3(tmpdir(), "rogatio-ca-"));
|
|
23236
|
+
try {
|
|
23237
|
+
const certPath = join3(directory, INSTALL_CERT_NAME);
|
|
23238
|
+
await writeExclusiveCertificate(certPath, pem);
|
|
23239
|
+
await assertCertificateReady(certPath, pem);
|
|
23240
|
+
await use(certPath);
|
|
23241
|
+
} finally {
|
|
23242
|
+
try {
|
|
23243
|
+
await rm2(directory, { recursive: true, force: true });
|
|
23244
|
+
} catch {
|
|
23245
|
+
}
|
|
23246
|
+
}
|
|
23247
|
+
}
|
|
23156
23248
|
var PREVIOUS_CA_PEM_MAX_BYTES = 16 * 1024;
|
|
23157
23249
|
function spawnSecurity(args) {
|
|
23158
23250
|
return new Promise((resolve12) => {
|
|
@@ -23191,12 +23283,12 @@ var darwinAdapter = {
|
|
|
23191
23283
|
reasons.push("tooling-missing");
|
|
23192
23284
|
}
|
|
23193
23285
|
try {
|
|
23194
|
-
accessSync(manifestDir,
|
|
23286
|
+
accessSync(manifestDir, constants3.W_OK);
|
|
23195
23287
|
} catch {
|
|
23196
23288
|
reasons.push("manifest-dir-unwritable");
|
|
23197
23289
|
}
|
|
23198
23290
|
try {
|
|
23199
|
-
accessSync(caDir,
|
|
23291
|
+
accessSync(caDir, constants3.W_OK);
|
|
23200
23292
|
} catch {
|
|
23201
23293
|
reasons.push("keychain-unwritable");
|
|
23202
23294
|
}
|
|
@@ -23210,44 +23302,31 @@ var darwinAdapter = {
|
|
|
23210
23302
|
},
|
|
23211
23303
|
async caTrustInstaller(certPem) {
|
|
23212
23304
|
const keychain = this.defaultCaInstallPath();
|
|
23213
|
-
const tmpPath = join3(tmpdir(), `rogatio-ca-${Date.now()}.crt`);
|
|
23214
23305
|
try {
|
|
23215
|
-
|
|
23216
|
-
|
|
23217
|
-
throw new TrustError("trust.internal", "keychain-unwritable", [
|
|
23218
|
-
"keychain-unwritable"
|
|
23219
|
-
]);
|
|
23220
|
-
}
|
|
23221
|
-
const result = await new Promise(
|
|
23222
|
-
(resolve12) => {
|
|
23223
|
-
const child = spawn("security", [
|
|
23306
|
+
await withInstallCertificateFile(certPem, async (certPath) => {
|
|
23307
|
+
const result = await spawnSecurity([
|
|
23224
23308
|
"add-trusted-cert",
|
|
23225
23309
|
"-d",
|
|
23226
23310
|
"-r",
|
|
23227
23311
|
"trustRoot",
|
|
23228
23312
|
"-k",
|
|
23229
23313
|
keychain,
|
|
23230
|
-
|
|
23314
|
+
certPath
|
|
23231
23315
|
]);
|
|
23232
|
-
|
|
23233
|
-
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23238
|
-
|
|
23239
|
-
|
|
23240
|
-
|
|
23241
|
-
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
|
|
23246
|
-
let reason = "keychain-unwritable";
|
|
23247
|
-
if (stderr.includes("permission") || stderr.includes("auth")) {
|
|
23248
|
-
reason = "keychain-unwritable";
|
|
23249
|
-
}
|
|
23250
|
-
throw new TrustError("trust.internal", reason, [reason]);
|
|
23316
|
+
if (result.code !== 0) {
|
|
23317
|
+
const stderr = result.stderr.toLowerCase();
|
|
23318
|
+
let reason = "keychain-unwritable";
|
|
23319
|
+
if (stderr.includes("permission") || stderr.includes("auth")) {
|
|
23320
|
+
reason = "keychain-unwritable";
|
|
23321
|
+
}
|
|
23322
|
+
throw new TrustError("trust.internal", reason, [reason]);
|
|
23323
|
+
}
|
|
23324
|
+
});
|
|
23325
|
+
} catch (error) {
|
|
23326
|
+
if (error instanceof TrustError) throw error;
|
|
23327
|
+
throw new TrustError("trust.internal", "keychain-unwritable", [
|
|
23328
|
+
"keychain-unwritable"
|
|
23329
|
+
]);
|
|
23251
23330
|
}
|
|
23252
23331
|
},
|
|
23253
23332
|
async caTrustRemover() {
|
|
@@ -23289,17 +23368,11 @@ var darwinAdapter = {
|
|
|
23289
23368
|
]);
|
|
23290
23369
|
}
|
|
23291
23370
|
const keychain = this.defaultCaInstallPath();
|
|
23292
|
-
const dir = await
|
|
23293
|
-
const tmpPath =
|
|
23371
|
+
const dir = await mkdtemp2(join4(tmpdir2(), "rogatio-ca-"));
|
|
23372
|
+
const tmpPath = join4(dir, "previous.crt");
|
|
23294
23373
|
let failed = false;
|
|
23295
23374
|
try {
|
|
23296
|
-
|
|
23297
|
-
try {
|
|
23298
|
-
await handle.writeFile(certPem, "utf8");
|
|
23299
|
-
await handle.chmod(384);
|
|
23300
|
-
} finally {
|
|
23301
|
-
await handle.close();
|
|
23302
|
-
}
|
|
23375
|
+
await writeExclusiveCertificate(tmpPath, certPem);
|
|
23303
23376
|
const trust = await spawnSecurity(["remove-trusted-cert", "-d", tmpPath]);
|
|
23304
23377
|
if (trust.code !== 0 && !securityMiss(trust.stderr)) failed = true;
|
|
23305
23378
|
const item = await spawnSecurity([
|
|
@@ -23314,7 +23387,7 @@ var darwinAdapter = {
|
|
|
23314
23387
|
failed = true;
|
|
23315
23388
|
} finally {
|
|
23316
23389
|
try {
|
|
23317
|
-
await
|
|
23390
|
+
await rm3(dir, { recursive: true, force: true });
|
|
23318
23391
|
} catch {
|
|
23319
23392
|
}
|
|
23320
23393
|
}
|
|
@@ -23352,7 +23425,7 @@ function exists(path2) {
|
|
|
23352
23425
|
}
|
|
23353
23426
|
function writable(path2) {
|
|
23354
23427
|
try {
|
|
23355
|
-
accessSync2(path2,
|
|
23428
|
+
accessSync2(path2, constants4.W_OK);
|
|
23356
23429
|
return true;
|
|
23357
23430
|
} catch {
|
|
23358
23431
|
return false;
|
|
@@ -23389,7 +23462,7 @@ function p11kitAnchorsDir() {
|
|
|
23389
23462
|
function needsElevation(dir) {
|
|
23390
23463
|
if (writable(dir)) return false;
|
|
23391
23464
|
try {
|
|
23392
|
-
accessSync2(dir,
|
|
23465
|
+
accessSync2(dir, constants4.W_OK);
|
|
23393
23466
|
} catch (err) {
|
|
23394
23467
|
if (nodeCode(err) === "ENOENT" && writable(dirname4(dir))) return false;
|
|
23395
23468
|
}
|
|
@@ -23406,13 +23479,13 @@ function manifestDirFor(browser) {
|
|
|
23406
23479
|
}
|
|
23407
23480
|
function canHostManifest(dir) {
|
|
23408
23481
|
try {
|
|
23409
|
-
accessSync2(dir,
|
|
23482
|
+
accessSync2(dir, constants4.W_OK);
|
|
23410
23483
|
return true;
|
|
23411
23484
|
} catch (err) {
|
|
23412
23485
|
if (nodeCode(err) !== "ENOENT") return false;
|
|
23413
23486
|
}
|
|
23414
23487
|
try {
|
|
23415
|
-
accessSync2(dirname4(dir),
|
|
23488
|
+
accessSync2(dirname4(dir), constants4.W_OK);
|
|
23416
23489
|
return true;
|
|
23417
23490
|
} catch {
|
|
23418
23491
|
return false;
|
|
@@ -23542,7 +23615,7 @@ var linuxAdapter = {
|
|
|
23542
23615
|
},
|
|
23543
23616
|
async caTrustRemover() {
|
|
23544
23617
|
try {
|
|
23545
|
-
|
|
23618
|
+
unlinkSync(DEBIAN_CERT);
|
|
23546
23619
|
} catch {
|
|
23547
23620
|
}
|
|
23548
23621
|
if (!toolOnPath("update-ca-trust")) return;
|
|
@@ -23603,7 +23676,7 @@ var win32Adapter = {
|
|
|
23603
23676
|
reasons.push("tooling-missing");
|
|
23604
23677
|
}
|
|
23605
23678
|
try {
|
|
23606
|
-
accessSync3(manifestDir,
|
|
23679
|
+
accessSync3(manifestDir, constants5.W_OK);
|
|
23607
23680
|
} catch {
|
|
23608
23681
|
reasons.push("manifest-dir-unwritable");
|
|
23609
23682
|
}
|
|
@@ -23616,37 +23689,42 @@ var win32Adapter = {
|
|
|
23616
23689
|
};
|
|
23617
23690
|
},
|
|
23618
23691
|
async caTrustInstaller(certPem) {
|
|
23619
|
-
const tmpPath = join4(tmpdir2(), `rogatio-ca-${Date.now()}.crt`);
|
|
23620
23692
|
try {
|
|
23621
|
-
|
|
23622
|
-
|
|
23693
|
+
await withInstallCertificateFile(certPem, async (certPath) => {
|
|
23694
|
+
const result = await new Promise(
|
|
23695
|
+
(resolve12) => {
|
|
23696
|
+
const child = spawn3("certutil", [
|
|
23697
|
+
"-addstore",
|
|
23698
|
+
"-f",
|
|
23699
|
+
"Root",
|
|
23700
|
+
certPath
|
|
23701
|
+
]);
|
|
23702
|
+
let stderr = "";
|
|
23703
|
+
child.stderr?.on("data", (data) => {
|
|
23704
|
+
stderr += data.toString();
|
|
23705
|
+
});
|
|
23706
|
+
child.on("close", (code) => resolve12({ code: code ?? 1, stderr }));
|
|
23707
|
+
child.on(
|
|
23708
|
+
"error",
|
|
23709
|
+
(err) => resolve12({ code: 1, stderr: err.message })
|
|
23710
|
+
);
|
|
23711
|
+
}
|
|
23712
|
+
);
|
|
23713
|
+
if (result.code !== 0) {
|
|
23714
|
+
const stderr = result.stderr.toLowerCase();
|
|
23715
|
+
let reason = "elevation-required";
|
|
23716
|
+
if (stderr.includes("access denied") || stderr.includes("permission")) {
|
|
23717
|
+
reason = "elevation-required";
|
|
23718
|
+
}
|
|
23719
|
+
throw new TrustError("trust.internal", reason, [reason]);
|
|
23720
|
+
}
|
|
23721
|
+
});
|
|
23722
|
+
} catch (error) {
|
|
23723
|
+
if (error instanceof TrustError) throw error;
|
|
23623
23724
|
throw new TrustError("trust.internal", "elevation-required", [
|
|
23624
23725
|
"elevation-required"
|
|
23625
23726
|
]);
|
|
23626
23727
|
}
|
|
23627
|
-
const result = await new Promise(
|
|
23628
|
-
(resolve12) => {
|
|
23629
|
-
const child = spawn3("certutil", ["-addstore", "-f", "Root", tmpPath]);
|
|
23630
|
-
let stderr = "";
|
|
23631
|
-
child.stderr?.on("data", (data) => {
|
|
23632
|
-
stderr += data.toString();
|
|
23633
|
-
});
|
|
23634
|
-
child.on("close", (code) => resolve12({ code: code ?? 1, stderr }));
|
|
23635
|
-
child.on("error", (err) => resolve12({ code: 1, stderr: err.message }));
|
|
23636
|
-
}
|
|
23637
|
-
);
|
|
23638
|
-
try {
|
|
23639
|
-
unlinkSync3(tmpPath);
|
|
23640
|
-
} catch {
|
|
23641
|
-
}
|
|
23642
|
-
if (result.code !== 0) {
|
|
23643
|
-
const stderr = result.stderr.toLowerCase();
|
|
23644
|
-
let reason = "elevation-required";
|
|
23645
|
-
if (stderr.includes("access denied") || stderr.includes("permission")) {
|
|
23646
|
-
reason = "elevation-required";
|
|
23647
|
-
}
|
|
23648
|
-
throw new TrustError("trust.internal", reason, [reason]);
|
|
23649
|
-
}
|
|
23650
23728
|
},
|
|
23651
23729
|
async caTrustRemover() {
|
|
23652
23730
|
const result = await new Promise(
|
|
@@ -24586,7 +24664,7 @@ async function resolveConfinedRoot(value) {
|
|
|
24586
24664
|
}
|
|
24587
24665
|
let directory;
|
|
24588
24666
|
try {
|
|
24589
|
-
directory = await open4(value,
|
|
24667
|
+
directory = await open4(value, constants6.O_RDONLY | constants6.O_DIRECTORY);
|
|
24590
24668
|
const info = await directory.stat();
|
|
24591
24669
|
if (!info.isDirectory()) return failure("runtime.root-invalid");
|
|
24592
24670
|
return { ok: true, value: await realpath2(value) };
|
|
@@ -33439,7 +33517,7 @@ function errorMessage(error) {
|
|
|
33439
33517
|
}
|
|
33440
33518
|
|
|
33441
33519
|
// packages/cli/src/commands/runtime.ts
|
|
33442
|
-
import { chmod, mkdir as mkdir5, rm as
|
|
33520
|
+
import { chmod, mkdir as mkdir5, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
|
|
33443
33521
|
import { dirname as dirname10, join as join9, resolve as resolve8 } from "node:path";
|
|
33444
33522
|
function generateHostWrapper(rogatioCommand, logPath) {
|
|
33445
33523
|
const parts = rogatioCommand.split(" ");
|
|
@@ -33550,11 +33628,11 @@ Note: reload the extension at chrome://extensions for the native host to be dete
|
|
|
33550
33628
|
case "uninstall": {
|
|
33551
33629
|
const uninstallResult = await controller.uninstall();
|
|
33552
33630
|
try {
|
|
33553
|
-
await
|
|
33631
|
+
await rm4(hostPath, { force: true });
|
|
33554
33632
|
} catch {
|
|
33555
33633
|
}
|
|
33556
33634
|
try {
|
|
33557
|
-
await
|
|
33635
|
+
await rm4(join9(installRoot, "runtime-host.log"), { force: true });
|
|
33558
33636
|
} catch {
|
|
33559
33637
|
}
|
|
33560
33638
|
return reportTrust(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rogatio/cli",
|
|
3
|
-
"version": "6.20.
|
|
3
|
+
"version": "6.20.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Local-first browser request and response rules — editor host, file verification, test runner, and runtime dispatch.",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"ajv": "8.20.0",
|
|
44
|
-
"koffi": "3.3.
|
|
44
|
+
"koffi": "3.3.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@rogatio/compiler": "workspace:*",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@rogatio/requestly-import": "workspace:*",
|
|
51
51
|
"@rogatio/runtime": "workspace:*",
|
|
52
52
|
"@rogatio/schema": "workspace:*",
|
|
53
|
-
"@types/node": "26.6.
|
|
53
|
+
"@types/node": "26.6.5",
|
|
54
54
|
"typescript": "7.0.2",
|
|
55
|
-
"vitest": "5.0.
|
|
55
|
+
"vitest": "5.0.4"
|
|
56
56
|
}
|
|
57
57
|
}
|