conbridge-agent 0.4.0 → 0.5.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 +1 -1
- package/conbridge-agent-keychain +0 -0
- package/conbridge-agent.cjs +1957 -1249
- package/package.json +1 -1
package/conbridge-agent.cjs
CHANGED
|
@@ -29,12 +29,12 @@ __export(cli_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(cli_exports);
|
|
30
30
|
|
|
31
31
|
// <define:__CONBRIDGE_BUILD__>
|
|
32
|
-
var define_CONBRIDGE_BUILD_default = { version: "0.
|
|
32
|
+
var define_CONBRIDGE_BUILD_default = { version: "0.5.0", commit: "198044ecd375", built_at: "2026-11-06T04:45:37.003Z", keychain_helper_sha256: "8f0004be35342bf004727258856fc17ed9ca6ea0014cd768b94b6060ae752b1f", distribution: "npm" };
|
|
33
33
|
|
|
34
34
|
// dist/cli.js
|
|
35
35
|
var import_node_child_process10 = require("node:child_process");
|
|
36
36
|
var import_node_crypto11 = require("node:crypto");
|
|
37
|
-
var
|
|
37
|
+
var import_node_fs4 = require("node:fs");
|
|
38
38
|
var import_promises15 = require("node:fs/promises");
|
|
39
39
|
var import_node_os8 = require("node:os");
|
|
40
40
|
var import_node_path17 = require("node:path");
|
|
@@ -78,13 +78,13 @@ var windowsConfirm = (request) => new Promise((resolve8) => {
|
|
|
78
78
|
var linuxConfirm = (request) => new Promise((resolve8) => {
|
|
79
79
|
if (!process.env.DISPLAY && !process.env.WAYLAND_DISPLAY)
|
|
80
80
|
return resolve8(false);
|
|
81
|
-
const
|
|
82
|
-
(0, import_node_child_process.execFile)("zenity", ["--question", "--title=ConBridge", `--text=${
|
|
81
|
+
const text6 = confirmText(request);
|
|
82
|
+
(0, import_node_child_process.execFile)("zenity", ["--question", "--title=ConBridge", `--text=${text6}`, "--ok-label=Allow", "--cancel-label=Deny", "--default-cancel", "--timeout=120"], { timeout: CONFIRM_TIMEOUT_MS }, (error63) => {
|
|
83
83
|
if (!error63)
|
|
84
84
|
return resolve8(true);
|
|
85
85
|
if (error63.code !== "ENOENT")
|
|
86
86
|
return resolve8(false);
|
|
87
|
-
(0, import_node_child_process.execFile)("kdialog", ["--title", "ConBridge", "--warningyesno",
|
|
87
|
+
(0, import_node_child_process.execFile)("kdialog", ["--title", "ConBridge", "--warningyesno", text6, "--yes-label", "Allow", "--no-label", "Deny"], { timeout: CONFIRM_TIMEOUT_MS }, (fallback) => resolve8(!fallback));
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
var localConfirm = (request) => {
|
|
@@ -2091,10 +2091,10 @@ function nanoidOfLength(length) {
|
|
|
2091
2091
|
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
2092
2092
|
var extendedDuration = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
2093
2093
|
var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
2094
|
-
var uuid = (
|
|
2095
|
-
if (!
|
|
2094
|
+
var uuid = (version3) => {
|
|
2095
|
+
if (!version3)
|
|
2096
2096
|
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
2097
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${
|
|
2097
|
+
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version3}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
2098
2098
|
};
|
|
2099
2099
|
var uuid4 = /* @__PURE__ */ uuid(4);
|
|
2100
2100
|
var uuid6 = /* @__PURE__ */ uuid(6);
|
|
@@ -2682,8 +2682,8 @@ var Doc = class {
|
|
|
2682
2682
|
arg(this, { execution: "async" });
|
|
2683
2683
|
return;
|
|
2684
2684
|
}
|
|
2685
|
-
const
|
|
2686
|
-
const lines4 =
|
|
2685
|
+
const content = arg;
|
|
2686
|
+
const lines4 = content.split("\n").filter((x) => x);
|
|
2687
2687
|
const minIndent = Math.min(...lines4.map((x) => x.length - x.trimStart().length));
|
|
2688
2688
|
const dedented = lines4.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
2689
2689
|
for (const line of dedented) {
|
|
@@ -2692,9 +2692,9 @@ var Doc = class {
|
|
|
2692
2692
|
}
|
|
2693
2693
|
compile() {
|
|
2694
2694
|
const F = Function;
|
|
2695
|
-
const
|
|
2695
|
+
const content = this?.content ?? [``];
|
|
2696
2696
|
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
|
|
2697
|
-
${
|
|
2697
|
+
${content.join("\n")}
|
|
2698
2698
|
};`);
|
|
2699
2699
|
return factory(...Object.values(this.closed));
|
|
2700
2700
|
}
|
|
@@ -5838,8 +5838,8 @@ var error3 = () => {
|
|
|
5838
5838
|
const sizing = getSizing(issue2.origin);
|
|
5839
5839
|
if (sizing) {
|
|
5840
5840
|
const maxValue = Number(issue2.maximum);
|
|
5841
|
-
const
|
|
5842
|
-
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.maximum.toString()} ${
|
|
5841
|
+
const unit2 = getBelarusianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
|
5842
|
+
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.maximum.toString()} ${unit2}`;
|
|
5843
5843
|
}
|
|
5844
5844
|
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u0432\u044F\u043B\u0456\u043A\u0456: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u044D\u043D\u043D\u0435"} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.maximum.toString()}`;
|
|
5845
5845
|
}
|
|
@@ -5848,8 +5848,8 @@ var error3 = () => {
|
|
|
5848
5848
|
const sizing = getSizing(issue2.origin);
|
|
5849
5849
|
if (sizing) {
|
|
5850
5850
|
const minValue = Number(issue2.minimum);
|
|
5851
|
-
const
|
|
5852
|
-
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.minimum.toString()} ${
|
|
5851
|
+
const unit2 = getBelarusianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
|
5852
|
+
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 ${sizing.verb} ${adj}${issue2.minimum.toString()} ${unit2}`;
|
|
5853
5853
|
}
|
|
5854
5854
|
return `\u0417\u0430\u043D\u0430\u0434\u0442\u0430 \u043C\u0430\u043B\u044B: \u0447\u0430\u043A\u0430\u043B\u0430\u0441\u044F, \u0448\u0442\u043E ${issue2.origin} \u043F\u0430\u0432\u0456\u043D\u043D\u0430 \u0431\u044B\u0446\u044C ${adj}${issue2.minimum.toString()}`;
|
|
5855
5855
|
}
|
|
@@ -8476,8 +8476,8 @@ var error24 = () => {
|
|
|
8476
8476
|
const sizing = getSizing(issue2.origin);
|
|
8477
8477
|
if (sizing) {
|
|
8478
8478
|
const maxValue = Number(issue2.maximum);
|
|
8479
|
-
const
|
|
8480
|
-
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.maximum.toString()} ${
|
|
8479
|
+
const unit2 = getArmenianPlural(maxValue, sizing.unit.one, sizing.unit.many);
|
|
8480
|
+
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.maximum.toString()} ${unit2}`;
|
|
8481
8481
|
}
|
|
8482
8482
|
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0574\u0565\u056E \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin ?? "\u0561\u0580\u056A\u0565\u0584")} \u056C\u056B\u0576\u056B ${adj}${issue2.maximum.toString()}`;
|
|
8483
8483
|
}
|
|
@@ -8486,8 +8486,8 @@ var error24 = () => {
|
|
|
8486
8486
|
const sizing = getSizing(issue2.origin);
|
|
8487
8487
|
if (sizing) {
|
|
8488
8488
|
const minValue = Number(issue2.minimum);
|
|
8489
|
-
const
|
|
8490
|
-
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.minimum.toString()} ${
|
|
8489
|
+
const unit2 = getArmenianPlural(minValue, sizing.unit.one, sizing.unit.many);
|
|
8490
|
+
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056F\u0578\u0582\u0576\u0565\u0576\u0561 ${adj}${issue2.minimum.toString()} ${unit2}`;
|
|
8491
8491
|
}
|
|
8492
8492
|
return `\u0549\u0561\u0583\u0561\u0566\u0561\u0576\u0581 \u0583\u0578\u0584\u0580 \u0561\u0580\u056A\u0565\u0584\u2024 \u057D\u057A\u0561\u057D\u057E\u0578\u0582\u0574 \u0567, \u0578\u0580 ${withDefiniteArticle(issue2.origin)} \u056C\u056B\u0576\u056B ${adj}${issue2.minimum.toString()}`;
|
|
8493
8493
|
}
|
|
@@ -9401,18 +9401,18 @@ var error32 = () => {
|
|
|
9401
9401
|
const adj = issue2.inclusive ? "\uC774\uD558" : "\uBBF8\uB9CC";
|
|
9402
9402
|
const suffix = adj === "\uBBF8\uB9CC" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4";
|
|
9403
9403
|
const sizing = getSizing(issue2.origin);
|
|
9404
|
-
const
|
|
9404
|
+
const unit2 = sizing?.unit ?? "\uC694\uC18C";
|
|
9405
9405
|
if (sizing)
|
|
9406
|
-
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()}${
|
|
9406
|
+
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()}${unit2} ${adj}${suffix}`;
|
|
9407
9407
|
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uD07D\uB2C8\uB2E4: ${issue2.maximum.toString()} ${adj}${suffix}`;
|
|
9408
9408
|
}
|
|
9409
9409
|
case "too_small": {
|
|
9410
9410
|
const adj = issue2.inclusive ? "\uC774\uC0C1" : "\uCD08\uACFC";
|
|
9411
9411
|
const suffix = adj === "\uC774\uC0C1" ? "\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4" : "\uC5EC\uC57C \uD569\uB2C8\uB2E4";
|
|
9412
9412
|
const sizing = getSizing(issue2.origin);
|
|
9413
|
-
const
|
|
9413
|
+
const unit2 = sizing?.unit ?? "\uC694\uC18C";
|
|
9414
9414
|
if (sizing) {
|
|
9415
|
-
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()}${
|
|
9415
|
+
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()}${unit2} ${adj}${suffix}`;
|
|
9416
9416
|
}
|
|
9417
9417
|
return `${issue2.origin ?? "\uAC12"}\uC774 \uB108\uBB34 \uC791\uC2B5\uB2C8\uB2E4: ${issue2.minimum.toString()} ${adj}${suffix}`;
|
|
9418
9418
|
}
|
|
@@ -9451,8 +9451,8 @@ function ko_default() {
|
|
|
9451
9451
|
}
|
|
9452
9452
|
|
|
9453
9453
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/locales/lt.js
|
|
9454
|
-
var capitalizeFirstCharacter = (
|
|
9455
|
-
return
|
|
9454
|
+
var capitalizeFirstCharacter = (text6) => {
|
|
9455
|
+
return text6.charAt(0).toUpperCase() + text6.slice(1);
|
|
9456
9456
|
};
|
|
9457
9457
|
function getUnitTypeFromNumber(number4) {
|
|
9458
9458
|
const abs = Math.abs(number4);
|
|
@@ -11225,8 +11225,8 @@ var error46 = () => {
|
|
|
11225
11225
|
const sizing = getSizing(issue2.origin);
|
|
11226
11226
|
if (sizing) {
|
|
11227
11227
|
const maxValue = Number(issue2.maximum);
|
|
11228
|
-
const
|
|
11229
|
-
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.maximum.toString()} ${
|
|
11228
|
+
const unit2 = getRussianPlural(maxValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
|
11229
|
+
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.maximum.toString()} ${unit2}`;
|
|
11230
11230
|
}
|
|
11231
11231
|
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin ?? "\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435"} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.maximum.toString()}`;
|
|
11232
11232
|
}
|
|
@@ -11235,8 +11235,8 @@ var error46 = () => {
|
|
|
11235
11235
|
const sizing = getSizing(issue2.origin);
|
|
11236
11236
|
if (sizing) {
|
|
11237
11237
|
const minValue = Number(issue2.minimum);
|
|
11238
|
-
const
|
|
11239
|
-
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.minimum.toString()} ${
|
|
11238
|
+
const unit2 = getRussianPlural(minValue, sizing.unit.one, sizing.unit.few, sizing.unit.many);
|
|
11239
|
+
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 \u0438\u043C\u0435\u0442\u044C ${adj}${issue2.minimum.toString()} ${unit2}`;
|
|
11240
11240
|
}
|
|
11241
11241
|
return `\u0421\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435: \u043E\u0436\u0438\u0434\u0430\u043B\u043E\u0441\u044C, \u0447\u0442\u043E ${issue2.origin} \u0431\u0443\u0434\u0435\u0442 ${adj}${issue2.minimum.toString()}`;
|
|
11242
11242
|
}
|
|
@@ -19583,10 +19583,10 @@ function fromJSONSchema(schema, params) {
|
|
|
19583
19583
|
} catch {
|
|
19584
19584
|
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
19585
19585
|
}
|
|
19586
|
-
const
|
|
19586
|
+
const version3 = detectVersion(normalized, params?.defaultTarget);
|
|
19587
19587
|
const defs = normalized.$defs || normalized.definitions || {};
|
|
19588
19588
|
const ctx = {
|
|
19589
|
-
version:
|
|
19589
|
+
version: version3,
|
|
19590
19590
|
defs,
|
|
19591
19591
|
refs: /* @__PURE__ */ new Map(),
|
|
19592
19592
|
processing: /* @__PURE__ */ new Set(),
|
|
@@ -19847,7 +19847,10 @@ var INVENTORY_LIMITS = Object.freeze({
|
|
|
19847
19847
|
images: 2e3,
|
|
19848
19848
|
pods: 1e3,
|
|
19849
19849
|
coverage: 64,
|
|
19850
|
-
ports: 32
|
|
19850
|
+
ports: 32,
|
|
19851
|
+
imagePackages: 6e3,
|
|
19852
|
+
tlsEndpoints: 16,
|
|
19853
|
+
health: 200
|
|
19851
19854
|
});
|
|
19852
19855
|
var inventoryIntervalSchema = external_exports.literal([...INVENTORY_INTERVALS_S]);
|
|
19853
19856
|
var inventorySettingsSchema = external_exports.strictObject({ enabled: external_exports.boolean(), interval_s: inventoryIntervalSchema });
|
|
@@ -19857,10 +19860,13 @@ var version2 = external_exports.string().max(128);
|
|
|
19857
19860
|
var bytes = external_exports.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
19858
19861
|
var time3 = external_exports.iso.datetime({ offset: true });
|
|
19859
19862
|
var PACKAGE_MANAGERS = ["dpkg", "rpm", "apk", "pacman", "brew", "brew-cask", "macos-app", "windows", "snap", "npm-global"];
|
|
19863
|
+
var PACKAGE_ORIGINS = ["distro", "esm", "third_party", "local", "unknown"];
|
|
19860
19864
|
var inventoryPackageSchema = external_exports.strictObject({
|
|
19861
19865
|
name,
|
|
19862
19866
|
version: version2,
|
|
19863
19867
|
manager: external_exports.enum(PACKAGE_MANAGERS),
|
|
19868
|
+
/** dpkg only, from `apt-cache policy`; absent from agents before 0.5.0. */
|
|
19869
|
+
origin: external_exports.enum(PACKAGE_ORIGINS).optional(),
|
|
19864
19870
|
arch: external_exports.string().max(32).optional(),
|
|
19865
19871
|
/** Installed size when the manager reports it. */
|
|
19866
19872
|
size_bytes: bytes.optional(),
|
|
@@ -19872,12 +19878,15 @@ var inventoryPackageSchema = external_exports.strictObject({
|
|
|
19872
19878
|
installed_on: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional()
|
|
19873
19879
|
});
|
|
19874
19880
|
var SOFTWARE_KINDS = ["runtime", "web_server", "database", "container_engine", "tool"];
|
|
19881
|
+
var SOFTWARE_INSTALLS = ["system", "homebrew", "local", "user", "other"];
|
|
19875
19882
|
var inventorySoftwareSchema = external_exports.strictObject({
|
|
19876
19883
|
/** Stable key such as `node`, `python`, `php`, `nginx`, `mysql`, `docker`. */
|
|
19877
19884
|
key: external_exports.string().min(1).max(40).regex(/^[a-z0-9][a-z0-9._-]*$/),
|
|
19878
19885
|
name,
|
|
19879
19886
|
version: version2,
|
|
19880
|
-
kind: external_exports.enum(SOFTWARE_KINDS)
|
|
19887
|
+
kind: external_exports.enum(SOFTWARE_KINDS),
|
|
19888
|
+
/** Agent 0.5.0 and newer report every installation of a runtime on PATH, one entry each. */
|
|
19889
|
+
install: external_exports.enum(SOFTWARE_INSTALLS).optional()
|
|
19881
19890
|
});
|
|
19882
19891
|
var SERVICE_STATES = ["running", "stopped", "failed", "starting", "stopping", "unknown"];
|
|
19883
19892
|
var inventoryServiceSchema = external_exports.strictObject({
|
|
@@ -19914,7 +19923,34 @@ var inventoryImageSchema = external_exports.strictObject({
|
|
|
19914
19923
|
size_bytes: bytes.optional(),
|
|
19915
19924
|
created_at: time3.optional(),
|
|
19916
19925
|
/** Containers (any state) that use the image. */
|
|
19917
|
-
containers: external_exports.number().int().nonnegative().optional()
|
|
19926
|
+
containers: external_exports.number().int().nonnegative().optional(),
|
|
19927
|
+
/** `ID` and `VERSION_ID` of the image's own os-release, set when its packages were read (ADR DOCKER_IMAGES). */
|
|
19928
|
+
distro_id: external_exports.string().max(40).optional(),
|
|
19929
|
+
distro_version: external_exports.string().max(40).optional()
|
|
19930
|
+
});
|
|
19931
|
+
var IMAGE_PACKAGE_MANAGERS = ["dpkg", "apk", "npm"];
|
|
19932
|
+
var inventoryImagePackageSchema = external_exports.strictObject({
|
|
19933
|
+
/** `images[].id` of the image the package is installed in. */
|
|
19934
|
+
image: external_exports.string().regex(/^[0-9a-f]{12}$/),
|
|
19935
|
+
manager: external_exports.enum(IMAGE_PACKAGE_MANAGERS),
|
|
19936
|
+
name,
|
|
19937
|
+
version: version2,
|
|
19938
|
+
/** dpkg source package and version, apk origin package (distribution advisories are keyed by them). */
|
|
19939
|
+
source_name: name.optional(),
|
|
19940
|
+
source_version: version2.optional()
|
|
19941
|
+
});
|
|
19942
|
+
var inventoryTlsEndpointSchema = external_exports.strictObject({
|
|
19943
|
+
port: external_exports.number().int().min(1).max(65535),
|
|
19944
|
+
/** Negotiated protocol: `TLSv1.3`, `TLSv1.2`, `TLSv1.1`, `TLSv1`. */
|
|
19945
|
+
protocol: external_exports.string().min(1).max(16),
|
|
19946
|
+
subject: shortText.optional(),
|
|
19947
|
+
issuer: shortText.optional(),
|
|
19948
|
+
not_before: time3.optional(),
|
|
19949
|
+
not_after: time3.optional(),
|
|
19950
|
+
/** Subject equals issuer: no certificate authority vouches for it. */
|
|
19951
|
+
self_signed: external_exports.boolean(),
|
|
19952
|
+
/** The `Strict-Transport-Security` header was present on `HEAD /` (HTTPS web ports only; absent when not checked). */
|
|
19953
|
+
hsts: external_exports.boolean().optional()
|
|
19918
19954
|
});
|
|
19919
19955
|
var inventoryPodSchema = external_exports.strictObject({
|
|
19920
19956
|
name,
|
|
@@ -19948,7 +19984,24 @@ var inventoryOsSchema = external_exports.strictObject({
|
|
|
19948
19984
|
distro_version: external_exports.string().max(40).optional(),
|
|
19949
19985
|
distro_codename: external_exports.string().max(40).optional(),
|
|
19950
19986
|
/** Raspberry Pi, VM vendor and similar from the device-tree or DMI model; never a serial number. */
|
|
19951
|
-
model: shortText.optional()
|
|
19987
|
+
model: shortText.optional(),
|
|
19988
|
+
/** `/proc/version_signature` on Ubuntu (`Ubuntu 6.8.0-31.31-generic 6.8.1`): the running kernel's package version. */
|
|
19989
|
+
kernel_signature: version2.optional(),
|
|
19990
|
+
/** A kernel live patch is loaded (`/sys/kernel/livepatch` has an entry); absent when not known. */
|
|
19991
|
+
livepatch: external_exports.boolean().optional()
|
|
19992
|
+
});
|
|
19993
|
+
var HEALTH_KINDS = ["log_error", "oom", "web_error", "job_failed", "crash", "event_error", "reboot_required"];
|
|
19994
|
+
var HEALTH_LEVELS = ["warning", "error", "critical"];
|
|
19995
|
+
var inventoryHealthEventSchema = external_exports.strictObject({
|
|
19996
|
+
/** systemd unit, syslog identifier, log file name (`nginx/error.log`), launchd label, process name or event provider. */
|
|
19997
|
+
source: external_exports.string().min(1).max(120),
|
|
19998
|
+
kind: external_exports.enum(HEALTH_KINDS),
|
|
19999
|
+
level: external_exports.enum(HEALTH_LEVELS),
|
|
20000
|
+
/** Redacted message template, at most LOG_TEMPLATE_MAX (300) characters. */
|
|
20001
|
+
template: external_exports.string().max(300),
|
|
20002
|
+
count: external_exports.number().int().positive().max(1e6),
|
|
20003
|
+
first_seen: time3.optional(),
|
|
20004
|
+
last_seen: time3.optional()
|
|
19952
20005
|
});
|
|
19953
20006
|
var inventorySnapshotSchema = external_exports.strictObject({
|
|
19954
20007
|
schema: external_exports.literal(1),
|
|
@@ -19960,7 +20013,13 @@ var inventorySnapshotSchema = external_exports.strictObject({
|
|
|
19960
20013
|
services: external_exports.array(inventoryServiceSchema).max(INVENTORY_LIMITS.services),
|
|
19961
20014
|
containers: external_exports.array(inventoryContainerSchema).max(INVENTORY_LIMITS.containers),
|
|
19962
20015
|
images: external_exports.array(inventoryImageSchema).max(INVENTORY_LIMITS.images),
|
|
20016
|
+
/** Packages read from the images in use by `syft`, when it is installed (agent 0.5.0 and newer). */
|
|
20017
|
+
image_packages: external_exports.array(inventoryImagePackageSchema).max(INVENTORY_LIMITS.imagePackages).optional(),
|
|
20018
|
+
/** TLS endpoints on well-known local ports (agent 0.5.0 and newer). */
|
|
20019
|
+
tls_endpoints: external_exports.array(inventoryTlsEndpointSchema).max(INVENTORY_LIMITS.tlsEndpoints).optional(),
|
|
19963
20020
|
pods: external_exports.array(inventoryPodSchema).max(INVENTORY_LIMITS.pods),
|
|
20021
|
+
/** Grouped errors of the last 24 hours (agent 0.5.0 and newer). */
|
|
20022
|
+
health: external_exports.array(inventoryHealthEventSchema).max(INVENTORY_LIMITS.health).optional(),
|
|
19964
20023
|
coverage: external_exports.array(inventoryCoverageSchema).max(INVENTORY_LIMITS.coverage)
|
|
19965
20024
|
});
|
|
19966
20025
|
|
|
@@ -19973,7 +20032,7 @@ var opaque = external_exports.string().min(1).max(128).regex(/^[A-Za-z0-9._:-]+$
|
|
|
19973
20032
|
var capability = external_exports.string().min(3).max(120).regex(/^[a-z][a-z0-9_.-]+$/);
|
|
19974
20033
|
var time4 = external_exports.iso.datetime({ offset: true });
|
|
19975
20034
|
var count = external_exports.number().int().nonnegative();
|
|
19976
|
-
var connector = external_exports.enum(["desktop", "browser", "vscode", "ssh", "wordpress", "
|
|
20035
|
+
var connector = external_exports.enum(["desktop", "browser", "vscode", "ssh", "wordpress", "joomla", "drupal", "prestashop", "opencart", "magento"]);
|
|
19977
20036
|
var state = external_exports.enum(["SUCCEEDED", "FAILED", "CANCELLED", "UNKNOWN", "EXPIRED"]);
|
|
19978
20037
|
var errorCode = external_exports.enum([
|
|
19979
20038
|
"AUTH_REQUIRED",
|
|
@@ -20170,17 +20229,17 @@ var ProtocolDecodeError = class extends Error {
|
|
|
20170
20229
|
};
|
|
20171
20230
|
var utf8 = new TextEncoder();
|
|
20172
20231
|
function sizedJson(value) {
|
|
20173
|
-
let
|
|
20232
|
+
let text6;
|
|
20174
20233
|
try {
|
|
20175
|
-
|
|
20234
|
+
text6 = JSON.stringify(value);
|
|
20176
20235
|
} catch {
|
|
20177
20236
|
throw new ProtocolDecodeError("INVALID_MESSAGE", "Invalid JSON value");
|
|
20178
20237
|
}
|
|
20179
|
-
if (typeof
|
|
20238
|
+
if (typeof text6 !== "string")
|
|
20180
20239
|
throw new ProtocolDecodeError("INVALID_MESSAGE", "Message is not JSON");
|
|
20181
|
-
if (utf8.encode(
|
|
20240
|
+
if (utf8.encode(text6).byteLength > MAX_ENVELOPE_BYTES)
|
|
20182
20241
|
throw new ProtocolDecodeError("SIZE_LIMIT", "Envelope exceeds 65536 bytes");
|
|
20183
|
-
return
|
|
20242
|
+
return text6;
|
|
20184
20243
|
}
|
|
20185
20244
|
function requireSemanticConstraints(message) {
|
|
20186
20245
|
if (message.kind === "HELLO" || message.kind === "ENROLL" || message.kind === "HEARTBEAT" || message.kind === "NEGOTIATE" || message.kind === "INVENTORY" || message.kind === "MONITOR_CONFIG" || message.kind === "METRICS" || message.kind === "SOFTWARE_INVENTORY_CONFIG" || message.kind === "SOFTWARE_INVENTORY_REQUEST" || message.kind === "SOFTWARE_INVENTORY_PART") {
|
|
@@ -20213,8 +20272,8 @@ function requireSemanticConstraints(message) {
|
|
|
20213
20272
|
function parseEnvelope(value) {
|
|
20214
20273
|
sizedJson(value);
|
|
20215
20274
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
20216
|
-
const
|
|
20217
|
-
if (
|
|
20275
|
+
const version3 = Reflect.get(value, "version");
|
|
20276
|
+
if (version3 !== WIRE_VERSION) {
|
|
20218
20277
|
throw new ProtocolDecodeError("PROTOCOL_VERSION_UNSUPPORTED", "Unsupported protocol version; supported: 1");
|
|
20219
20278
|
}
|
|
20220
20279
|
}
|
|
@@ -20228,7 +20287,7 @@ function decodeEnvelope(data) {
|
|
|
20228
20287
|
if (typeof data !== "string" && !(data instanceof Uint8Array)) {
|
|
20229
20288
|
throw new ProtocolDecodeError("INVALID_MESSAGE", "Expected UTF-8 JSON");
|
|
20230
20289
|
}
|
|
20231
|
-
const
|
|
20290
|
+
const text6 = typeof data === "string" ? data : (() => {
|
|
20232
20291
|
if (data.byteLength > MAX_ENVELOPE_BYTES)
|
|
20233
20292
|
throw new ProtocolDecodeError("SIZE_LIMIT", "Envelope exceeds 65536 bytes");
|
|
20234
20293
|
try {
|
|
@@ -20237,11 +20296,11 @@ function decodeEnvelope(data) {
|
|
|
20237
20296
|
throw new ProtocolDecodeError("INVALID_MESSAGE", "Invalid UTF-8 JSON");
|
|
20238
20297
|
}
|
|
20239
20298
|
})();
|
|
20240
|
-
if (utf8.encode(
|
|
20299
|
+
if (utf8.encode(text6).byteLength > MAX_ENVELOPE_BYTES)
|
|
20241
20300
|
throw new ProtocolDecodeError("SIZE_LIMIT", "Envelope exceeds 65536 bytes");
|
|
20242
20301
|
let value;
|
|
20243
20302
|
try {
|
|
20244
|
-
value = JSON.parse(
|
|
20303
|
+
value = JSON.parse(text6);
|
|
20245
20304
|
} catch {
|
|
20246
20305
|
throw new ProtocolDecodeError("INVALID_MESSAGE", "Invalid UTF-8 JSON");
|
|
20247
20306
|
}
|
|
@@ -20287,7 +20346,20 @@ var PRODUCT_NAMES = Object.freeze({
|
|
|
20287
20346
|
mysql: "MySQL",
|
|
20288
20347
|
mariadb: "MariaDB",
|
|
20289
20348
|
postgresql: "PostgreSQL",
|
|
20290
|
-
ruby: "Ruby"
|
|
20349
|
+
ruby: "Ruby",
|
|
20350
|
+
nginx: "nginx",
|
|
20351
|
+
redis: "Redis",
|
|
20352
|
+
golang: "Go",
|
|
20353
|
+
tomcat: "Apache Tomcat",
|
|
20354
|
+
haproxy: "HAProxy",
|
|
20355
|
+
rabbitmq: "RabbitMQ",
|
|
20356
|
+
mongodb: "MongoDB",
|
|
20357
|
+
memcached: "Memcached",
|
|
20358
|
+
elasticsearch: "Elasticsearch",
|
|
20359
|
+
traefik: "Traefik",
|
|
20360
|
+
caddy: "Caddy",
|
|
20361
|
+
httpd: "Apache HTTP Server",
|
|
20362
|
+
temurin: "Eclipse Temurin"
|
|
20291
20363
|
});
|
|
20292
20364
|
var EOL_TABLE = Object.freeze([
|
|
20293
20365
|
{ product: "ubuntu", cycle: "16.04", eol: "2021-04-30", extended: "Ubuntu Pro (ESM)" },
|
|
@@ -20352,10 +20424,11 @@ var SEVERITY_ORDER = Object.freeze({
|
|
|
20352
20424
|
});
|
|
20353
20425
|
var CATEGORY_ORDER = Object.freeze({
|
|
20354
20426
|
access: 0,
|
|
20355
|
-
|
|
20356
|
-
|
|
20357
|
-
|
|
20358
|
-
|
|
20427
|
+
vulnerability: 1,
|
|
20428
|
+
exposure: 2,
|
|
20429
|
+
lifecycle: 3,
|
|
20430
|
+
hygiene: 4,
|
|
20431
|
+
visibility: 5
|
|
20359
20432
|
});
|
|
20360
20433
|
var SOFTWARE_PRODUCTS = Object.freeze({
|
|
20361
20434
|
node: "node",
|
|
@@ -20376,7 +20449,20 @@ var IMAGE_PRODUCTS = Object.freeze({
|
|
|
20376
20449
|
ruby: "ruby",
|
|
20377
20450
|
ubuntu: "ubuntu",
|
|
20378
20451
|
debian: "debian",
|
|
20379
|
-
alpine: "alpine"
|
|
20452
|
+
alpine: "alpine",
|
|
20453
|
+
nginx: "nginx",
|
|
20454
|
+
redis: "redis",
|
|
20455
|
+
golang: "golang",
|
|
20456
|
+
tomcat: "tomcat",
|
|
20457
|
+
haproxy: "haproxy",
|
|
20458
|
+
rabbitmq: "rabbitmq",
|
|
20459
|
+
mongo: "mongodb",
|
|
20460
|
+
memcached: "memcached",
|
|
20461
|
+
elasticsearch: "elasticsearch",
|
|
20462
|
+
traefik: "traefik",
|
|
20463
|
+
caddy: "caddy",
|
|
20464
|
+
httpd: "httpd",
|
|
20465
|
+
"eclipse-temurin": "temurin"
|
|
20380
20466
|
});
|
|
20381
20467
|
|
|
20382
20468
|
// ../../packages/protocol/dist/security/intel.js
|
|
@@ -20403,7 +20489,49 @@ var CPE_PRODUCTS = Object.freeze({
|
|
|
20403
20489
|
caddy: { cpe: "caddyserver:caddy", scheme: "dotted", name: "Caddy", packaged: /^caddy$/ },
|
|
20404
20490
|
haproxy: { cpe: "haproxy:haproxy", scheme: "dotted", name: "HAProxy", packaged: /^haproxy$/ },
|
|
20405
20491
|
traefik: { cpe: "traefik:traefik", scheme: "dotted", name: "Traefik", packaged: /^traefik$/ },
|
|
20406
|
-
docker: { cpe: "docker:engine", scheme: "dotted", name: "Docker Engine", packaged: /^(docker\.io|docker-ce|moby-engine)$/ }
|
|
20492
|
+
docker: { cpe: "docker:engine", scheme: "dotted", name: "Docker Engine", packaged: /^(docker\.io|docker-ce|moby-engine)$/ },
|
|
20493
|
+
// CB-141 (ADR MACOS_APPS). Every vendor:product below was checked against the NVD CVE API on 2026-11-01.
|
|
20494
|
+
macos: { cpe: "apple:macos", scheme: "dotted", name: "macOS", part: "o", perMajor: true, packaged: /^$/ },
|
|
20495
|
+
chrome: { cpe: "google:chrome", scheme: "dotted", name: "Google Chrome", packaged: /^$/ },
|
|
20496
|
+
safari: { cpe: "apple:safari", scheme: "dotted", name: "Safari", packaged: /^$/ },
|
|
20497
|
+
wireshark: { cpe: "wireshark:wireshark", scheme: "dotted", name: "Wireshark", packaged: /^wireshark(-common)?$/ },
|
|
20498
|
+
rsync: { cpe: "samba:rsync", scheme: "dotted", name: "rsync", packaged: /^rsync$/ },
|
|
20499
|
+
gnupg: { cpe: "gnupg:gnupg", scheme: "dotted", name: "GnuPG", packaged: /^gnupg2?$/ },
|
|
20500
|
+
firefox: { cpe: "mozilla:firefox", scheme: "dotted", name: "Firefox", packaged: /^firefox(-esr)?$/ },
|
|
20501
|
+
thunderbird: { cpe: "mozilla:thunderbird", scheme: "dotted", name: "Thunderbird", packaged: /^thunderbird$/ },
|
|
20502
|
+
edge: { cpe: "microsoft:edge_chromium", scheme: "dotted", name: "Microsoft Edge", packaged: /^microsoft-edge-(stable|beta|dev)$/ },
|
|
20503
|
+
vscode: { cpe: "microsoft:visual_studio_code", scheme: "dotted", name: "Visual Studio Code", packaged: /^code(-insiders)?$/ },
|
|
20504
|
+
vlc: { cpe: "videolan:vlc_media_player", scheme: "dotted", name: "VLC", packaged: /^vlc$/ },
|
|
20505
|
+
wget: { cpe: "gnu:wget", scheme: "dotted", name: "GNU Wget", packaged: /^wget$/ },
|
|
20506
|
+
libxml2: { cpe: "xmlsoft:libxml2", scheme: "dotted", name: "libxml2", packaged: /^libxml2$/ },
|
|
20507
|
+
ffmpeg: { cpe: "ffmpeg:ffmpeg", scheme: "dotted", name: "FFmpeg", packaged: /^ffmpeg$/ },
|
|
20508
|
+
imagemagick: { cpe: "imagemagick:imagemagick", scheme: "dotted", name: "ImageMagick", packaged: /^imagemagick(-\d.*)?$/ },
|
|
20509
|
+
vim: { cpe: "vim:vim", scheme: "dotted", name: "Vim", packaged: /^vim(-.*)?$/ },
|
|
20510
|
+
libpng: { cpe: "libpng:libpng", scheme: "dotted", name: "libpng", packaged: /^libpng\d*$/ },
|
|
20511
|
+
bind: { cpe: "isc:bind", scheme: "dotted", name: "BIND", packaged: /^bind9$/ },
|
|
20512
|
+
tomcat: { cpe: "apache:tomcat", scheme: "dotted", name: "Apache Tomcat", packaged: /^tomcat\d*$/ },
|
|
20513
|
+
terraform: { cpe: "hashicorp:terraform", scheme: "dotted", name: "Terraform", packaged: /^terraform$/ },
|
|
20514
|
+
nmap: { cpe: "nmap:nmap", scheme: "dotted", name: "Nmap", packaged: /^nmap$/ },
|
|
20515
|
+
jq: { cpe: "jqlang:jq", scheme: "dotted", name: "jq", packaged: /^jq$/ },
|
|
20516
|
+
dockerdesktop: { cpe: "docker:desktop", scheme: "dotted", name: "Docker Desktop", packaged: /^$/ },
|
|
20517
|
+
zoom: { cpe: "zoom:zoom", scheme: "dotted", name: "Zoom", packaged: /^$/ },
|
|
20518
|
+
// CB-176 (ADR SECURITY_PLATFORM section 5.8): the OpenCart core, reported by its module; checked against the NVD CVE API
|
|
20519
|
+
// on 2026-11-05 (39 records). OpenCart is not published on Packagist with security advisories.
|
|
20520
|
+
opencart: { cpe: "opencart:opencart", scheme: "dotted", name: "OpenCart", packaged: /^$/ }
|
|
20521
|
+
});
|
|
20522
|
+
var MAC_APPS = Object.freeze({
|
|
20523
|
+
"google chrome": "chrome",
|
|
20524
|
+
safari: "safari",
|
|
20525
|
+
wireshark: "wireshark",
|
|
20526
|
+
firefox: "firefox",
|
|
20527
|
+
thunderbird: "thunderbird",
|
|
20528
|
+
"microsoft edge": "edge",
|
|
20529
|
+
"visual studio code": "vscode",
|
|
20530
|
+
vlc: "vlc",
|
|
20531
|
+
docker: "dockerdesktop",
|
|
20532
|
+
"docker desktop": "dockerdesktop",
|
|
20533
|
+
zoom: "zoom",
|
|
20534
|
+
"zoom.us": "zoom"
|
|
20407
20535
|
});
|
|
20408
20536
|
var EOL_SLUGS = Object.freeze({
|
|
20409
20537
|
ubuntu: "ubuntu",
|
|
@@ -20417,14 +20545,229 @@ var EOL_SLUGS = Object.freeze({
|
|
|
20417
20545
|
mysql: "mysql",
|
|
20418
20546
|
mariadb: "mariadb",
|
|
20419
20547
|
postgresql: "postgresql",
|
|
20420
|
-
ruby: "ruby"
|
|
20548
|
+
ruby: "ruby",
|
|
20549
|
+
// CB-142: container image bases (slugs checked against endoflife.date on 2026-11-01).
|
|
20550
|
+
nginx: "nginx",
|
|
20551
|
+
redis: "redis",
|
|
20552
|
+
golang: "go",
|
|
20553
|
+
tomcat: "tomcat",
|
|
20554
|
+
haproxy: "haproxy",
|
|
20555
|
+
rabbitmq: "rabbitmq",
|
|
20556
|
+
mongodb: "mongodb",
|
|
20557
|
+
memcached: "memcached",
|
|
20558
|
+
elasticsearch: "elasticsearch",
|
|
20559
|
+
traefik: "traefik",
|
|
20560
|
+
caddy: "caddy",
|
|
20561
|
+
httpd: "apache-http-server",
|
|
20562
|
+
temurin: "eclipse-temurin"
|
|
20421
20563
|
});
|
|
20422
20564
|
|
|
20565
|
+
// ../../packages/protocol/dist/security/redact.js
|
|
20566
|
+
var LOG_TEMPLATE_MAX = 300;
|
|
20567
|
+
var WHITESPACE_RUN = /[ \t\r\n\f\v]+/g;
|
|
20568
|
+
var URL_PATTERN = /[A-Za-z][A-Za-z0-9+.-]*:\/\/[^\s"']*/g;
|
|
20569
|
+
var EMAIL_PATTERN = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g;
|
|
20570
|
+
var IPV4_PATTERN = /(?<![\w.])(?:\d{1,3}\.){3}\d{1,3}(?::\d{1,5})?(?![\w.])/g;
|
|
20571
|
+
var IPV6_PATTERN = /(?<![\w:.])(?:\[[0-9A-Fa-f:]{2,}\](?::\d{1,5})?|[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{0,4}){2,})(?![\w:])/g;
|
|
20572
|
+
var UUID_PATTERN = /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/g;
|
|
20573
|
+
var HEX_RUN_PATTERN = /[0-9A-Fa-f]{16,}/g;
|
|
20574
|
+
var WINDOWS_PATH_PATTERN = /(?<![\w<>])[A-Za-z]:[\\/](?:[\w.-]+[\\/])*([\w.-]+)/g;
|
|
20575
|
+
var SEGMENT = String.raw`(?:[^\\/\s"'<>]+(?: [^\\/\s"'<>]+)+(?=[\\/])|[^\\/\s"'<>]+)`;
|
|
20576
|
+
var HOME_PATH_PATTERN = new RegExp(String.raw`(?<![\w.<>])(?:\/home|\/var\/home|\/Users|[A-Za-z]:[\\/]Users)[\\/]${SEGMENT}((?:[\\/]${SEGMENT})*)[\\/]?`, "g");
|
|
20577
|
+
var UNIX_PATH_PATTERN = /(?<![\w.<>])\/(?:[\w.-]+\/)+([\w.-]+)\/?/g;
|
|
20578
|
+
var QUERY_STRING_PATTERN = /\?(?:[^\s"'&?=]+=[^\s"'&]*)(?:&[^\s"'&?=]+=[^\s"'&]*)*/g;
|
|
20579
|
+
var DOUBLE_QUOTED_PATTERN = /(?<![^\s(\[{=:,])"[^"]{41,}"(?![^\s)\]},;:.])/g;
|
|
20580
|
+
var SINGLE_QUOTED_PATTERN = /(?<![^\s(\[{=:,])'[^']{41,}'(?![^\s)\]},;:.])/g;
|
|
20581
|
+
var WPDB_QUERY_PATTERN = /\bfor query\s.*?(?=\smade by\s|$)/gi;
|
|
20582
|
+
var SECRET_PAIR_PATTERN = /(["']?)\b(password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|auth|authorization|session|cookie)\1(\s*[=:]\s*)(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|(?!<secret>)[^\s&,;)"']+)/gi;
|
|
20583
|
+
var BEARER_PATTERN = /\b(Bearer|Basic)\s+(?!<secret>)[A-Za-z0-9._~+/=-]+/g;
|
|
20584
|
+
var NUMBER_PATTERN = /(?<![A-Za-z0-9_])\d+(?:\.\d+)?(?=(?:[kKMGT]i?B|[kKMGT]|ms|us|ns|s|%)?(?![A-Za-z0-9_]))/g;
|
|
20585
|
+
var UTF8_ENCODER = new TextEncoder();
|
|
20586
|
+
function escapeRegExp(value) {
|
|
20587
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
20588
|
+
}
|
|
20589
|
+
function stripRoots(text6, roots) {
|
|
20590
|
+
const candidates = roots.map((root) => root.trim().replace(/[\\/]+$/, "")).filter((root) => root.length > 0).sort((a, b) => b.length - a.length);
|
|
20591
|
+
let result2 = text6;
|
|
20592
|
+
for (const root of candidates) {
|
|
20593
|
+
const body = Array.from(root, (character) => character === "/" || character === "\\" ? "[/\\\\]" : escapeRegExp(character)).join("");
|
|
20594
|
+
const pattern = new RegExp(`(^|[^A-Za-z0-9._\\\\/-])${body}[/\\\\]`, "g");
|
|
20595
|
+
result2 = result2.replace(pattern, "$1");
|
|
20596
|
+
}
|
|
20597
|
+
return result2;
|
|
20598
|
+
}
|
|
20599
|
+
function isIpv6Address(value) {
|
|
20600
|
+
const groups = value.split(":");
|
|
20601
|
+
if (groups.length < 3)
|
|
20602
|
+
return false;
|
|
20603
|
+
let emptyGroups = 0;
|
|
20604
|
+
let hexGroups = 0;
|
|
20605
|
+
let hasHexLetter = false;
|
|
20606
|
+
for (const group3 of groups) {
|
|
20607
|
+
if (group3 === "") {
|
|
20608
|
+
emptyGroups += 1;
|
|
20609
|
+
continue;
|
|
20610
|
+
}
|
|
20611
|
+
if (!/^[0-9A-Fa-f]{1,4}$/.test(group3))
|
|
20612
|
+
return false;
|
|
20613
|
+
hexGroups += 1;
|
|
20614
|
+
if (/[A-Fa-f]/.test(group3))
|
|
20615
|
+
hasHexLetter = true;
|
|
20616
|
+
}
|
|
20617
|
+
if (emptyGroups > 2)
|
|
20618
|
+
return false;
|
|
20619
|
+
return value.includes("::") || hasHexLetter || hexGroups >= 4;
|
|
20620
|
+
}
|
|
20621
|
+
function redactIpv6(match) {
|
|
20622
|
+
if (match.startsWith("[")) {
|
|
20623
|
+
const end = match.indexOf("]");
|
|
20624
|
+
return isIpv6Address(match.slice(1, end)) ? "<ip>" : match;
|
|
20625
|
+
}
|
|
20626
|
+
return isIpv6Address(match) ? "<ip>" : match;
|
|
20627
|
+
}
|
|
20628
|
+
function redactHexRun(match) {
|
|
20629
|
+
return /[0-9]/.test(match) && /[A-Fa-f]/.test(match) ? "<id>" : match;
|
|
20630
|
+
}
|
|
20631
|
+
function redactLogMessage(message, options = {}) {
|
|
20632
|
+
if (typeof message !== "string")
|
|
20633
|
+
return "";
|
|
20634
|
+
let result2 = message.replace(WHITESPACE_RUN, " ").trim();
|
|
20635
|
+
if (result2 === "")
|
|
20636
|
+
return "";
|
|
20637
|
+
if (options.roots && options.roots.length > 0)
|
|
20638
|
+
result2 = stripRoots(result2, options.roots);
|
|
20639
|
+
result2 = result2.replace(WPDB_QUERY_PATTERN, "for query <sql>");
|
|
20640
|
+
result2 = result2.replace(BEARER_PATTERN, "$1 <secret>");
|
|
20641
|
+
result2 = result2.replace(SECRET_PAIR_PATTERN, "$1$2$1$3<secret>");
|
|
20642
|
+
result2 = result2.replace(URL_PATTERN, "<url>");
|
|
20643
|
+
result2 = result2.replace(EMAIL_PATTERN, "<email>");
|
|
20644
|
+
result2 = result2.replace(IPV4_PATTERN, "<ip>");
|
|
20645
|
+
result2 = result2.replace(IPV6_PATTERN, redactIpv6);
|
|
20646
|
+
result2 = result2.replace(UUID_PATTERN, "<id>");
|
|
20647
|
+
result2 = result2.replace(HEX_RUN_PATTERN, redactHexRun);
|
|
20648
|
+
result2 = result2.replace(HOME_PATH_PATTERN, (_match, rest) => {
|
|
20649
|
+
const last = rest.split(/[\\/]/).pop();
|
|
20650
|
+
return last ? `~/${last}` : "~";
|
|
20651
|
+
});
|
|
20652
|
+
result2 = result2.replace(WINDOWS_PATH_PATTERN, "<path>/$1");
|
|
20653
|
+
result2 = result2.replace(UNIX_PATH_PATTERN, "<path>/$1");
|
|
20654
|
+
result2 = result2.replace(QUERY_STRING_PATTERN, "?<query>");
|
|
20655
|
+
result2 = result2.replace(DOUBLE_QUOTED_PATTERN, '"<text>"');
|
|
20656
|
+
result2 = result2.replace(SINGLE_QUOTED_PATTERN, "'<text>'");
|
|
20657
|
+
result2 = result2.replace(NUMBER_PATTERN, "<n>");
|
|
20658
|
+
if (result2.length > LOG_TEMPLATE_MAX) {
|
|
20659
|
+
result2 = `${result2.slice(0, LOG_TEMPLATE_MAX - 1)}\u2026`;
|
|
20660
|
+
}
|
|
20661
|
+
return result2;
|
|
20662
|
+
}
|
|
20663
|
+
|
|
20423
20664
|
// ../../packages/protocol/dist/security/risk.js
|
|
20665
|
+
var RISK_RULES_VERSION = "2026-11-02.1";
|
|
20424
20666
|
var RATING_BASE = Object.freeze({ critical: 95, high: 80, medium: 55, low: 25, negligible: 10 });
|
|
20425
20667
|
var CRITICALITY_FACTOR = Object.freeze({ low: 0.8, normal: 1, high: 1.1, critical: 1.2 });
|
|
20426
20668
|
var CLASS_FACTOR = Object.freeze({ confirmed: 1, potential: 0.7, unknown: 0.5, not_affected: 0, fixed: 0 });
|
|
20427
20669
|
|
|
20670
|
+
// ../../packages/protocol/dist/security/components.js
|
|
20671
|
+
var COMPONENT_RULES_VERSION = "2026-11-05.1";
|
|
20672
|
+
var THIRD_PARTY_VERSION_PATTERNS = Object.freeze([
|
|
20673
|
+
/nodesource/i,
|
|
20674
|
+
/deb\.sury\.org/i,
|
|
20675
|
+
/~(ubuntu|debian|raspbian)\.\d+(\.\d+)*~[a-z]+$/i,
|
|
20676
|
+
/\+ubuntu\d+\.\d+(\.\d+)?\+deb\.sury\.org/i,
|
|
20677
|
+
/-\d+~[a-z]+$/
|
|
20678
|
+
]);
|
|
20679
|
+
var INSTALL_LABELS = Object.freeze({
|
|
20680
|
+
system: "system",
|
|
20681
|
+
homebrew: "Homebrew",
|
|
20682
|
+
local: "local install",
|
|
20683
|
+
user: "user install",
|
|
20684
|
+
other: "other install"
|
|
20685
|
+
});
|
|
20686
|
+
|
|
20687
|
+
// ../../packages/protocol/dist/security/site-status.js
|
|
20688
|
+
var SITE_ABANDONED_AFTER_MS = 2 * 365 * 24 * 36e5;
|
|
20689
|
+
|
|
20690
|
+
// ../../packages/protocol/dist/security/platform-components.js
|
|
20691
|
+
var PLATFORM_CORE_COMPONENTS = Object.freeze({
|
|
20692
|
+
drupal: { ecosystem: "Packagist", name: "drupal/core" },
|
|
20693
|
+
joomla: { ecosystem: "Packagist", name: "joomla/joomla-cms" },
|
|
20694
|
+
prestashop: { ecosystem: "Packagist", name: "prestashop/prestashop" },
|
|
20695
|
+
opencart: { ecosystem: "cpe", name: "opencart:opencart" },
|
|
20696
|
+
magento: { ecosystem: "Packagist", name: "magento/product-community-edition" }
|
|
20697
|
+
});
|
|
20698
|
+
var PLATFORM_NAMES = Object.freeze({
|
|
20699
|
+
drupal: "Drupal",
|
|
20700
|
+
joomla: "Joomla",
|
|
20701
|
+
prestashop: "PrestaShop",
|
|
20702
|
+
opencart: "OpenCart",
|
|
20703
|
+
magento: "Magento"
|
|
20704
|
+
});
|
|
20705
|
+
|
|
20706
|
+
// ../../packages/protocol/dist/security/buckets.js
|
|
20707
|
+
var BUCKET_RULES_VERSION = "2026-11-02.1";
|
|
20708
|
+
|
|
20709
|
+
// ../../packages/protocol/dist/security/matching.js
|
|
20710
|
+
var MATCHING_RULES_VERSION = "2026-11-02.1";
|
|
20711
|
+
var EVALUATION_RULES_VERSION = [COMPONENT_RULES_VERSION, MATCHING_RULES_VERSION, RISK_RULES_VERSION, BUCKET_RULES_VERSION].join("+");
|
|
20712
|
+
|
|
20713
|
+
// ../../packages/protocol/dist/security/jev.js
|
|
20714
|
+
var JEV_ROUTES = ["patch_now", "schedule_maintenance", "mitigate_first", "verify_first", "monitor"];
|
|
20715
|
+
var JEV_URGENCY_LEVELS = Object.freeze([
|
|
20716
|
+
"Routine: handle in normal maintenance",
|
|
20717
|
+
"Soon: within a few weeks",
|
|
20718
|
+
"Urgent: within days",
|
|
20719
|
+
"Immediate: act today"
|
|
20720
|
+
]);
|
|
20721
|
+
var QUESTIONS = Object.freeze({
|
|
20722
|
+
urgency: {
|
|
20723
|
+
type: "score",
|
|
20724
|
+
instructions: "How urgently should the owner of the affected assets act on this software vulnerability?",
|
|
20725
|
+
criteria: [...JEV_URGENCY_LEVELS]
|
|
20726
|
+
},
|
|
20727
|
+
route: {
|
|
20728
|
+
type: "choice",
|
|
20729
|
+
instructions: "What is the best next step for the owner?",
|
|
20730
|
+
criteria: {
|
|
20731
|
+
patch_now: "Apply the fix as soon as possible",
|
|
20732
|
+
schedule_maintenance: "Apply the fix in the next planned maintenance window",
|
|
20733
|
+
mitigate_first: "No fix is available or applying it is risky: reduce exposure first",
|
|
20734
|
+
verify_first: "The match is only potential: confirm that the software is really affected before acting",
|
|
20735
|
+
monitor: "No action now; keep watching"
|
|
20736
|
+
}
|
|
20737
|
+
},
|
|
20738
|
+
exploitation: { type: "noul", instructions: "Is exploitation of this vulnerability in the wild likely in the near term?" }
|
|
20739
|
+
});
|
|
20740
|
+
var unit = external_exports.number().min(0).max(1);
|
|
20741
|
+
var ANSWER = external_exports.object({
|
|
20742
|
+
model: external_exports.string().min(1).max(100),
|
|
20743
|
+
answers: external_exports.object({
|
|
20744
|
+
urgency: external_exports.object({ type: external_exports.literal("score"), score: external_exports.number().min(0).max(3), confidence: unit }),
|
|
20745
|
+
route: external_exports.object({ type: external_exports.literal("choice"), choice: external_exports.enum(JEV_ROUTES), confidence: unit, probabilities: external_exports.record(external_exports.string(), unit) }),
|
|
20746
|
+
exploitation: external_exports.object({ type: external_exports.literal("noul"), noul: unit })
|
|
20747
|
+
})
|
|
20748
|
+
});
|
|
20749
|
+
var group = (cls, kind, criticality, count3 = 1) => ({ class: cls, asset_kind: kind, criticality, count: count3 });
|
|
20750
|
+
var evalCase = (id, partial2) => ({
|
|
20751
|
+
id,
|
|
20752
|
+
input: { advisory_id: `CVE-2026-9${id.padStart(4, "0")}`, cvss: null, rating: null, cwes: [], kev: false, epss_percentile: null, fix_available: true, ecosystem: "npm", groups: [group("confirmed", "device", "normal")], ...partial2 }
|
|
20753
|
+
});
|
|
20754
|
+
var JEV_EVAL_CASES = Object.freeze([
|
|
20755
|
+
evalCase("1", { top_band: "critical", cvss: 9.8, rating: "critical", kev: true, epss_percentile: 0.99, groups: [group("confirmed", "site", "critical", 3)] }),
|
|
20756
|
+
evalCase("2", { top_band: "critical", cvss: 9.1, rating: "critical", epss_percentile: 0.97, fix_available: false, groups: [group("confirmed", "device", "high", 2)] }),
|
|
20757
|
+
evalCase("3", { top_band: "high", cvss: 8.1, rating: "high", epss_percentile: 0.85, groups: [group("confirmed", "device", "normal", 5)] }),
|
|
20758
|
+
evalCase("4", { top_band: "high", cvss: 7.5, rating: "high", fix_available: false, groups: [group("confirmed", "site", "high")] }),
|
|
20759
|
+
evalCase("5", { top_band: "high", cvss: 7.8, rating: "high", ecosystem: "Debian:12", groups: [group("confirmed", "ssh", "critical", 4)] }),
|
|
20760
|
+
evalCase("6", { top_band: "medium", cvss: 5.5, rating: "medium", groups: [group("confirmed", "device", "normal", 12)] }),
|
|
20761
|
+
evalCase("7", { top_band: "medium", cvss: 6.1, rating: "medium", fix_available: false, groups: [group("confirmed", "device", "low")] }),
|
|
20762
|
+
evalCase("8", { top_band: "medium", cvss: 6.5, rating: "medium", ecosystem: "Packagist", groups: [group("confirmed", "site", "normal", 2)] }),
|
|
20763
|
+
evalCase("9", { top_band: "low", cvss: 3.1, rating: "low", groups: [group("confirmed", "device", "low", 20)] }),
|
|
20764
|
+
evalCase("10", { top_band: "low", cvss: 2.4, rating: "low", fix_available: false, groups: [group("confirmed", "device", "normal")] }),
|
|
20765
|
+
evalCase("11", { top_band: "high", cvss: 8.8, rating: "high", kev: true, groups: [group("potential", "device", "high", 3)] }),
|
|
20766
|
+
evalCase("12", { top_band: "medium", cvss: 5.9, rating: "medium", groups: [group("potential", "site", "normal", 2)] }),
|
|
20767
|
+
evalCase("13", { top_band: "critical", cvss: 9.8, rating: "critical", ecosystem: "cpe", groups: [group("potential", "device", "critical")] }),
|
|
20768
|
+
evalCase("14", { top_band: "low", cvss: 3.7, rating: "low", groups: [group("unknown", "device", "low")] })
|
|
20769
|
+
]);
|
|
20770
|
+
|
|
20428
20771
|
// ../../packages/protocol/dist/http.js
|
|
20429
20772
|
var HTTP_API_VERSION = 1;
|
|
20430
20773
|
var requestIdSchema = external_exports.uuid();
|
|
@@ -20507,22 +20850,20 @@ var unservedVerifiedOverviewSchema = external_exports.strictObject({
|
|
|
20507
20850
|
});
|
|
20508
20851
|
|
|
20509
20852
|
// ../../packages/protocol/dist/connectors/registry.js
|
|
20510
|
-
var SITE_PLATFORMS = Object.freeze(["
|
|
20511
|
-
var CONNECTOR_KINDS = Object.freeze(["desktop", "browser", "vscode", "wordpress", ...SITE_PLATFORMS]);
|
|
20853
|
+
var SITE_PLATFORMS = Object.freeze(["joomla", "drupal", "prestashop", "opencart", "magento"]);
|
|
20854
|
+
var CONNECTOR_KINDS = Object.freeze(["desktop", "browser", "vscode", "wordpress", ...SITE_PLATFORMS, "github"]);
|
|
20512
20855
|
var CAPABILITY_RISKS = Object.freeze(["read", "write", "privileged"]);
|
|
20513
20856
|
var CONNECTOR_NAMESPACES = Object.freeze({
|
|
20514
20857
|
desktop: Object.freeze(["files.", "ssh.", "shell.", "process.", "system."]),
|
|
20515
20858
|
browser: Object.freeze(["browser."]),
|
|
20516
20859
|
vscode: Object.freeze(["vscode."]),
|
|
20517
20860
|
wordpress: Object.freeze(["wp.", "elementor.", "wordpress."]),
|
|
20518
|
-
shopify: Object.freeze(["shopify."]),
|
|
20519
|
-
wix: Object.freeze(["wix."]),
|
|
20520
|
-
squarespace: Object.freeze(["squarespace."]),
|
|
20521
|
-
webflow: Object.freeze(["webflow."]),
|
|
20522
20861
|
joomla: Object.freeze(["joomla."]),
|
|
20523
20862
|
drupal: Object.freeze(["drupal."]),
|
|
20524
20863
|
prestashop: Object.freeze(["prestashop."]),
|
|
20525
|
-
opencart: Object.freeze(["opencart."])
|
|
20864
|
+
opencart: Object.freeze(["opencart."]),
|
|
20865
|
+
magento: Object.freeze(["magento."]),
|
|
20866
|
+
github: Object.freeze(["github."])
|
|
20526
20867
|
});
|
|
20527
20868
|
var CAPABILITY_NAME = /^[a-z][a-z0-9_.-]+$/;
|
|
20528
20869
|
var registry2 = /* @__PURE__ */ new Map();
|
|
@@ -20940,960 +21281,235 @@ var VSCODE_CAPABILITY_DEFINITIONS = Object.freeze([
|
|
|
20940
21281
|
{ connector: "vscode", capability: "vscode.edit.apply", risk: "write", description: "Apply edits after your approval", payload: vscodePayloadSchemas["vscode.edit.apply"] }
|
|
20941
21282
|
]);
|
|
20942
21283
|
|
|
20943
|
-
// ../../packages/protocol/dist/connectors/
|
|
20944
|
-
var
|
|
20945
|
-
|
|
20946
|
-
"
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
"wp
|
|
20955
|
-
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
20963
|
-
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
var
|
|
20971
|
-
var
|
|
20972
|
-
var
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
"
|
|
20977
|
-
"
|
|
20978
|
-
"
|
|
20979
|
-
"
|
|
20980
|
-
"
|
|
20981
|
-
"wpforms-lite",
|
|
20982
|
-
"updraftplus",
|
|
20983
|
-
"redirection",
|
|
20984
|
-
"classic-editor",
|
|
20985
|
-
"wp-super-cache"
|
|
21284
|
+
// ../../packages/protocol/dist/connectors/site-security.js
|
|
21285
|
+
var CMS_PLATFORMS = Object.freeze(["wordpress", ...SITE_PLATFORMS]);
|
|
21286
|
+
var CMS_PROTECTED_SLUGS = Object.freeze({
|
|
21287
|
+
wordpress: Object.freeze(["conbridge-connector/conbridge-connector.php", "mcp-adapter/mcp-adapter.php", "conbridge-connector", "mcp-adapter"]),
|
|
21288
|
+
drupal: Object.freeze(["conbridge"]),
|
|
21289
|
+
joomla: Object.freeze(["com_conbridge", "conbridge", "pkg_conbridge", "plg_system_conbridge"]),
|
|
21290
|
+
prestashop: Object.freeze(["conbridge"]),
|
|
21291
|
+
opencart: Object.freeze(["conbridge"]),
|
|
21292
|
+
magento: Object.freeze(["conbridge/module-connector", "ConBridge_Connector"])
|
|
21293
|
+
});
|
|
21294
|
+
function cmsNamespace(platform2) {
|
|
21295
|
+
return platform2 === "wordpress" ? "wp" : platform2;
|
|
21296
|
+
}
|
|
21297
|
+
var SITE_SECURITY_LIMITS = Object.freeze({
|
|
21298
|
+
/** Largest status document stored (`site_inventory.status_json` CHECK) and largest live answer handed to an AI app. */
|
|
21299
|
+
statusMaxBytes: 256 * 1024,
|
|
21300
|
+
/** Extensions listed in one status; `extensions_total` above it means partial coverage. */
|
|
21301
|
+
extensionCap: 500,
|
|
21302
|
+
errorGroups: 100,
|
|
21303
|
+
healthChecks: 64,
|
|
21304
|
+
cacheBackends: 20,
|
|
21305
|
+
purgeBackends: 10,
|
|
21306
|
+
slugChars: 200,
|
|
21307
|
+
nameChars: 100,
|
|
21308
|
+
versionChars: 64,
|
|
21309
|
+
templateChars: 300
|
|
21310
|
+
});
|
|
21311
|
+
var SITE_SECURITY_TIMEOUTS = Object.freeze({ read: 2e4, purge: 3e4, updateStart: 2e4, jobStatus: 1e4, setActive: 3e4 });
|
|
21312
|
+
var SITE_OPERATION_DEADLINE_MS = 30 * 6e4;
|
|
21313
|
+
var SITE_SECURITY_FAMILIES = Object.freeze([
|
|
21314
|
+
"security.status",
|
|
21315
|
+
"errors",
|
|
21316
|
+
"health",
|
|
21317
|
+
"cache.status",
|
|
21318
|
+
"cache.purge",
|
|
21319
|
+
"extension.set_active",
|
|
21320
|
+
"update.run",
|
|
21321
|
+
"update.status"
|
|
20986
21322
|
]);
|
|
20987
|
-
var
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
|
|
20993
|
-
|
|
20994
|
-
|
|
20995
|
-
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
return Object.entries(value).some(([key, inner]) => key === "__proto__" || key === "constructor" || key === "prototype" || hasProtoKey(inner, depth + 1));
|
|
21014
|
-
}
|
|
21015
|
-
var postId = external_exports.number().int().min(1).max(2147483647);
|
|
21016
|
-
var postType = external_exports.enum(WORDPRESS_POST_TYPES);
|
|
21017
|
-
var title = external_exports.string().min(1).max(MAX_DRAFT_TITLE_CHARS).refine((value) => value.trim().length > 0, "title must not be blank");
|
|
21018
|
-
var excerpt = external_exports.string().max(MAX_DRAFT_EXCERPT_CHARS);
|
|
21019
|
-
var content = external_exports.string().refine((value) => new TextEncoder().encode(value).byteLength <= MAX_DRAFT_CONTENT_BYTES, `content exceeds ${MAX_DRAFT_CONTENT_BYTES} bytes`);
|
|
21020
|
-
var taxonomy = external_exports.enum(WORDPRESS_TAXONOMIES);
|
|
21021
|
-
var termName = external_exports.string().min(1).max(100).refine((value) => value.trim().length > 0, "name must not be blank");
|
|
21022
|
-
var menuTitle = external_exports.string().min(1).max(200).refine((value) => value.trim().length > 0, "title must not be blank");
|
|
21023
|
-
var pluginFile = external_exports.string().min(5).max(200).regex(/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9._-]+)?\.php$/, "plugin file must look like folder/file.php");
|
|
21024
|
-
var css = external_exports.string().max(MAX_CSS_BYTES * 2).refine((value) => new TextEncoder().encode(value).byteLength <= MAX_CSS_BYTES, `css exceeds ${MAX_CSS_BYTES} bytes`).refine((value) => !/<\/?\s*style|<!--|<script|@import|@[\w-]*\\|expression\s*\(|javascript:|behavior\s*:|-moz-binding/i.test(value), "css contains a construct that is not allowed");
|
|
21323
|
+
var FAMILY_CAPABILITY = Object.freeze({
|
|
21324
|
+
"security.status": "security.status",
|
|
21325
|
+
errors: "errors.list",
|
|
21326
|
+
health: "health.get",
|
|
21327
|
+
"cache.status": "cache.status",
|
|
21328
|
+
"cache.purge": "cache.purge",
|
|
21329
|
+
"extension.set_active": "extension.set_active",
|
|
21330
|
+
"update.run": "update.run",
|
|
21331
|
+
"update.status": "update.status"
|
|
21332
|
+
});
|
|
21333
|
+
function siteSecurityCapability(platform2, family) {
|
|
21334
|
+
return `${cmsNamespace(platform2)}.${FAMILY_CAPABILITY[family]}`;
|
|
21335
|
+
}
|
|
21336
|
+
var SITE_SECURITY_MATRIX = Object.freeze({
|
|
21337
|
+
wordpress: SITE_SECURITY_FAMILIES,
|
|
21338
|
+
drupal: Object.freeze(["security.status", "errors", "health", "cache.status", "cache.purge"]),
|
|
21339
|
+
joomla: SITE_SECURITY_FAMILIES,
|
|
21340
|
+
prestashop: Object.freeze(["security.status", "errors", "health", "cache.status", "cache.purge", "extension.set_active"]),
|
|
21341
|
+
opencart: Object.freeze(["security.status", "errors", "health", "cache.status", "cache.purge", "extension.set_active"]),
|
|
21342
|
+
magento: Object.freeze(["security.status", "errors", "health", "cache.status", "cache.purge"])
|
|
21343
|
+
});
|
|
21344
|
+
var siteSlug = external_exports.string().min(1).max(SITE_SECURITY_LIMITS.slugChars).regex(/^[A-Za-z0-9_][A-Za-z0-9_.:@/+-]*$/, "slug must be the extension id as site_get_security_status lists it").refine((value) => !value.split("/").some((part) => part === ".." || part === "." || part === ""), "slug must not contain empty, . or .. segments");
|
|
21345
|
+
var siteExtensionType = external_exports.string().regex(/^[a-z][a-z0-9_]{0,31}$/, "type must be the extension type");
|
|
21346
|
+
var siteVersion = external_exports.string().min(1).max(SITE_SECURITY_LIMITS.versionChars).regex(/^[A-Za-z0-9][A-Za-z0-9._+~-]*$/, "invalid version");
|
|
21347
|
+
var siteBackendId = external_exports.string().min(1).max(64).regex(/^[A-Za-z0-9_.:-]+$/, "invalid cache backend id");
|
|
21348
|
+
var SITE_UPDATE_KINDS = Object.freeze(["core", "plugin", "theme", "extension"]);
|
|
21025
21349
|
var writeKeys = { idempotency_key: external_exports.uuid(), approval_id: external_exports.uuid() };
|
|
21026
|
-
var
|
|
21027
|
-
var
|
|
21028
|
-
var
|
|
21029
|
-
var
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
} catch {
|
|
21040
|
-
return false;
|
|
21041
|
-
}
|
|
21042
|
-
}, `values must name 1-${MAX_FIELD_VALUES} fields (names up to ${MAX_FIELD_NAME_CHARS} characters) with at most ${MAX_FIELD_VALUES_BYTES / 1024} KiB of values`);
|
|
21043
|
-
var wordpressPayloadSchemas = {
|
|
21044
|
-
"wp.posts.list": external_exports.strictObject({
|
|
21045
|
-
post_type: postType.optional(),
|
|
21046
|
-
per_page: external_exports.number().int().min(1).max(20).optional(),
|
|
21047
|
-
page: external_exports.number().int().min(1).max(100).optional()
|
|
21048
|
-
}),
|
|
21049
|
-
"wp.posts.get": external_exports.strictObject({ id: postId }),
|
|
21050
|
-
"elementor.page.structure": external_exports.strictObject({ post_id: postId }),
|
|
21051
|
-
"wp.draft.create": external_exports.strictObject({
|
|
21052
|
-
post_type: postType.optional(),
|
|
21053
|
-
title,
|
|
21054
|
-
content: content.optional(),
|
|
21055
|
-
excerpt: excerpt.optional(),
|
|
21056
|
-
/** Client-chosen key: a second task with the same key on the same site never creates a second draft. */
|
|
21057
|
-
idempotency_key: external_exports.uuid(),
|
|
21058
|
-
approval_id: external_exports.uuid()
|
|
21059
|
-
}),
|
|
21060
|
-
"wp.draft.update": external_exports.strictObject({
|
|
21061
|
-
id: postId,
|
|
21062
|
-
title: title.optional(),
|
|
21063
|
-
excerpt: excerpt.optional(),
|
|
21064
|
-
idempotency_key: external_exports.uuid(),
|
|
21065
|
-
approval_id: external_exports.uuid()
|
|
21066
|
-
}).refine((value) => value.title !== void 0 || value.excerpt !== void 0, "title or excerpt is required"),
|
|
21067
|
-
"wp.site.status": external_exports.strictObject({}),
|
|
21068
|
-
"wp.terms.list": external_exports.strictObject({ taxonomy, per_page: external_exports.number().int().min(1).max(50).optional(), page: external_exports.number().int().min(1).max(100).optional() }),
|
|
21069
|
-
"wp.menus.list": external_exports.strictObject({}),
|
|
21070
|
-
"wp.media.list": external_exports.strictObject({ per_page: external_exports.number().int().min(1).max(20).optional(), page: external_exports.number().int().min(1).max(100).optional(), media_type: external_exports.enum(["image", "video", "audio", "application"]).optional() }),
|
|
21071
|
-
"wp.css.get": external_exports.strictObject({}),
|
|
21072
|
-
"wp.term.create": external_exports.strictObject({ taxonomy, name: termName, parent: postId.optional(), ...writeKeys }),
|
|
21073
|
-
"wp.menu.item.add": external_exports.strictObject({
|
|
21074
|
-
menu_id: postId,
|
|
21075
|
-
title: menuTitle,
|
|
21076
|
-
/** A page or post of the site, or an https link. Exactly one of the two. */
|
|
21077
|
-
object_id: postId.optional(),
|
|
21078
|
-
url: external_exports.url({ protocol: /^https$/ }).max(500).optional(),
|
|
21079
|
-
parent_item_id: postId.optional(),
|
|
21080
|
-
...writeKeys
|
|
21081
|
-
}).refine((value) => value.object_id === void 0 !== (value.url === void 0), "give exactly one of object_id or url"),
|
|
21082
|
-
"wp.plugin.install": external_exports.strictObject({ slug: external_exports.enum(WORDPRESS_PLUGIN_ALLOWLIST), ...writeKeys }),
|
|
21083
|
-
"wp.plugin.activate": external_exports.strictObject({ plugin_file: pluginFile, ...writeKeys }),
|
|
21084
|
-
"wp.plugin.deactivate": external_exports.strictObject({ plugin_file: pluginFile, ...writeKeys }).refine((value) => !WORDPRESS_PROTECTED_PLUGINS.includes(value.plugin_file), "this plugin is needed by ConBridge"),
|
|
21085
|
-
"wp.css.update": external_exports.strictObject({ css, ...writeKeys }),
|
|
21086
|
-
"wp.abilities.list": external_exports.strictObject({}),
|
|
21087
|
-
"wp.ability.info": external_exports.strictObject({ ability_name: abilityName }),
|
|
21088
|
-
"elementor.tools.list": external_exports.strictObject({}),
|
|
21089
|
-
"wp.ability.run": external_exports.strictObject({ ability_name: abilityName, parameters: jsonObject.optional(), ...writeKeys }),
|
|
21090
|
-
"elementor.tool.call": external_exports.strictObject({ tool_name: elementorToolName, arguments: jsonObject.optional(), ...writeKeys }),
|
|
21091
|
-
"wordpress.fields.groups": external_exports.strictObject({ post_type: fieldPostType.optional(), post_id: postId.optional() }),
|
|
21092
|
-
"wordpress.fields.read": external_exports.strictObject({ post_id: postId }),
|
|
21093
|
-
"wordpress.fields.update": external_exports.strictObject({ post_id: postId, values: fieldValues, ...writeKeys })
|
|
21350
|
+
var sitePurgeInputSchema = external_exports.strictObject({ backends: external_exports.array(siteBackendId).min(1).max(SITE_SECURITY_LIMITS.purgeBackends).optional() });
|
|
21351
|
+
var siteUpdateInputSchema = external_exports.strictObject({ kind: external_exports.enum(SITE_UPDATE_KINDS), slug: siteSlug.optional(), to_version: siteVersion.optional() }).refine((value) => value.kind === "core" === (value.slug === void 0), "slug is required for plugin, theme and extension updates and not allowed for core");
|
|
21352
|
+
var siteSetActiveInputSchema = external_exports.strictObject({ type: siteExtensionType, slug: siteSlug, active: external_exports.boolean() });
|
|
21353
|
+
var siteSecurityPayloadSchemas = {
|
|
21354
|
+
"security.status": external_exports.strictObject({}),
|
|
21355
|
+
errors: external_exports.strictObject({ window: external_exports.enum(["24h", "7d"]), include_notices: external_exports.boolean(), limit: external_exports.number().int().min(1).max(SITE_SECURITY_LIMITS.errorGroups).optional() }),
|
|
21356
|
+
health: external_exports.strictObject({}),
|
|
21357
|
+
"cache.status": external_exports.strictObject({}),
|
|
21358
|
+
"cache.purge": external_exports.strictObject({ ...sitePurgeInputSchema.shape, ...writeKeys }),
|
|
21359
|
+
"extension.set_active": external_exports.strictObject({ ...siteSetActiveInputSchema.shape, ...writeKeys }),
|
|
21360
|
+
"update.run": external_exports.strictObject({ kind: external_exports.enum(SITE_UPDATE_KINDS), slug: siteSlug.optional(), to_version: siteVersion.optional(), ...writeKeys }).refine((value) => value.kind === "core" === (value.slug === void 0), "slug is required for plugin, theme and extension updates and not allowed for core"),
|
|
21361
|
+
/** The Gateway's own operation id: the site's job id never comes from an AI app. */
|
|
21362
|
+
"update.status": external_exports.strictObject({ operation_id: external_exports.uuid() })
|
|
21094
21363
|
};
|
|
21095
|
-
var
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21099
|
-
|
|
21100
|
-
|
|
21101
|
-
|
|
21102
|
-
{
|
|
21103
|
-
|
|
21104
|
-
|
|
21105
|
-
|
|
21106
|
-
|
|
21107
|
-
|
|
21108
|
-
|
|
21109
|
-
|
|
21110
|
-
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21117
|
-
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21121
|
-
|
|
21122
|
-
|
|
21123
|
-
|
|
21124
|
-
|
|
21125
|
-
|
|
21126
|
-
cursorChars: 512,
|
|
21127
|
-
queryChars: 100,
|
|
21128
|
-
titleChars: 255,
|
|
21129
|
-
excerptChars: 1e3,
|
|
21130
|
-
seoTitleChars: 255,
|
|
21131
|
-
seoDescriptionChars: 1e3,
|
|
21132
|
-
bodyHtmlBytes: 48 * 1024,
|
|
21133
|
-
listLimitMax: 50,
|
|
21134
|
-
listLimitDefault: 20,
|
|
21135
|
-
variantsMax: 50,
|
|
21136
|
-
quantityMax: 1e6,
|
|
21137
|
-
apiPathChars: 512,
|
|
21138
|
-
apiQueryEntries: 20,
|
|
21139
|
-
apiBodyBytes: 48 * 1024,
|
|
21140
|
-
/** Largest answer of a raw call handed to the AI app (the stored result is `outputSummary` only). */
|
|
21141
|
-
apiAnswerBytes: 1024 * 1024
|
|
21142
|
-
});
|
|
21143
|
-
var utf8Bytes = (value) => new TextEncoder().encode(value).byteLength;
|
|
21144
|
-
var notBlank = (value) => value.trim().length > 0;
|
|
21145
|
-
var siteId = external_exports.string().min(1).max(SITE_LIMITS.idChars).regex(/^[A-Za-z0-9:/._-]+$/, "invalid id");
|
|
21146
|
-
var siteCursor = external_exports.string().min(1).max(SITE_LIMITS.cursorChars);
|
|
21147
|
-
var siteQuery = external_exports.string().min(1).max(SITE_LIMITS.queryChars);
|
|
21148
|
-
var siteListLimit = external_exports.number().int().min(1).max(SITE_LIMITS.listLimitMax);
|
|
21149
|
-
var siteTitle = external_exports.string().min(1).max(SITE_LIMITS.titleChars).refine(notBlank, "title must not be blank");
|
|
21150
|
-
var siteExcerpt = external_exports.string().max(SITE_LIMITS.excerptChars);
|
|
21151
|
-
var siteSeoTitle = external_exports.string().max(SITE_LIMITS.seoTitleChars);
|
|
21152
|
-
var siteSeoDescription = external_exports.string().max(SITE_LIMITS.seoDescriptionChars);
|
|
21153
|
-
var siteBodyHtml = external_exports.string().max(SITE_LIMITS.bodyHtmlBytes).refine((value) => utf8Bytes(value) <= SITE_LIMITS.bodyHtmlBytes, `body_html exceeds ${SITE_LIMITS.bodyHtmlBytes} bytes`);
|
|
21154
|
-
var sitePrice = external_exports.string().regex(/^\d{1,9}(\.\d{1,4})?$/, "price must be a decimal like 12.50");
|
|
21155
|
-
var siteQuantity = external_exports.number().int().min(0).max(SITE_LIMITS.quantityMax);
|
|
21156
|
-
var siteOrderStatus = external_exports.enum(["open", "closed", "cancelled", "any"]);
|
|
21157
|
-
var siteCreatedAfter = external_exports.union([external_exports.iso.date(), external_exports.iso.datetime({ offset: true })]);
|
|
21158
|
-
var siteWriteKeys = { idempotency_key: external_exports.uuid(), approval_id: external_exports.uuid() };
|
|
21159
|
-
var SITE_API_METHODS = Object.freeze(["GET", "POST", "PUT", "PATCH", "DELETE"]);
|
|
21160
|
-
var siteApiMethod = external_exports.enum(SITE_API_METHODS);
|
|
21161
|
-
var siteApiPath = external_exports.string().min(1).max(SITE_LIMITS.apiPathChars).refine((value) => /^\/?[A-Za-z0-9._~!$&'()*+,;=:@%/-]*$/.test(value), "path contains characters that are not allowed").refine((value) => !/%(2e|2f|5c)/i.test(value), "path must not contain encoded dots, slashes or backslashes").refine((value) => !value.includes("//") && !value.split("/").some((segment) => segment === ".." || segment === ".") && !/^[a-z][a-z0-9+.-]*:/i.test(value), "path must be relative to the API base");
|
|
21162
|
-
var siteApiQuery = external_exports.record(external_exports.string().min(1).max(100).regex(/^[A-Za-z0-9_.[\]-]+$/), external_exports.union([external_exports.string().max(1e3), external_exports.number(), external_exports.boolean()])).refine((value) => Object.keys(value).length <= SITE_LIMITS.apiQueryEntries, `query has more than ${SITE_LIMITS.apiQueryEntries} entries`);
|
|
21163
|
-
var siteApiBody = external_exports.custom((value) => {
|
|
21164
|
-
if (!value || typeof value !== "object" || hasProtoKey2(value))
|
|
21165
|
-
return false;
|
|
21166
|
-
try {
|
|
21167
|
-
return utf8Bytes(JSON.stringify(value)) <= SITE_LIMITS.apiBodyBytes;
|
|
21168
|
-
} catch {
|
|
21169
|
-
return false;
|
|
21170
|
-
}
|
|
21171
|
-
}, `body must be a JSON object or array of at most ${SITE_LIMITS.apiBodyBytes / 1024} KiB`);
|
|
21172
|
-
function hasProtoKey2(value, depth = 0) {
|
|
21173
|
-
if (depth > 20)
|
|
21174
|
-
return true;
|
|
21175
|
-
if (Array.isArray(value))
|
|
21176
|
-
return value.some((item) => hasProtoKey2(item, depth + 1));
|
|
21177
|
-
if (!value || typeof value !== "object")
|
|
21178
|
-
return false;
|
|
21179
|
-
return Object.entries(value).some(([key, inner]) => key === "__proto__" || key === "constructor" || key === "prototype" || hasProtoKey2(inner, depth + 1));
|
|
21180
|
-
}
|
|
21181
|
-
function requireChange(fields) {
|
|
21182
|
-
return (value) => fields.some((field) => value[field] !== void 0);
|
|
21364
|
+
var FAMILY_SPEC = Object.freeze({
|
|
21365
|
+
"security.status": { risk: "read", describe: (label) => `Read the ${label} version, PHP, database and installed extensions with their updates` },
|
|
21366
|
+
errors: { risk: "read", describe: (label) => `Read grouped, redacted ${label} error log entries` },
|
|
21367
|
+
health: { risk: "read", describe: (label) => `Read the ${label} health and hardening checks` },
|
|
21368
|
+
"cache.status": { risk: "read", describe: (label) => `Read which ${label} caches exist and can be purged` },
|
|
21369
|
+
"cache.purge": { risk: "write", describe: (label) => `Purge ${label} caches after your approval` },
|
|
21370
|
+
"extension.set_active": { risk: "write", describe: (label) => `Turn an installed ${label} extension on or off after an owner or admin approves (never ConBridge itself)` },
|
|
21371
|
+
"update.run": { risk: "privileged", defaultEffect: "ask", describe: (label) => `Update ${label} or one of its extensions after an owner or admin approves` },
|
|
21372
|
+
"update.status": { risk: "read", describe: (label) => `Read the progress of a ${label} update` }
|
|
21373
|
+
});
|
|
21374
|
+
var CMS_LABELS = Object.freeze({
|
|
21375
|
+
wordpress: "WordPress",
|
|
21376
|
+
joomla: "Joomla",
|
|
21377
|
+
drupal: "Drupal",
|
|
21378
|
+
prestashop: "PrestaShop",
|
|
21379
|
+
opencart: "OpenCart",
|
|
21380
|
+
magento: "Magento"
|
|
21381
|
+
});
|
|
21382
|
+
function siteSecurityCapabilities(platform2, families = SITE_SECURITY_MATRIX[platform2]) {
|
|
21383
|
+
const connector2 = platform2;
|
|
21384
|
+
return families.map((family) => {
|
|
21385
|
+
const spec = FAMILY_SPEC[family];
|
|
21386
|
+
return {
|
|
21387
|
+
connector: connector2,
|
|
21388
|
+
capability: siteSecurityCapability(platform2, family),
|
|
21389
|
+
risk: spec.risk,
|
|
21390
|
+
description: spec.describe(CMS_LABELS[platform2]),
|
|
21391
|
+
payload: siteSecurityPayloadSchemas[family],
|
|
21392
|
+
...spec.defaultEffect ? { defaultEffect: spec.defaultEffect } : {}
|
|
21393
|
+
};
|
|
21394
|
+
});
|
|
21183
21395
|
}
|
|
21396
|
+
var text = (max) => external_exports.string().max(max);
|
|
21397
|
+
var isoTime = external_exports.iso.datetime({ offset: true });
|
|
21398
|
+
var siteUpdateInfoSchema = external_exports.strictObject({ available: text(SITE_SECURITY_LIMITS.versionChars).nullable(), security: external_exports.boolean().nullable() });
|
|
21399
|
+
var SITE_EXTENSION_TYPES = Object.freeze(["plugin", "theme", "module", "extension", "package"]);
|
|
21400
|
+
var siteExtensionSchema = external_exports.strictObject({
|
|
21401
|
+
type: external_exports.enum(SITE_EXTENSION_TYPES),
|
|
21402
|
+
slug: external_exports.string().min(1).max(SITE_SECURITY_LIMITS.slugChars),
|
|
21403
|
+
name: text(SITE_SECURITY_LIMITS.nameChars),
|
|
21404
|
+
version: text(SITE_SECURITY_LIMITS.versionChars).nullable(),
|
|
21405
|
+
active: external_exports.boolean().nullable(),
|
|
21406
|
+
update: siteUpdateInfoSchema.nullable(),
|
|
21407
|
+
package: text(214).optional(),
|
|
21408
|
+
protected: external_exports.boolean().optional(),
|
|
21409
|
+
last_updated: external_exports.iso.date().optional()
|
|
21410
|
+
});
|
|
21411
|
+
var SITE_DB_ENGINES = Object.freeze(["mysql", "mariadb", "postgresql", "sqlite", "other"]);
|
|
21412
|
+
var siteSecurityStatusSchema = external_exports.strictObject({
|
|
21413
|
+
schema: external_exports.literal(1),
|
|
21414
|
+
module_version: external_exports.string().min(1).max(40),
|
|
21415
|
+
platform: external_exports.enum(CMS_PLATFORMS),
|
|
21416
|
+
core: external_exports.strictObject({ version: external_exports.string().min(1).max(SITE_SECURITY_LIMITS.versionChars), edition: text(64).optional(), update: siteUpdateInfoSchema.nullable() }),
|
|
21417
|
+
php: external_exports.strictObject({ version: external_exports.string().min(1).max(SITE_SECURITY_LIMITS.versionChars) }).nullable(),
|
|
21418
|
+
db: external_exports.strictObject({ engine: external_exports.enum(SITE_DB_ENGINES), version: text(SITE_SECURITY_LIMITS.versionChars) }).nullable(),
|
|
21419
|
+
extensions: external_exports.array(siteExtensionSchema).max(SITE_SECURITY_LIMITS.extensionCap),
|
|
21420
|
+
extensions_total: external_exports.number().int().min(0),
|
|
21421
|
+
can: external_exports.strictObject({ list_extensions: external_exports.boolean(), update: external_exports.boolean(), set_active: external_exports.boolean(), purge_cache: external_exports.boolean() })
|
|
21422
|
+
});
|
|
21423
|
+
var SITE_ERROR_LEVELS = Object.freeze(["fatal", "error", "warning", "notice", "deprecated"]);
|
|
21424
|
+
var siteErrorGroupSchema = external_exports.strictObject({
|
|
21425
|
+
source: external_exports.enum(["php", "db", "app", "extension"]),
|
|
21426
|
+
level: external_exports.enum(SITE_ERROR_LEVELS),
|
|
21427
|
+
extension: external_exports.string().min(1).max(SITE_SECURITY_LIMITS.slugChars).optional(),
|
|
21428
|
+
template: text(SITE_SECURITY_LIMITS.templateChars),
|
|
21429
|
+
count: external_exports.number().int().min(1),
|
|
21430
|
+
first_seen: isoTime,
|
|
21431
|
+
last_seen: isoTime
|
|
21432
|
+
});
|
|
21433
|
+
var siteErrorsSchema = external_exports.strictObject({
|
|
21434
|
+
schema: external_exports.literal(1),
|
|
21435
|
+
window: external_exports.enum(["24h", "7d"]),
|
|
21436
|
+
log: external_exports.enum(["on", "off", "unreadable"]),
|
|
21437
|
+
truncated: external_exports.boolean(),
|
|
21438
|
+
groups: external_exports.array(siteErrorGroupSchema).max(SITE_SECURITY_LIMITS.errorGroups)
|
|
21439
|
+
});
|
|
21440
|
+
var siteHealthCheckSchema = external_exports.strictObject({
|
|
21441
|
+
id: external_exports.string().min(1).max(80).regex(/^[a-z0-9][a-z0-9_.-]*$/),
|
|
21442
|
+
status: external_exports.enum(["pass", "warn", "fail", "unknown"]),
|
|
21443
|
+
label: text(120),
|
|
21444
|
+
detail: text(300).optional()
|
|
21445
|
+
});
|
|
21446
|
+
var siteHealthSchema = external_exports.strictObject({
|
|
21447
|
+
schema: external_exports.literal(1),
|
|
21448
|
+
error_log: external_exports.enum(["on", "off", "unreadable"]),
|
|
21449
|
+
maintenance_mode: external_exports.boolean().optional(),
|
|
21450
|
+
checks: external_exports.array(siteHealthCheckSchema).max(SITE_SECURITY_LIMITS.healthChecks)
|
|
21451
|
+
});
|
|
21452
|
+
var siteCacheBackendSchema = external_exports.strictObject({ id: siteBackendId, label: text(120), active: external_exports.boolean(), purgeable: external_exports.boolean() });
|
|
21453
|
+
var siteCacheSchema = external_exports.strictObject({ schema: external_exports.literal(1), backends: external_exports.array(siteCacheBackendSchema).max(SITE_SECURITY_LIMITS.cacheBackends) });
|
|
21454
|
+
var answerSchema = { schema: external_exports.literal(1).optional() };
|
|
21455
|
+
var sitePurgeResultSchema = external_exports.strictObject({
|
|
21456
|
+
...answerSchema,
|
|
21457
|
+
purged: external_exports.array(external_exports.string().max(64)).max(SITE_SECURITY_LIMITS.cacheBackends),
|
|
21458
|
+
failed: external_exports.array(external_exports.strictObject({ id: external_exports.string().max(64), reason: text(120) })).max(SITE_SECURITY_LIMITS.cacheBackends)
|
|
21459
|
+
});
|
|
21460
|
+
var SITE_JOB_ID = /^[A-Za-z0-9_-]{8,64}$/;
|
|
21461
|
+
var siteUpdateAcceptedSchema = external_exports.strictObject({ ...answerSchema, job_id: external_exports.string().regex(SITE_JOB_ID), state: external_exports.enum(["queued", "running"]) });
|
|
21462
|
+
var SITE_JOB_STATES = Object.freeze(["queued", "running", "succeeded", "failed", "rolled_back"]);
|
|
21463
|
+
var siteUpdateJobSchema = external_exports.strictObject({
|
|
21464
|
+
...answerSchema,
|
|
21465
|
+
job_id: external_exports.string().regex(SITE_JOB_ID),
|
|
21466
|
+
state: external_exports.enum(SITE_JOB_STATES),
|
|
21467
|
+
from_version: text(SITE_SECURITY_LIMITS.versionChars).nullable(),
|
|
21468
|
+
to_version: text(SITE_SECURITY_LIMITS.versionChars).nullable(),
|
|
21469
|
+
health: external_exports.enum(["ok", "failed"]).nullable(),
|
|
21470
|
+
code: external_exports.string().max(40).regex(/^[a-z0-9_]*$/).nullable()
|
|
21471
|
+
});
|
|
21472
|
+
var siteSetActiveResultSchema = external_exports.strictObject({ ...answerSchema, slug: external_exports.string().min(1).max(SITE_SECURITY_LIMITS.slugChars), active: external_exports.boolean() });
|
|
21184
21473
|
|
|
21185
|
-
// ../../packages/protocol/dist/connectors/
|
|
21186
|
-
var
|
|
21187
|
-
var
|
|
21188
|
-
|
|
21189
|
-
|
|
21190
|
-
var utf8Bytes2 = (value) => new TextEncoder().encode(value).byteLength;
|
|
21191
|
-
function shopifyGid(...types) {
|
|
21192
|
-
const pattern = new RegExp(`^gid://shopify/(?:${types.join("|")})/\\d{1,20}$`);
|
|
21193
|
-
return external_exports.string().max(SITE_LIMITS.idChars).regex(pattern, `id must be a Shopify ${types.join(" or ")} GID like gid://shopify/${types[0]}/123`);
|
|
21194
|
-
}
|
|
21195
|
-
function shopifyGidType(id) {
|
|
21196
|
-
return /^gid:\/\/shopify\/([A-Za-z]+)\/\d+$/.exec(id)?.[1] ?? null;
|
|
21197
|
-
}
|
|
21198
|
-
var DENIED_FIELDS = /\b(appUninstall|delegateAccessToken\w*|storefrontAccessToken\w*|staffMember\w*|webhookSubscription\w*)\b/i;
|
|
21199
|
-
function shopifyDeniedField(query) {
|
|
21200
|
-
const code = query.replace(/"""[\s\S]*?"""|"(?:[^"\\\n\r]|\\.)*"|#[^\n\r]*/g, " ");
|
|
21201
|
-
return DENIED_FIELDS.exec(code)?.[1] ?? null;
|
|
21202
|
-
}
|
|
21203
|
-
function hasProtoKey3(value, depth = 0) {
|
|
21204
|
-
if (depth > 20)
|
|
21205
|
-
return true;
|
|
21206
|
-
if (Array.isArray(value))
|
|
21207
|
-
return value.some((item) => hasProtoKey3(item, depth + 1));
|
|
21208
|
-
if (!value || typeof value !== "object")
|
|
21209
|
-
return false;
|
|
21210
|
-
return Object.entries(value).some(([key, inner]) => key === "__proto__" || key === "constructor" || key === "prototype" || hasProtoKey3(inner, depth + 1));
|
|
21211
|
-
}
|
|
21212
|
-
var contentType = external_exports.enum(SHOPIFY_CONTENT_TYPES);
|
|
21213
|
-
var contentId = shopifyGid("Page", "Article");
|
|
21214
|
-
var productId = shopifyGid("Product");
|
|
21215
|
-
var gidMatchesType = (value) => value.id === void 0 || shopifyGidType(value.id) === (value.type === "page" ? "Page" : "Article");
|
|
21216
|
-
var version3 = external_exports.string().min(1).max(40);
|
|
21217
|
-
var orderQuery = {
|
|
21218
|
-
id: shopifyGid("Order").optional(),
|
|
21219
|
-
status: siteOrderStatus.optional(),
|
|
21220
|
-
created_after: siteCreatedAfter.optional(),
|
|
21221
|
-
limit: siteListLimit.optional(),
|
|
21222
|
-
cursor: siteCursor.optional()
|
|
21223
|
-
};
|
|
21224
|
-
var shopifyPayloadSchemas = {
|
|
21225
|
-
"shopify.content.read": external_exports.strictObject({ type: contentType, id: contentId.optional(), query: siteQuery.optional(), limit: siteListLimit.optional(), cursor: siteCursor.optional() }).refine(gidMatchesType, "id must be a Page GID for type page and an Article GID for type article"),
|
|
21226
|
-
"shopify.content.update": external_exports.strictObject({
|
|
21227
|
-
type: contentType,
|
|
21228
|
-
id: contentId,
|
|
21229
|
-
title: siteTitle.optional(),
|
|
21230
|
-
body_html: siteBodyHtml.optional(),
|
|
21231
|
-
excerpt: siteExcerpt.optional(),
|
|
21232
|
-
seo_title: siteSeoTitle.optional(),
|
|
21233
|
-
seo_description: siteSeoDescription.optional(),
|
|
21234
|
-
expected_version: version3.optional(),
|
|
21235
|
-
...siteWriteKeys
|
|
21236
|
-
}).refine(gidMatchesType, "id must be a Page GID for type page and an Article GID for type article").refine(requireChange(["title", "body_html", "excerpt", "seo_title", "seo_description"]), "nothing to change").refine((value) => value.type === "article" || value.excerpt === void 0, "pages have no excerpt; excerpt is for articles"),
|
|
21237
|
-
"shopify.products.read": external_exports.strictObject({
|
|
21238
|
-
id: shopifyGid("Product", "InventoryItem").optional(),
|
|
21239
|
-
query: siteQuery.optional(),
|
|
21240
|
-
status: external_exports.enum(SHOPIFY_PRODUCT_STATUSES).optional(),
|
|
21241
|
-
limit: siteListLimit.optional(),
|
|
21242
|
-
cursor: siteCursor.optional()
|
|
21243
|
-
}),
|
|
21244
|
-
"shopify.products.update": external_exports.strictObject({
|
|
21245
|
-
id: productId,
|
|
21246
|
-
title: siteTitle.optional(),
|
|
21247
|
-
description_html: siteBodyHtml.optional(),
|
|
21248
|
-
seo_title: siteSeoTitle.optional(),
|
|
21249
|
-
seo_description: siteSeoDescription.optional(),
|
|
21250
|
-
status: external_exports.enum(SHOPIFY_PRODUCT_STATUSES).optional(),
|
|
21251
|
-
variants: external_exports.array(external_exports.strictObject({ id: shopifyGid("ProductVariant"), price: sitePrice.optional(), compare_at_price: sitePrice.nullable().optional() }).refine((variant2) => variant2.price !== void 0 || variant2.compare_at_price !== void 0, "each variant needs price or compare_at_price")).min(1).max(SITE_LIMITS.variantsMax).refine((variants) => new Set(variants.map((variant2) => variant2.id)).size === variants.length, "each variant may appear once").optional(),
|
|
21252
|
-
...siteWriteKeys
|
|
21253
|
-
}).refine(requireChange(["title", "description_html", "seo_title", "seo_description", "status", "variants"]), "nothing to change"),
|
|
21254
|
-
"shopify.inventory.update": external_exports.strictObject({
|
|
21255
|
-
item_id: shopifyGid("InventoryItem"),
|
|
21256
|
-
location_id: shopifyGid("Location"),
|
|
21257
|
-
quantity: siteQuantity,
|
|
21258
|
-
expected_quantity: siteQuantity.optional(),
|
|
21259
|
-
...siteWriteKeys
|
|
21260
|
-
}),
|
|
21261
|
-
"shopify.orders.read": external_exports.strictObject(orderQuery),
|
|
21262
|
-
"shopify.customers.read": external_exports.strictObject({ ...orderQuery, include_customer: external_exports.literal(true) }),
|
|
21263
|
-
"shopify.api.call": external_exports.strictObject({
|
|
21264
|
-
query: external_exports.string().min(1).max(SHOPIFY_RAW_QUERY_BYTES).refine((value) => utf8Bytes2(value) <= SHOPIFY_RAW_QUERY_BYTES, `query exceeds ${SHOPIFY_RAW_QUERY_BYTES} bytes`).refine((value) => shopifyDeniedField(value) === null, "this GraphQL call uses a field ConBridge never sends (app uninstall, access tokens, staff, webhooks)"),
|
|
21265
|
-
variables: external_exports.custom((value) => {
|
|
21266
|
-
if (!value || typeof value !== "object" || Array.isArray(value) || hasProtoKey3(value))
|
|
21267
|
-
return false;
|
|
21268
|
-
try {
|
|
21269
|
-
return utf8Bytes2(JSON.stringify(value)) <= SHOPIFY_RAW_VARIABLES_BYTES;
|
|
21270
|
-
} catch {
|
|
21271
|
-
return false;
|
|
21272
|
-
}
|
|
21273
|
-
}, `variables must be a JSON object of at most ${SHOPIFY_RAW_VARIABLES_BYTES / 1024} KiB`).optional(),
|
|
21274
|
-
...siteWriteKeys
|
|
21275
|
-
})
|
|
21276
|
-
};
|
|
21277
|
-
var SHOPIFY_CAPABILITIES = Object.freeze(Object.keys(shopifyPayloadSchemas));
|
|
21278
|
-
var SHOPIFY_CAPABILITY_DEFINITIONS = Object.freeze([
|
|
21279
|
-
{ connector: "shopify", capability: "shopify.content.read", risk: "read", description: "Read pages and blog articles", payload: shopifyPayloadSchemas["shopify.content.read"] },
|
|
21280
|
-
{ connector: "shopify", capability: "shopify.content.update", risk: "write", description: "Change the title, text, excerpt or SEO of a page or article after your approval", payload: shopifyPayloadSchemas["shopify.content.update"] },
|
|
21281
|
-
{ connector: "shopify", capability: "shopify.products.read", risk: "read", description: "Read products, variants, prices and stock", payload: shopifyPayloadSchemas["shopify.products.read"] },
|
|
21282
|
-
{ connector: "shopify", capability: "shopify.products.update", risk: "write", description: "Change a product (title, description, SEO, status, variant prices) after your approval", payload: shopifyPayloadSchemas["shopify.products.update"] },
|
|
21283
|
-
{ connector: "shopify", capability: "shopify.inventory.update", risk: "write", description: "Set the available quantity of an item at a location after your approval", payload: shopifyPayloadSchemas["shopify.inventory.update"] },
|
|
21284
|
-
{ connector: "shopify", capability: "shopify.orders.read", risk: "read", description: "Read orders of the last 60 days without customer data", payload: shopifyPayloadSchemas["shopify.orders.read"] },
|
|
21285
|
-
{ connector: "shopify", capability: "shopify.customers.read", risk: "read", description: "Read orders with customer names, emails, phones and addresses", defaultEffect: "deny", payload: shopifyPayloadSchemas["shopify.customers.read"] },
|
|
21286
|
-
{ connector: "shopify", capability: "shopify.api.call", risk: "privileged", description: "Run a raw Admin GraphQL call after an owner or admin approves the exact call", payload: shopifyPayloadSchemas["shopify.api.call"] }
|
|
21474
|
+
// ../../packages/protocol/dist/connectors/wordpress.js
|
|
21475
|
+
var WORDPRESS_SECURITY_DEFINITIONS = Object.freeze(siteSecurityCapabilities("wordpress"));
|
|
21476
|
+
var WORDPRESS_CAPABILITIES = Object.freeze([
|
|
21477
|
+
"wp.site.status",
|
|
21478
|
+
...WORDPRESS_SECURITY_DEFINITIONS.map((definition) => definition.capability)
|
|
21287
21479
|
]);
|
|
21288
|
-
|
|
21289
|
-
|
|
21290
|
-
var
|
|
21291
|
-
|
|
21292
|
-
var WIX_LIMITS = Object.freeze({
|
|
21293
|
-
postTitleChars: 200,
|
|
21294
|
-
postExcerptChars: 500,
|
|
21295
|
-
productNameChars: 80,
|
|
21296
|
-
productDescriptionChars: 16e3,
|
|
21297
|
-
quantityMax: 99999,
|
|
21298
|
-
priceDecimals: 3
|
|
21299
|
-
});
|
|
21300
|
-
var WIX_API_READ_ONLY_PREFIXES = Object.freeze(["apps/", "members/", "contacts/"]);
|
|
21301
|
-
function wixApiPathDenied(method, path) {
|
|
21302
|
-
if (method.toUpperCase() === "GET")
|
|
21303
|
-
return false;
|
|
21304
|
-
let decoded = path;
|
|
21305
|
-
try {
|
|
21306
|
-
decoded = decodeURIComponent(path);
|
|
21307
|
-
} catch {
|
|
21308
|
-
return true;
|
|
21309
|
-
}
|
|
21310
|
-
const normal = decoded.replace(/^\/+/, "").toLowerCase();
|
|
21311
|
-
return WIX_API_READ_ONLY_PREFIXES.some((prefix) => normal.startsWith(prefix) || normal === prefix.slice(0, -1));
|
|
21312
|
-
}
|
|
21313
|
-
var contentType2 = external_exports.enum(WIX_CONTENT_TYPES);
|
|
21314
|
-
var productStatus = external_exports.enum(WIX_PRODUCT_STATUSES);
|
|
21315
|
-
var wixPrice = sitePrice.refine((value) => (value.split(".")[1] ?? "").length <= WIX_LIMITS.priceDecimals, "Wix prices have at most 3 decimals");
|
|
21316
|
-
var postTitle = siteTitle.max(WIX_LIMITS.postTitleChars);
|
|
21317
|
-
var postExcerpt = siteExcerpt.max(WIX_LIMITS.postExcerptChars);
|
|
21318
|
-
var productName = siteTitle.max(WIX_LIMITS.productNameChars);
|
|
21319
|
-
var productDescription = external_exports.string().max(WIX_LIMITS.productDescriptionChars);
|
|
21320
|
-
var quantity = external_exports.number().int().min(0).max(WIX_LIMITS.quantityMax);
|
|
21321
|
-
var version4 = external_exports.string().min(1).max(64);
|
|
21322
|
-
var ordersRead = {
|
|
21323
|
-
id: siteId.optional(),
|
|
21324
|
-
status: siteOrderStatus.optional(),
|
|
21325
|
-
created_after: siteCreatedAfter.optional(),
|
|
21326
|
-
limit: siteListLimit.optional(),
|
|
21327
|
-
cursor: siteCursor.optional()
|
|
21328
|
-
};
|
|
21329
|
-
var contentChange = ["title", "excerpt", "seo_title", "seo_description"];
|
|
21330
|
-
var productChange = ["title", "description_html", "seo_title", "seo_description", "status", "price", "variants"];
|
|
21331
|
-
var wixPayloadSchemas = {
|
|
21332
|
-
"wix.content.read": external_exports.strictObject({
|
|
21333
|
-
type: contentType2.optional(),
|
|
21334
|
-
id: siteId.optional(),
|
|
21335
|
-
query: siteQuery.optional(),
|
|
21336
|
-
limit: siteListLimit.optional(),
|
|
21337
|
-
cursor: siteCursor.optional()
|
|
21338
|
-
}),
|
|
21339
|
-
"wix.content.update": external_exports.strictObject({
|
|
21340
|
-
type: contentType2.optional(),
|
|
21341
|
-
id: siteId,
|
|
21342
|
-
title: postTitle.optional(),
|
|
21343
|
-
excerpt: postExcerpt.optional(),
|
|
21344
|
-
seo_title: siteSeoTitle.optional(),
|
|
21345
|
-
seo_description: siteSeoDescription.optional(),
|
|
21346
|
-
expected_version: version4.optional(),
|
|
21347
|
-
...siteWriteKeys
|
|
21348
|
-
}).refine(requireChange([...contentChange]), "Change at least one of title, excerpt, seo_title or seo_description"),
|
|
21349
|
-
"wix.products.read": external_exports.strictObject({
|
|
21350
|
-
id: siteId.optional(),
|
|
21351
|
-
inventory_item_id: siteId.optional(),
|
|
21352
|
-
query: siteQuery.optional(),
|
|
21353
|
-
status: external_exports.enum(["active", "hidden", "any"]).optional(),
|
|
21354
|
-
limit: siteListLimit.optional(),
|
|
21355
|
-
cursor: siteCursor.optional()
|
|
21356
|
-
}).refine((value) => !(value.id !== void 0 && value.inventory_item_id !== void 0), "Pass either id or inventory_item_id"),
|
|
21357
|
-
"wix.products.update": external_exports.strictObject({
|
|
21358
|
-
id: siteId,
|
|
21359
|
-
title: productName.optional(),
|
|
21360
|
-
description_html: productDescription.optional(),
|
|
21361
|
-
seo_title: siteSeoTitle.optional(),
|
|
21362
|
-
seo_description: siteSeoDescription.optional(),
|
|
21363
|
-
status: productStatus.optional(),
|
|
21364
|
-
price: wixPrice.optional(),
|
|
21365
|
-
variants: external_exports.array(external_exports.strictObject({ id: siteId, price: wixPrice.optional(), compare_at_price: wixPrice.optional() }).refine((variant2) => variant2.price !== void 0 || variant2.compare_at_price !== void 0, "A variant change needs price or compare_at_price")).min(1).max(50).refine((list) => new Set(list.map((variant2) => variant2.id)).size === list.length, "Each variant may appear once").optional(),
|
|
21366
|
-
...siteWriteKeys
|
|
21367
|
-
}).refine(requireChange([...productChange]), "Change at least one field").refine((value) => !(value.price !== void 0 && value.variants !== void 0), "Pass either price or variants"),
|
|
21368
|
-
"wix.inventory.update": external_exports.strictObject({
|
|
21369
|
-
item_id: siteId,
|
|
21370
|
-
location_id: siteId.optional(),
|
|
21371
|
-
quantity,
|
|
21372
|
-
expected_quantity: external_exports.number().int().min(-99999).max(WIX_LIMITS.quantityMax).optional(),
|
|
21373
|
-
...siteWriteKeys
|
|
21374
|
-
}),
|
|
21375
|
-
"wix.orders.read": external_exports.strictObject(ordersRead),
|
|
21376
|
-
"wix.customers.read": external_exports.strictObject({ ...ordersRead, include_customer: external_exports.literal(true) }),
|
|
21377
|
-
"wix.api.call": external_exports.strictObject({
|
|
21378
|
-
method: siteApiMethod,
|
|
21379
|
-
path: siteApiPath,
|
|
21380
|
-
query: siteApiQuery.optional(),
|
|
21381
|
-
body: siteApiBody.optional(),
|
|
21382
|
-
...siteWriteKeys
|
|
21383
|
-
}).refine((value) => !wixApiPathDenied(value.method, value.path), "Raw calls may not change apps, members or contacts").refine((value) => value.method !== "GET" || value.body === void 0, "A GET call has no body")
|
|
21480
|
+
var WORDPRESS_RESOURCE_KINDS = Object.freeze(["wordpress"]);
|
|
21481
|
+
var WORDPRESS_PROTECTED_PLUGINS = CMS_PROTECTED_SLUGS.wordpress;
|
|
21482
|
+
var wordpressPayloadSchemas = {
|
|
21483
|
+
"wp.site.status": external_exports.strictObject({})
|
|
21384
21484
|
};
|
|
21385
|
-
var
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
{ connector: "wix", capability: "wix.content.update", risk: "write", description: "Change a blog post title, excerpt or SEO after your approval; a published post is republished at once", payload: wixPayloadSchemas["wix.content.update"] },
|
|
21389
|
-
{ connector: "wix", capability: "wix.products.read", risk: "read", description: "Read Wix Stores products, variants and stock", payload: wixPayloadSchemas["wix.products.read"] },
|
|
21390
|
-
{ connector: "wix", capability: "wix.products.update", risk: "write", description: "Change a product name, description, SEO, visibility or prices after your approval", payload: wixPayloadSchemas["wix.products.update"] },
|
|
21391
|
-
{ connector: "wix", capability: "wix.inventory.update", risk: "write", description: "Set the stock quantity of a product variant after your approval", payload: wixPayloadSchemas["wix.inventory.update"] },
|
|
21392
|
-
{ connector: "wix", capability: "wix.orders.read", risk: "read", description: "Read orders without customer names, emails, phones or addresses", payload: wixPayloadSchemas["wix.orders.read"] },
|
|
21393
|
-
{ connector: "wix", capability: "wix.customers.read", risk: "read", description: "Read orders with customer names, emails, phones and addresses", payload: wixPayloadSchemas["wix.customers.read"], defaultEffect: "deny" },
|
|
21394
|
-
{ connector: "wix", capability: "wix.api.call", risk: "privileged", description: "Raw Wix REST call with the stored API key, after an owner or admin approves it", payload: wixPayloadSchemas["wix.api.call"] }
|
|
21485
|
+
var WORDPRESS_CAPABILITY_DEFINITIONS = Object.freeze([
|
|
21486
|
+
{ connector: "wordpress", capability: "wp.site.status", risk: "read", description: "Legacy read of the WordPress version, theme and plugins (plugins older than 1.0.0)", payload: wordpressPayloadSchemas["wp.site.status"] },
|
|
21487
|
+
...WORDPRESS_SECURITY_DEFINITIONS
|
|
21395
21488
|
]);
|
|
21396
21489
|
|
|
21397
|
-
// ../../packages/protocol/dist/connectors/squarespace.js
|
|
21398
|
-
var squarespaceId = external_exports.string().min(1).max(SITE_LIMITS.idChars).regex(/^[A-Za-z0-9_-]+$/, "invalid Squarespace id");
|
|
21399
|
-
var squarespaceProductStatus = external_exports.enum(["active", "draft"]);
|
|
21400
|
-
var orderFilters = {
|
|
21401
|
-
id: squarespaceId.optional(),
|
|
21402
|
-
status: siteOrderStatus.optional(),
|
|
21403
|
-
created_after: siteCreatedAfter.optional(),
|
|
21404
|
-
limit: siteListLimit.optional(),
|
|
21405
|
-
cursor: siteCursor.optional()
|
|
21406
|
-
};
|
|
21407
|
-
var PRODUCT_CHANGES = ["title", "description_html", "seo_title", "seo_description", "status", "variants"];
|
|
21408
|
-
var squarespacePayloadSchemas = {
|
|
21409
|
-
"squarespace.products.read": external_exports.strictObject({
|
|
21410
|
-
id: squarespaceId.optional(),
|
|
21411
|
-
query: siteQuery.optional(),
|
|
21412
|
-
status: squarespaceProductStatus.optional(),
|
|
21413
|
-
limit: siteListLimit.optional(),
|
|
21414
|
-
cursor: siteCursor.optional()
|
|
21415
|
-
}),
|
|
21416
|
-
"squarespace.products.update": external_exports.strictObject({
|
|
21417
|
-
id: squarespaceId,
|
|
21418
|
-
title: siteTitle.optional(),
|
|
21419
|
-
description_html: siteBodyHtml.optional(),
|
|
21420
|
-
seo_title: siteSeoTitle.optional(),
|
|
21421
|
-
seo_description: siteSeoDescription.optional(),
|
|
21422
|
-
status: squarespaceProductStatus.optional(),
|
|
21423
|
-
variants: external_exports.array(external_exports.strictObject({ id: squarespaceId, price: sitePrice })).min(1).max(SITE_LIMITS.variantsMax).refine((variants) => new Set(variants.map((variant2) => variant2.id)).size === variants.length, "each variant may appear once").optional(),
|
|
21424
|
-
...siteWriteKeys
|
|
21425
|
-
}).refine(requireChange([...PRODUCT_CHANGES]), "change at least one field"),
|
|
21426
|
-
"squarespace.inventory.read": external_exports.strictObject({ item_id: squarespaceId }),
|
|
21427
|
-
"squarespace.inventory.update": external_exports.strictObject({ item_id: squarespaceId, quantity: siteQuantity, expected_quantity: siteQuantity.optional(), ...siteWriteKeys }),
|
|
21428
|
-
"squarespace.orders.read": external_exports.strictObject(orderFilters),
|
|
21429
|
-
"squarespace.customers.read": external_exports.strictObject({ ...orderFilters, include_customer: external_exports.literal(true) }),
|
|
21430
|
-
"squarespace.api.call": external_exports.strictObject({ method: siteApiMethod, path: siteApiPath, query: siteApiQuery.optional(), body: siteApiBody.optional(), ...siteWriteKeys })
|
|
21431
|
-
};
|
|
21432
|
-
var SQUARESPACE_CAPABILITY_DEFINITIONS = [
|
|
21433
|
-
{
|
|
21434
|
-
connector: "squarespace",
|
|
21435
|
-
capability: "squarespace.products.read",
|
|
21436
|
-
risk: "read",
|
|
21437
|
-
description: "Read products, their variants, prices and stock",
|
|
21438
|
-
payload: squarespacePayloadSchemas["squarespace.products.read"]
|
|
21439
|
-
},
|
|
21440
|
-
{
|
|
21441
|
-
connector: "squarespace",
|
|
21442
|
-
capability: "squarespace.products.update",
|
|
21443
|
-
risk: "write",
|
|
21444
|
-
description: "Change a product (name, description, SEO, visibility, variant prices) after your approval",
|
|
21445
|
-
payload: squarespacePayloadSchemas["squarespace.products.update"]
|
|
21446
|
-
},
|
|
21447
|
-
{
|
|
21448
|
-
connector: "squarespace",
|
|
21449
|
-
capability: "squarespace.inventory.read",
|
|
21450
|
-
risk: "read",
|
|
21451
|
-
description: "Read the stock of a product variant",
|
|
21452
|
-
payload: squarespacePayloadSchemas["squarespace.inventory.read"]
|
|
21453
|
-
},
|
|
21454
|
-
{
|
|
21455
|
-
connector: "squarespace",
|
|
21456
|
-
capability: "squarespace.inventory.update",
|
|
21457
|
-
risk: "write",
|
|
21458
|
-
description: "Set the stock of a product variant after your approval",
|
|
21459
|
-
payload: squarespacePayloadSchemas["squarespace.inventory.update"]
|
|
21460
|
-
},
|
|
21461
|
-
{
|
|
21462
|
-
connector: "squarespace",
|
|
21463
|
-
capability: "squarespace.orders.read",
|
|
21464
|
-
risk: "read",
|
|
21465
|
-
description: "Read orders without customer names, emails, phones or addresses",
|
|
21466
|
-
payload: squarespacePayloadSchemas["squarespace.orders.read"]
|
|
21467
|
-
},
|
|
21468
|
-
{
|
|
21469
|
-
connector: "squarespace",
|
|
21470
|
-
capability: "squarespace.customers.read",
|
|
21471
|
-
risk: "read",
|
|
21472
|
-
defaultEffect: "deny",
|
|
21473
|
-
description: "Read orders with customer names, emails, phones, addresses and profiles",
|
|
21474
|
-
payload: squarespacePayloadSchemas["squarespace.customers.read"]
|
|
21475
|
-
},
|
|
21476
|
-
{
|
|
21477
|
-
connector: "squarespace",
|
|
21478
|
-
capability: "squarespace.api.call",
|
|
21479
|
-
risk: "privileged",
|
|
21480
|
-
description: "Send a raw Commerce API request after an owner or admin approves it",
|
|
21481
|
-
payload: squarespacePayloadSchemas["squarespace.api.call"]
|
|
21482
|
-
}
|
|
21483
|
-
];
|
|
21484
|
-
|
|
21485
|
-
// ../../packages/protocol/dist/connectors/webflow.js
|
|
21486
|
-
var WEBFLOW_CONTENT_TYPES = Object.freeze(["cms_item", "page"]);
|
|
21487
|
-
var WEBFLOW_MAX_VARIANTS = 20;
|
|
21488
|
-
var WEBFLOW_MAX_FIELDS = 50;
|
|
21489
|
-
var WEBFLOW_DENIED_API_PREFIXES = Object.freeze(["/token", "/workspaces"]);
|
|
21490
|
-
function webflowApiPathDenied(path) {
|
|
21491
|
-
let decoded;
|
|
21492
|
-
try {
|
|
21493
|
-
decoded = decodeURIComponent(path);
|
|
21494
|
-
} catch {
|
|
21495
|
-
return true;
|
|
21496
|
-
}
|
|
21497
|
-
if (decoded.includes("\\") || decoded.split("/").some((segment) => segment === "." || segment === ".."))
|
|
21498
|
-
return true;
|
|
21499
|
-
const normalized = ("/" + decoded.replace(/^\/+/, "")).toLowerCase();
|
|
21500
|
-
return WEBFLOW_DENIED_API_PREFIXES.some((prefix) => normalized === prefix || normalized.startsWith(prefix + "/"));
|
|
21501
|
-
}
|
|
21502
|
-
var fieldSlug = external_exports.string().min(1).max(100).regex(/^[a-z0-9][a-z0-9_-]*$/, "field names are the CMS field slugs (lowercase letters, digits, - and _)");
|
|
21503
|
-
var fieldValue = external_exports.union([siteBodyHtml, external_exports.number(), external_exports.boolean(), external_exports.null()]);
|
|
21504
|
-
var cmsFields = external_exports.record(fieldSlug, fieldValue).refine((value) => Object.keys(value).length >= 1 && Object.keys(value).length <= WEBFLOW_MAX_FIELDS, `fields must name 1-${WEBFLOW_MAX_FIELDS} fields`).refine((value) => new TextEncoder().encode(JSON.stringify(value)).byteLength <= SITE_LIMITS.bodyHtmlBytes, `fields exceed ${SITE_LIMITS.bodyHtmlBytes} bytes`);
|
|
21505
|
-
var contentType3 = external_exports.enum(WEBFLOW_CONTENT_TYPES);
|
|
21506
|
-
var version5 = external_exports.string().min(1).max(64);
|
|
21507
|
-
var offsetCursor = siteCursor.regex(/^\d{1,7}$/, "cursor is the next_cursor of the previous page");
|
|
21508
|
-
var contentRead = external_exports.strictObject({
|
|
21509
|
-
type: contentType3,
|
|
21510
|
-
collection_id: siteId.optional(),
|
|
21511
|
-
id: siteId.optional(),
|
|
21512
|
-
query: siteQuery.optional(),
|
|
21513
|
-
limit: siteListLimit.optional(),
|
|
21514
|
-
cursor: offsetCursor.optional()
|
|
21515
|
-
}).refine((value) => !(value.type === "cms_item" && value.id !== void 0 && value.collection_id === void 0), "a cms_item id needs its collection_id").refine((value) => !(value.type === "page" && value.collection_id !== void 0), "pages have no collection_id");
|
|
21516
|
-
var contentUpdate = external_exports.strictObject({
|
|
21517
|
-
type: contentType3,
|
|
21518
|
-
id: siteId,
|
|
21519
|
-
collection_id: siteId.optional(),
|
|
21520
|
-
title: siteTitle.optional(),
|
|
21521
|
-
seo_title: siteSeoTitle.optional(),
|
|
21522
|
-
seo_description: siteSeoDescription.optional(),
|
|
21523
|
-
fields: cmsFields.optional(),
|
|
21524
|
-
expected_version: version5.optional(),
|
|
21525
|
-
...siteWriteKeys
|
|
21526
|
-
}).refine(requireChange(["title", "seo_title", "seo_description", "fields"]), "nothing to change").refine((value) => value.type === "page" || value.collection_id !== void 0, "a cms_item needs its collection_id").refine((value) => value.type === "cms_item" || value.fields === void 0 && value.collection_id === void 0, "pages change title and SEO only").refine((value) => value.type === "page" || value.seo_title === void 0 && value.seo_description === void 0, "CMS items keep SEO in their own fields; use fields");
|
|
21527
|
-
var productsRead = external_exports.strictObject({
|
|
21528
|
-
id: siteId.optional(),
|
|
21529
|
-
sku_id: siteId.optional(),
|
|
21530
|
-
query: siteQuery.optional(),
|
|
21531
|
-
status: external_exports.enum(["active", "draft", "archived", "any"]).optional(),
|
|
21532
|
-
limit: siteListLimit.optional(),
|
|
21533
|
-
cursor: offsetCursor.optional()
|
|
21534
|
-
}).refine((value) => !(value.id !== void 0 && value.sku_id !== void 0), "pass id or sku_id, not both");
|
|
21535
|
-
var variant = external_exports.strictObject({ id: siteId, price: sitePrice.optional(), compare_at_price: sitePrice.optional() }).refine(requireChange(["price", "compare_at_price"]), "a variant needs price or compare_at_price");
|
|
21536
|
-
var productUpdate = external_exports.strictObject({
|
|
21537
|
-
id: siteId,
|
|
21538
|
-
title: siteTitle.optional(),
|
|
21539
|
-
description_html: siteBodyHtml.optional(),
|
|
21540
|
-
status: external_exports.enum(["active", "draft"]).optional(),
|
|
21541
|
-
variants: external_exports.array(variant).min(1).max(WEBFLOW_MAX_VARIANTS).optional(),
|
|
21542
|
-
...siteWriteKeys
|
|
21543
|
-
}).refine(requireChange(["title", "description_html", "status", "variants"]), "nothing to change").refine((value) => !value.variants || new Set(value.variants.map((entry) => entry.id)).size === value.variants.length, "each variant once");
|
|
21544
|
-
var inventoryUpdate = external_exports.strictObject({ item_id: siteId, quantity: siteQuantity, expected_quantity: siteQuantity.optional(), ...siteWriteKeys });
|
|
21545
|
-
var ordersBase = {
|
|
21546
|
-
id: siteId.optional(),
|
|
21547
|
-
status: external_exports.enum(["open", "closed", "cancelled", "any"]).optional(),
|
|
21548
|
-
created_after: siteCreatedAfter.optional(),
|
|
21549
|
-
limit: siteListLimit.optional(),
|
|
21550
|
-
cursor: offsetCursor.optional()
|
|
21551
|
-
};
|
|
21552
|
-
var ordersRead2 = external_exports.strictObject(ordersBase);
|
|
21553
|
-
var customersRead = external_exports.strictObject({ ...ordersBase, include_customer: external_exports.literal(true) });
|
|
21554
|
-
var apiCall = external_exports.strictObject({ method: siteApiMethod, path: siteApiPath, query: siteApiQuery.optional(), body: siteApiBody.optional(), ...siteWriteKeys }).refine((value) => !webflowApiPathDenied(value.path), "this path is not allowed for raw calls");
|
|
21555
|
-
var sitePublish = external_exports.strictObject({ domains: external_exports.enum(["all", "webflow_subdomain"]), ...siteWriteKeys });
|
|
21556
|
-
var WEBFLOW_CAPABILITY_DEFINITIONS = [
|
|
21557
|
-
{ connector: "webflow", capability: "webflow.content.read", risk: "read", description: "Read CMS items and page settings (staged versions)", payload: contentRead },
|
|
21558
|
-
{ connector: "webflow", capability: "webflow.content.update", risk: "write", description: "Change a CMS item or the title and SEO of a page (staged until the site is published) after your approval", payload: contentUpdate },
|
|
21559
|
-
{ connector: "webflow", capability: "webflow.products.read", risk: "read", description: "Read products, SKUs and SKU inventory", payload: productsRead },
|
|
21560
|
-
{ connector: "webflow", capability: "webflow.products.update", risk: "write", description: "Change a product and its SKU prices after your approval", payload: productUpdate },
|
|
21561
|
-
{ connector: "webflow", capability: "webflow.inventory.update", risk: "write", description: "Set the inventory of a SKU after your approval", payload: inventoryUpdate },
|
|
21562
|
-
{ connector: "webflow", capability: "webflow.orders.read", risk: "read", description: "Read orders without customer names, emails or addresses", payload: ordersRead2 },
|
|
21563
|
-
{ connector: "webflow", capability: "webflow.customers.read", risk: "read", description: "Read orders with customer names, emails and addresses", defaultEffect: "deny", payload: customersRead },
|
|
21564
|
-
{ connector: "webflow", capability: "webflow.api.call", risk: "privileged", description: "Make any Webflow Data API call the site token allows after an owner or admin approves it", payload: apiCall },
|
|
21565
|
-
{ connector: "webflow", capability: "webflow.site.publish", risk: "privileged", description: "Publish the site, so every staged change goes live, after an owner or admin approves it", payload: sitePublish }
|
|
21566
|
-
];
|
|
21567
|
-
|
|
21568
21490
|
// ../../packages/protocol/dist/connectors/joomla.js
|
|
21569
|
-
var
|
|
21570
|
-
var JOOMLA_API_DENIED_SEGMENTS = Object.freeze(["config", "users", "plugins", "extensions"]);
|
|
21571
|
-
var JOOMLA_API_DENIED_QUERY = Object.freeze(["option", "component", "controller", "task", "view", "layout", "format", "public"]);
|
|
21572
|
-
function joomlaApiPathDenied(path) {
|
|
21573
|
-
let decoded;
|
|
21574
|
-
try {
|
|
21575
|
-
decoded = decodeURIComponent(path);
|
|
21576
|
-
} catch {
|
|
21577
|
-
return true;
|
|
21578
|
-
}
|
|
21579
|
-
if (decoded.includes("\\"))
|
|
21580
|
-
return true;
|
|
21581
|
-
const segments = decoded.replace(/^\/+/, "").split("/");
|
|
21582
|
-
if (segments.some((segment) => segment === "." || segment === ".."))
|
|
21583
|
-
return true;
|
|
21584
|
-
const first = segments[0].toLowerCase();
|
|
21585
|
-
return first === "" || JOOMLA_API_DENIED_SEGMENTS.includes(first);
|
|
21586
|
-
}
|
|
21587
|
-
function joomlaApiQueryDenied(query) {
|
|
21588
|
-
return Object.keys(query ?? {}).some((name3) => JOOMLA_API_DENIED_QUERY.includes(name3.toLowerCase()));
|
|
21589
|
-
}
|
|
21590
|
-
var joomlaId = external_exports.string().regex(/^[1-9]\d{0,9}$/, "Joomla ids are positive whole numbers");
|
|
21591
|
-
var contentType4 = external_exports.enum(JOOMLA_CONTENT_TYPES);
|
|
21592
|
-
var joomlaCursor = external_exports.string().regex(/^\d{1,7}$/, "invalid cursor");
|
|
21593
|
-
var joomlaVersion = external_exports.string().min(1).max(64);
|
|
21594
|
-
var joomlaPayloadSchemas = {
|
|
21595
|
-
"joomla.content.read": external_exports.strictObject({
|
|
21596
|
-
type: contentType4,
|
|
21597
|
-
id: joomlaId.optional(),
|
|
21598
|
-
query: siteQuery.optional(),
|
|
21599
|
-
limit: siteListLimit.optional(),
|
|
21600
|
-
cursor: joomlaCursor.optional()
|
|
21601
|
-
}),
|
|
21602
|
-
"joomla.content.update": external_exports.strictObject({
|
|
21603
|
-
type: contentType4,
|
|
21604
|
-
id: joomlaId,
|
|
21605
|
-
title: siteTitle.optional(),
|
|
21606
|
-
body_html: siteBodyHtml.optional(),
|
|
21607
|
-
seo_description: siteSeoDescription.optional(),
|
|
21608
|
-
expected_version: joomlaVersion.optional(),
|
|
21609
|
-
...siteWriteKeys
|
|
21610
|
-
}).refine(requireChange(["title", "body_html", "seo_description"]), "change at least one of title, body_html or seo_description").refine((value) => value.expected_version === void 0 || value.type === "article", "expected_version is for articles only: Joomla does not report a version for categories"),
|
|
21611
|
-
"joomla.api.call": external_exports.strictObject({
|
|
21612
|
-
method: siteApiMethod,
|
|
21613
|
-
path: siteApiPath.refine((value) => !joomlaApiPathDenied(value), "config, users, plugins and extensions are not reachable through ConBridge"),
|
|
21614
|
-
query: siteApiQuery.refine((value) => !joomlaApiQueryDenied(value), "option, component, controller, task, view, layout, format and public are not allowed in the query").optional(),
|
|
21615
|
-
body: siteApiBody.optional(),
|
|
21616
|
-
...siteWriteKeys
|
|
21617
|
-
}).refine((value) => value.body === void 0 || value.method !== "GET" && value.method !== "DELETE", "GET and DELETE calls carry no body")
|
|
21618
|
-
};
|
|
21619
|
-
var JOOMLA_CAPABILITY_DEFINITIONS = [
|
|
21620
|
-
{ connector: "joomla", capability: "joomla.content.read", risk: "read", description: "Read Joomla articles and categories", payload: joomlaPayloadSchemas["joomla.content.read"] },
|
|
21621
|
-
{ connector: "joomla", capability: "joomla.content.update", risk: "write", description: "Change the title, text or meta description of a Joomla article or category after your approval", payload: joomlaPayloadSchemas["joomla.content.update"] },
|
|
21622
|
-
{ connector: "joomla", capability: "joomla.api.call", risk: "privileged", description: "Call the Joomla Web Services API directly after an owner or admin approves the exact call (never configuration, users, plugins or extensions)", payload: joomlaPayloadSchemas["joomla.api.call"] }
|
|
21623
|
-
];
|
|
21491
|
+
var JOOMLA_CAPABILITY_DEFINITIONS = Object.freeze(siteSecurityCapabilities("joomla"));
|
|
21624
21492
|
|
|
21625
21493
|
// ../../packages/protocol/dist/connectors/drupal.js
|
|
21626
|
-
var
|
|
21627
|
-
var drupalNodeId = external_exports.string().regex(/^[1-9][0-9]{0,9}$/, "id must be a Drupal node id");
|
|
21628
|
-
var drupalBundleName = external_exports.string().regex(/^[a-z][a-z0-9_]{0,31}$/, "bundle must be a content type machine name");
|
|
21629
|
-
var drupalVersion = external_exports.string().regex(/^[0-9]{1,12}$/, "expected_version must be the version read with drupal_list_content");
|
|
21630
|
-
var DRUPAL_JSONAPI_PREFIX = "/jsonapi/";
|
|
21631
|
-
function drupalApiPath(path) {
|
|
21632
|
-
return path.startsWith("/") ? path : "/" + path;
|
|
21633
|
-
}
|
|
21634
|
-
function drupalApiPathProblem(path) {
|
|
21635
|
-
let decoded;
|
|
21636
|
-
try {
|
|
21637
|
-
decoded = decodeURIComponent(path);
|
|
21638
|
-
} catch {
|
|
21639
|
-
return "Raw Drupal calls must use a JSON:API path under /jsonapi/";
|
|
21640
|
-
}
|
|
21641
|
-
if (decoded.includes("\\") || decoded.split("/").some((segment) => segment === "." || segment === ".."))
|
|
21642
|
-
return "Raw Drupal calls must use a JSON:API path under /jsonapi/";
|
|
21643
|
-
const normal = drupalApiPath(decoded).toLowerCase();
|
|
21644
|
-
if (!normal.startsWith(DRUPAL_JSONAPI_PREFIX) || normal.length <= DRUPAL_JSONAPI_PREFIX.length)
|
|
21645
|
-
return "Raw Drupal calls must use a JSON:API path under /jsonapi/";
|
|
21646
|
-
const resource = normal.slice(DRUPAL_JSONAPI_PREFIX.length).split("/")[0] ?? "";
|
|
21647
|
-
if (resource.startsWith("user"))
|
|
21648
|
-
return "User accounts and roles are not available through ConBridge";
|
|
21649
|
-
return null;
|
|
21650
|
-
}
|
|
21651
|
-
var contentType5 = external_exports.enum(DRUPAL_CONTENT_TYPES);
|
|
21652
|
-
var listContent = external_exports.strictObject({
|
|
21653
|
-
type: contentType5,
|
|
21654
|
-
bundle: drupalBundleName.optional(),
|
|
21655
|
-
id: drupalNodeId.optional(),
|
|
21656
|
-
query: siteQuery.optional(),
|
|
21657
|
-
limit: siteListLimit.optional(),
|
|
21658
|
-
cursor: siteCursor.optional()
|
|
21659
|
-
});
|
|
21660
|
-
var updateContent = external_exports.strictObject({
|
|
21661
|
-
type: contentType5,
|
|
21662
|
-
id: drupalNodeId,
|
|
21663
|
-
title: siteTitle.optional(),
|
|
21664
|
-
body_html: siteBodyHtml.optional(),
|
|
21665
|
-
excerpt: siteExcerpt.optional(),
|
|
21666
|
-
expected_version: drupalVersion.optional(),
|
|
21667
|
-
...siteWriteKeys
|
|
21668
|
-
}).refine(requireChange(["title", "body_html", "excerpt"]), "Change at least one of title, body_html or excerpt");
|
|
21669
|
-
var apiCall2 = external_exports.strictObject({
|
|
21670
|
-
method: siteApiMethod,
|
|
21671
|
-
path: siteApiPath.refine((value) => drupalApiPathProblem(value) === null, "path must be a JSON:API path under /jsonapi/ (users excluded)"),
|
|
21672
|
-
query: siteApiQuery.optional(),
|
|
21673
|
-
body: siteApiBody.optional(),
|
|
21674
|
-
...siteWriteKeys
|
|
21675
|
-
});
|
|
21676
|
-
var drupalPayloadSchemas = {
|
|
21677
|
-
"drupal.content.read": listContent,
|
|
21678
|
-
"drupal.content.update": updateContent,
|
|
21679
|
-
"drupal.api.call": apiCall2
|
|
21680
|
-
};
|
|
21681
|
-
var DRUPAL_CAPABILITY_DEFINITIONS = Object.freeze([
|
|
21682
|
-
{ connector: "drupal", capability: "drupal.content.read", risk: "read", description: "Read Drupal content (nodes)", payload: drupalPayloadSchemas["drupal.content.read"] },
|
|
21683
|
-
{ connector: "drupal", capability: "drupal.content.update", risk: "write", description: "Change the title, body or summary of Drupal content after your approval", payload: drupalPayloadSchemas["drupal.content.update"] },
|
|
21684
|
-
{ connector: "drupal", capability: "drupal.api.call", risk: "privileged", description: "Raw Drupal JSON:API call after an owner approves it", payload: drupalPayloadSchemas["drupal.api.call"] }
|
|
21685
|
-
]);
|
|
21686
|
-
var DRUPAL_LIMITS = Object.freeze({ titleChars: SITE_LIMITS.titleChars, bodyBytes: SITE_LIMITS.bodyHtmlBytes, summaryChars: SITE_LIMITS.excerptChars, readBodyBytes: 64 * 1024 });
|
|
21494
|
+
var DRUPAL_CAPABILITY_DEFINITIONS = Object.freeze(siteSecurityCapabilities("drupal"));
|
|
21687
21495
|
|
|
21688
21496
|
// ../../packages/protocol/dist/connectors/prestashop.js
|
|
21689
|
-
var
|
|
21690
|
-
var cursor = siteCursor.regex(/^[0-9]{1,7}$/, "invalid cursor");
|
|
21691
|
-
var contentType6 = external_exports.enum(["cms_page"]);
|
|
21692
|
-
var productStatus2 = external_exports.enum(["active", "draft"]);
|
|
21693
|
-
var contentVersion = external_exports.string().regex(/^[0-9a-f]{16}$/, "version must be the value read with the page");
|
|
21694
|
-
var PRESTASHOP_API_DENIED_WRITES = Object.freeze(["employees", "customers", "addresses", "customer_threads", "customer_messages", "guests", "configurations"]);
|
|
21695
|
-
var PRESTASHOP_XML_BODY_BYTES = SITE_LIMITS.apiBodyBytes;
|
|
21696
|
-
var utf8Bytes3 = (value) => new TextEncoder().encode(value).byteLength;
|
|
21697
|
-
var PRESTASHOP_API_DENIED_QUERY = Object.freeze(["ws_key", "url"]);
|
|
21698
|
-
function prestashopQueryNameDenied(name3) {
|
|
21699
|
-
let decoded;
|
|
21700
|
-
try {
|
|
21701
|
-
decoded = decodeURIComponent(name3.replace(/\+/g, " "));
|
|
21702
|
-
} catch {
|
|
21703
|
-
return true;
|
|
21704
|
-
}
|
|
21705
|
-
const normal = decoded.trim().toLowerCase().replace(/\[.*$/, "").replace(/[. ]/g, "_");
|
|
21706
|
-
return PRESTASHOP_API_DENIED_QUERY.includes(normal);
|
|
21707
|
-
}
|
|
21708
|
-
function prestashopResourceOf(path) {
|
|
21709
|
-
return path.replace(/^\/+/, "").split("/", 1)[0] ?? "";
|
|
21710
|
-
}
|
|
21711
|
-
var xmlBody = external_exports.string().min(1).max(PRESTASHOP_XML_BODY_BYTES).refine((value) => utf8Bytes3(value) <= PRESTASHOP_XML_BODY_BYTES, `body exceeds ${PRESTASHOP_XML_BODY_BYTES} bytes`).refine((value) => value.trimStart().startsWith("<"), "body must be the XML document the PrestaShop Webservice expects").refine((value) => !/<!DOCTYPE|<!ENTITY|<\?(?!xml\s)/i.test(value), "body must not contain a DOCTYPE, entity declarations or processing instructions");
|
|
21712
|
-
var NAME_REFUSED = {
|
|
21713
|
-
generic_name: { pattern: /[<>={}]/, shown: "< > = { }" },
|
|
21714
|
-
catalog_name: { pattern: /[<>;=#{}]/, shown: "< > ; = # { }" }
|
|
21715
|
-
};
|
|
21716
|
-
var PCRE_SPACE = "[\\t\\n\\v\\f\\r ]";
|
|
21717
|
-
var SCRIPT_TAG = new RegExp(`<${PCRE_SPACE}*script`, "i");
|
|
21718
|
-
var TAG = new RegExp(`<${PCRE_SPACE}*\\w([^>]*)`, "g");
|
|
21719
|
-
var EVENT_ATTRIBUTE = new RegExp(`${PCRE_SPACE}on\\w+=["']`, "i");
|
|
21720
|
-
function hasEventAttribute(html) {
|
|
21721
|
-
for (const match of html.matchAll(TAG)) {
|
|
21722
|
-
const rest = match[1] ?? "";
|
|
21723
|
-
const found = EVENT_ATTRIBUTE.exec(rest);
|
|
21724
|
-
if (!found)
|
|
21725
|
-
continue;
|
|
21726
|
-
const after = (match.index ?? 0) + match[0].length - rest.length + found.index + found[0].length;
|
|
21727
|
-
return html.indexOf('"', after) >= 0 || html.indexOf("'", after) >= 0;
|
|
21728
|
-
}
|
|
21729
|
-
return false;
|
|
21730
|
-
}
|
|
21731
|
-
function cleanHtmlProblem(field, what, html) {
|
|
21732
|
-
if (SCRIPT_TAG.test(html))
|
|
21733
|
-
return `${field} must not contain <script> tags; PrestaShop refuses them in a ${what}`;
|
|
21734
|
-
if (hasEventAttribute(html))
|
|
21735
|
-
return `${field} must not contain event attributes such as onclick="..."; PrestaShop refuses them in a ${what}`;
|
|
21736
|
-
if (/script:/i.test(html))
|
|
21737
|
-
return `${field} must not contain "script:" (for example a javascript: link); PrestaShop refuses it anywhere in a ${what}`;
|
|
21738
|
-
if (html.includes("\u202E"))
|
|
21739
|
-
return `${field} must not contain the right-to-left override character (U+202E); PrestaShop refuses it in a ${what}`;
|
|
21740
|
-
return null;
|
|
21741
|
-
}
|
|
21742
|
-
var PRESTASHOP_TEXT_FIELDS = Object.freeze({
|
|
21743
|
-
"prestashop.content.update": {
|
|
21744
|
-
title: { rule: "generic_name", what: "CMS page title" },
|
|
21745
|
-
body_html: { rule: "clean_html", what: "CMS page content" },
|
|
21746
|
-
seo_title: { rule: "generic_name", what: "meta title" },
|
|
21747
|
-
seo_description: { rule: "generic_name", what: "meta description", maxChars: 512 }
|
|
21748
|
-
},
|
|
21749
|
-
"prestashop.products.update": {
|
|
21750
|
-
title: { rule: "catalog_name", what: "product name", maxChars: 128 },
|
|
21751
|
-
description_html: { rule: "clean_html", what: "product description" },
|
|
21752
|
-
seo_title: { rule: "generic_name", what: "meta title" },
|
|
21753
|
-
seo_description: { rule: "generic_name", what: "meta description", maxChars: 512 }
|
|
21754
|
-
}
|
|
21755
|
-
});
|
|
21756
|
-
function prestashopTextProblem(field, spec, value) {
|
|
21757
|
-
if (spec.maxChars !== void 0 && [...value].length > spec.maxChars)
|
|
21758
|
-
return `${field} must be at most ${spec.maxChars} characters; PrestaShop refuses a longer ${spec.what}`;
|
|
21759
|
-
if (spec.rule === "clean_html")
|
|
21760
|
-
return cleanHtmlProblem(field, spec.what, value);
|
|
21761
|
-
const refused = NAME_REFUSED[spec.rule];
|
|
21762
|
-
return refused.pattern.test(value) ? `${field} must not contain any of ${refused.shown}; PrestaShop refuses them in a ${spec.what}` : null;
|
|
21763
|
-
}
|
|
21764
|
-
function shopText(base2, capability2, field) {
|
|
21765
|
-
const spec = PRESTASHOP_TEXT_FIELDS[capability2]?.[field];
|
|
21766
|
-
if (!spec)
|
|
21767
|
-
throw new Error(`no PrestaShop text rule for ${capability2} ${field}`);
|
|
21768
|
-
return base2.superRefine((value, ctx) => {
|
|
21769
|
-
const problem = prestashopTextProblem(field, spec, value);
|
|
21770
|
-
if (problem)
|
|
21771
|
-
ctx.addIssue({ code: "custom", message: problem });
|
|
21772
|
-
});
|
|
21773
|
-
}
|
|
21774
|
-
var contentRead2 = external_exports.strictObject({
|
|
21775
|
-
type: contentType6.optional(),
|
|
21776
|
-
id: prestashopId.optional(),
|
|
21777
|
-
query: siteQuery.optional(),
|
|
21778
|
-
limit: siteListLimit.optional(),
|
|
21779
|
-
cursor: cursor.optional()
|
|
21780
|
-
});
|
|
21781
|
-
var CONTENT = "prestashop.content.update";
|
|
21782
|
-
var CONTENT_FIELDS = ["title", "body_html", "seo_title", "seo_description"];
|
|
21783
|
-
var contentUpdate2 = external_exports.strictObject({
|
|
21784
|
-
type: contentType6.optional(),
|
|
21785
|
-
id: prestashopId,
|
|
21786
|
-
title: shopText(siteTitle, CONTENT, "title").optional(),
|
|
21787
|
-
body_html: shopText(siteBodyHtml, CONTENT, "body_html").optional(),
|
|
21788
|
-
seo_title: shopText(siteSeoTitle, CONTENT, "seo_title").optional(),
|
|
21789
|
-
seo_description: shopText(siteSeoDescription, CONTENT, "seo_description").optional(),
|
|
21790
|
-
expected_version: contentVersion.optional(),
|
|
21791
|
-
...siteWriteKeys
|
|
21792
|
-
}).refine(requireChange([...CONTENT_FIELDS]), "change at least one of title, body_html, seo_title, seo_description");
|
|
21793
|
-
var productsRead2 = external_exports.strictObject({
|
|
21794
|
-
id: prestashopId.optional(),
|
|
21795
|
-
inventory_item_id: prestashopId.optional(),
|
|
21796
|
-
query: siteQuery.optional(),
|
|
21797
|
-
status: productStatus2.optional(),
|
|
21798
|
-
limit: siteListLimit.optional(),
|
|
21799
|
-
cursor: cursor.optional()
|
|
21800
|
-
}).refine((value) => !(value.id !== void 0 && value.inventory_item_id !== void 0), "use either id or inventory_item_id");
|
|
21801
|
-
var PRODUCT_FIELDS = ["title", "description_html", "seo_title", "seo_description", "status", "price"];
|
|
21802
|
-
var PRODUCT = "prestashop.products.update";
|
|
21803
|
-
var productUpdate2 = external_exports.strictObject({
|
|
21804
|
-
id: prestashopId,
|
|
21805
|
-
title: shopText(siteTitle, PRODUCT, "title").optional(),
|
|
21806
|
-
description_html: shopText(siteBodyHtml, PRODUCT, "description_html").optional(),
|
|
21807
|
-
seo_title: shopText(siteSeoTitle, PRODUCT, "seo_title").optional(),
|
|
21808
|
-
seo_description: shopText(siteSeoDescription, PRODUCT, "seo_description").optional(),
|
|
21809
|
-
status: productStatus2.optional(),
|
|
21810
|
-
price: sitePrice.optional(),
|
|
21811
|
-
...siteWriteKeys
|
|
21812
|
-
}).refine(requireChange([...PRODUCT_FIELDS]), "change at least one of title, description_html, seo_title, seo_description, status, price");
|
|
21813
|
-
var inventoryUpdate2 = external_exports.strictObject({ item_id: prestashopId, quantity: siteQuantity, expected_quantity: siteQuantity.optional(), ...siteWriteKeys });
|
|
21814
|
-
var ordersBase2 = {
|
|
21815
|
-
id: prestashopId.optional(),
|
|
21816
|
-
status: siteOrderStatus.optional(),
|
|
21817
|
-
created_after: siteCreatedAfter.optional(),
|
|
21818
|
-
limit: siteListLimit.optional(),
|
|
21819
|
-
cursor: cursor.optional()
|
|
21820
|
-
};
|
|
21821
|
-
var ordersRead3 = external_exports.strictObject(ordersBase2);
|
|
21822
|
-
var customersRead2 = external_exports.strictObject({ ...ordersBase2, include_customer: external_exports.literal(true) });
|
|
21823
|
-
var apiCall3 = external_exports.strictObject({ method: siteApiMethod, path: siteApiPath, query: siteApiQuery.optional(), body: xmlBody.optional(), ...siteWriteKeys }).refine((value) => /^[a-z_]{2,64}$/.test(prestashopResourceOf(value.path)), "path must start with a Webservice resource, for example products/12").refine((value) => !Object.keys(value.query ?? {}).some(prestashopQueryNameDenied), "ws_key and url are not allowed in the query (the key and the resource are set by ConBridge)").refine((value) => value.method === "GET" || !PRESTASHOP_API_DENIED_WRITES.includes(prestashopResourceOf(value.path)), "raw changes to employees, customers, addresses, customer messages, guests and configurations are not allowed").refine((value) => value.body === void 0 || value.method === "POST" || value.method === "PUT" || value.method === "PATCH", "only POST, PUT and PATCH carry a body");
|
|
21824
|
-
var PRESTASHOP_CAPABILITY_DEFINITIONS = [
|
|
21825
|
-
{ connector: "prestashop", capability: "prestashop.content.read", risk: "read", description: "Read CMS pages", payload: contentRead2 },
|
|
21826
|
-
{ connector: "prestashop", capability: "prestashop.content.update", risk: "write", description: "Change a CMS page after your approval", payload: contentUpdate2 },
|
|
21827
|
-
{ connector: "prestashop", capability: "prestashop.products.read", risk: "read", description: "Read products, combinations and stock", payload: productsRead2 },
|
|
21828
|
-
{ connector: "prestashop", capability: "prestashop.products.update", risk: "write", description: "Change a product after your approval", payload: productUpdate2 },
|
|
21829
|
-
{ connector: "prestashop", capability: "prestashop.inventory.update", risk: "write", description: "Set a stock quantity after your approval", payload: inventoryUpdate2 },
|
|
21830
|
-
{ connector: "prestashop", capability: "prestashop.orders.read", risk: "read", description: "Read orders without customer data", payload: ordersRead3 },
|
|
21831
|
-
{ connector: "prestashop", capability: "prestashop.customers.read", risk: "read", description: "Read orders with customer names, emails, phones and addresses", payload: customersRead2, defaultEffect: "deny" },
|
|
21832
|
-
{ connector: "prestashop", capability: "prestashop.api.call", risk: "privileged", description: "Raw Webservice call after an owner or admin approves it", payload: apiCall3 }
|
|
21833
|
-
];
|
|
21497
|
+
var PRESTASHOP_CAPABILITY_DEFINITIONS = Object.freeze(siteSecurityCapabilities("prestashop"));
|
|
21834
21498
|
|
|
21835
21499
|
// ../../packages/protocol/dist/connectors/opencart.js
|
|
21836
|
-
var
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
var
|
|
21840
|
-
|
|
21841
|
-
var opencartProductStatus = external_exports.enum(["active", "draft"]);
|
|
21842
|
-
var contentRead3 = external_exports.strictObject({
|
|
21843
|
-
type: external_exports.enum(OPENCART_CONTENT_TYPES),
|
|
21844
|
-
id: opencartId.optional(),
|
|
21845
|
-
query: siteQuery.optional(),
|
|
21846
|
-
limit: siteListLimit.optional(),
|
|
21847
|
-
cursor: opencartCursor.optional()
|
|
21848
|
-
});
|
|
21849
|
-
var contentChanges = ["title", "body_html", "seo_title", "seo_description"];
|
|
21850
|
-
var contentUpdate3 = external_exports.strictObject({
|
|
21851
|
-
type: external_exports.enum(OPENCART_CONTENT_TYPES),
|
|
21852
|
-
id: opencartId,
|
|
21853
|
-
title: siteTitle.optional(),
|
|
21854
|
-
body_html: siteBodyHtml.optional(),
|
|
21855
|
-
seo_title: siteSeoTitle.optional(),
|
|
21856
|
-
seo_description: siteSeoDescription.optional(),
|
|
21857
|
-
expected_version: opencartVersion.optional(),
|
|
21858
|
-
...siteWriteKeys
|
|
21859
|
-
}).refine(requireChange([...contentChanges]), "nothing to change: pass title, body_html, seo_title or seo_description");
|
|
21860
|
-
var productsRead3 = external_exports.strictObject({
|
|
21861
|
-
id: opencartId.optional(),
|
|
21862
|
-
query: siteQuery.optional(),
|
|
21863
|
-
status: opencartProductStatus.optional(),
|
|
21864
|
-
limit: siteListLimit.optional(),
|
|
21865
|
-
cursor: opencartCursor.optional()
|
|
21866
|
-
});
|
|
21867
|
-
var productChanges = ["title", "description_html", "seo_title", "seo_description", "status", "price"];
|
|
21868
|
-
var productUpdate3 = external_exports.strictObject({
|
|
21869
|
-
id: opencartId,
|
|
21870
|
-
title: siteTitle.optional(),
|
|
21871
|
-
description_html: siteBodyHtml.optional(),
|
|
21872
|
-
seo_title: siteSeoTitle.optional(),
|
|
21873
|
-
seo_description: siteSeoDescription.optional(),
|
|
21874
|
-
status: opencartProductStatus.optional(),
|
|
21875
|
-
price: sitePrice.optional(),
|
|
21876
|
-
...siteWriteKeys
|
|
21877
|
-
}).refine(requireChange([...productChanges]), "nothing to change: pass title, description_html, seo_title, seo_description, status or price");
|
|
21878
|
-
var inventoryUpdate3 = external_exports.strictObject({ item_id: opencartStockItem, quantity: siteQuantity, expected_quantity: siteQuantity.optional(), ...siteWriteKeys });
|
|
21879
|
-
var orderFields = {
|
|
21880
|
-
id: opencartId.optional(),
|
|
21881
|
-
status: siteOrderStatus.optional(),
|
|
21882
|
-
created_after: siteCreatedAfter.optional(),
|
|
21883
|
-
limit: siteListLimit.optional(),
|
|
21884
|
-
cursor: opencartCursor.optional()
|
|
21500
|
+
var OPENCART_CAPABILITY_DEFINITIONS = Object.freeze(siteSecurityCapabilities("opencart"));
|
|
21501
|
+
|
|
21502
|
+
// ../../packages/protocol/dist/connectors/magento.js
|
|
21503
|
+
var magentoPayloadSchemas = {
|
|
21504
|
+
"magento.site.status": external_exports.strictObject({})
|
|
21885
21505
|
};
|
|
21886
|
-
var
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
{ connector: "opencart", capability: "opencart.inventory.update", risk: "write", description: "Set stock quantities after your approval", payload: inventoryUpdate3 },
|
|
21894
|
-
{ connector: "opencart", capability: "opencart.orders.read", risk: "read", description: "Read orders without customer data", payload: ordersRead4 },
|
|
21895
|
-
{ connector: "opencart", capability: "opencart.customers.read", risk: "read", description: "Read orders with customer names, emails, phones and addresses", payload: customersRead3, defaultEffect: "deny" }
|
|
21896
|
-
];
|
|
21506
|
+
var MAGENTO_CAPABILITY_DEFINITIONS = Object.freeze([
|
|
21507
|
+
...siteSecurityCapabilities("magento"),
|
|
21508
|
+
{ connector: "magento", capability: "magento.site.status", risk: "read", description: "Legacy read of the Magento version and installed extensions (modules older than 1.0.0)", payload: magentoPayloadSchemas["magento.site.status"] }
|
|
21509
|
+
]);
|
|
21510
|
+
|
|
21511
|
+
// ../../packages/protocol/dist/connectors/site-common.js
|
|
21512
|
+
var siteWriteKeys = { idempotency_key: external_exports.uuid(), approval_id: external_exports.uuid() };
|
|
21897
21513
|
|
|
21898
21514
|
// ../../packages/protocol/dist/connectors/index.js
|
|
21899
21515
|
registerCapabilities(DESKTOP_CAPABILITY_DEFINITIONS);
|
|
@@ -21902,22 +21518,19 @@ registerCapabilities(SHELL_CAPABILITY_DEFINITIONS);
|
|
|
21902
21518
|
registerCapabilities(BROWSER_CAPABILITY_DEFINITIONS);
|
|
21903
21519
|
registerCapabilities(VSCODE_CAPABILITY_DEFINITIONS);
|
|
21904
21520
|
registerCapabilities(WORDPRESS_CAPABILITY_DEFINITIONS);
|
|
21905
|
-
registerCapabilities(SHOPIFY_CAPABILITY_DEFINITIONS);
|
|
21906
|
-
registerCapabilities(WIX_CAPABILITY_DEFINITIONS);
|
|
21907
|
-
registerCapabilities(SQUARESPACE_CAPABILITY_DEFINITIONS);
|
|
21908
|
-
registerCapabilities(WEBFLOW_CAPABILITY_DEFINITIONS);
|
|
21909
21521
|
registerCapabilities(JOOMLA_CAPABILITY_DEFINITIONS);
|
|
21910
21522
|
registerCapabilities(DRUPAL_CAPABILITY_DEFINITIONS);
|
|
21911
21523
|
registerCapabilities(PRESTASHOP_CAPABILITY_DEFINITIONS);
|
|
21912
21524
|
registerCapabilities(OPENCART_CAPABILITY_DEFINITIONS);
|
|
21525
|
+
registerCapabilities(MAGENTO_CAPABILITY_DEFINITIONS);
|
|
21913
21526
|
|
|
21914
21527
|
// ../../packages/protocol/dist/session.js
|
|
21915
21528
|
function canonicalJson(value) {
|
|
21916
21529
|
if (value === null || typeof value !== "object") {
|
|
21917
|
-
const
|
|
21918
|
-
if (
|
|
21530
|
+
const text6 = JSON.stringify(value);
|
|
21531
|
+
if (text6 === void 0)
|
|
21919
21532
|
throw new TypeError("Value is not JSON serializable");
|
|
21920
|
-
return
|
|
21533
|
+
return text6;
|
|
21921
21534
|
}
|
|
21922
21535
|
if (Array.isArray(value))
|
|
21923
21536
|
return "[" + value.map(canonicalJson).join(",") + "]";
|
|
@@ -21978,10 +21591,10 @@ function toBase64Url(bytes3) {
|
|
|
21978
21591
|
binary += String.fromCharCode(byte);
|
|
21979
21592
|
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
21980
21593
|
}
|
|
21981
|
-
function fromBase64Url(
|
|
21982
|
-
if (!/^[A-Za-z0-9_-]*$/.test(
|
|
21594
|
+
function fromBase64Url(text6) {
|
|
21595
|
+
if (!/^[A-Za-z0-9_-]*$/.test(text6))
|
|
21983
21596
|
throw new TypeError("Invalid base64url");
|
|
21984
|
-
const padded =
|
|
21597
|
+
const padded = text6.replace(/-/g, "+").replace(/_/g, "/") + "=".repeat((4 - text6.length % 4) % 4);
|
|
21985
21598
|
const binary = atob(padded);
|
|
21986
21599
|
return Uint8Array.from(binary, (char) => char.charCodeAt(0));
|
|
21987
21600
|
}
|
|
@@ -22049,7 +21662,7 @@ var import_node_fs = require("node:fs");
|
|
|
22049
21662
|
var import_node_path2 = require("node:path");
|
|
22050
21663
|
var import_node_sea = require("node:sea");
|
|
22051
21664
|
var import_node_url = require("node:url");
|
|
22052
|
-
var SOURCE_VERSION = "0.
|
|
21665
|
+
var SOURCE_VERSION = "0.5.0";
|
|
22053
21666
|
var BUILD_INFO = typeof define_CONBRIDGE_BUILD_default === "object" && define_CONBRIDGE_BUILD_default !== null ? define_CONBRIDGE_BUILD_default : null;
|
|
22054
21667
|
var AGENT_VERSION = BUILD_INFO?.version ?? SOURCE_VERSION;
|
|
22055
21668
|
function runningAsSea() {
|
|
@@ -22105,11 +21718,11 @@ async function fsyncDirectory(path) {
|
|
|
22105
21718
|
await handle?.close().catch(() => void 0);
|
|
22106
21719
|
}
|
|
22107
21720
|
}
|
|
22108
|
-
async function writeFileAtomic(path,
|
|
21721
|
+
async function writeFileAtomic(path, content, mode) {
|
|
22109
21722
|
const temp = (0, import_node_path3.join)((0, import_node_path3.dirname)(path), `.${(0, import_node_path3.basename)(path)}.${randomToken(6)}.tmp`);
|
|
22110
21723
|
const handle = await (0, import_promises.open)(temp, "wx", mode);
|
|
22111
21724
|
try {
|
|
22112
|
-
await handle.writeFile(
|
|
21725
|
+
await handle.writeFile(content, "utf8");
|
|
22113
21726
|
await handle.chmod(mode);
|
|
22114
21727
|
await handle.sync();
|
|
22115
21728
|
} catch (error63) {
|
|
@@ -22368,9 +21981,9 @@ function withCronLine(current, line) {
|
|
|
22368
21981
|
const kept = current.split("\n").filter((entry) => entry.trim() !== "" && !entry.includes(CRON_MARKER));
|
|
22369
21982
|
return [...kept, ...line ? [line] : []].join("\n") + "\n";
|
|
22370
21983
|
}
|
|
22371
|
-
var systemCrontabWriter = (
|
|
21984
|
+
var systemCrontabWriter = (text6) => new Promise((resolve8) => {
|
|
22372
21985
|
const child = (0, import_node_child_process2.execFile)("crontab", ["-"], (error63, stdout, stderr) => resolve8({ ok: !error63, output: `${stdout}${stderr}`.trim() }));
|
|
22373
|
-
child.stdin?.end(
|
|
21986
|
+
child.stdin?.end(text6);
|
|
22374
21987
|
});
|
|
22375
21988
|
async function installCronService(options, deps = {}) {
|
|
22376
21989
|
const run2 = deps.run ?? systemCommand;
|
|
@@ -22875,8 +22488,8 @@ async function pairDevice(options) {
|
|
|
22875
22488
|
// dist/connect.js
|
|
22876
22489
|
var CONNECT_GATEWAY_HOSTS = ["mcp.conbridge.app", "staging.mcp.conbridge.app"];
|
|
22877
22490
|
function cleanName(value) {
|
|
22878
|
-
const
|
|
22879
|
-
return
|
|
22491
|
+
const text6 = (value ?? "").replace(/[\u0000-\u001f\u007f-\u009f]+/g, " ").replace(/\s+/g, " ").trim().slice(0, 64);
|
|
22492
|
+
return text6 || "My Mac";
|
|
22880
22493
|
}
|
|
22881
22494
|
function parseConnectLink(link, extraHosts = []) {
|
|
22882
22495
|
let url2;
|
|
@@ -22957,13 +22570,13 @@ function osascript(script, timeoutMs) {
|
|
|
22957
22570
|
}
|
|
22958
22571
|
var macConnectDialogs = {
|
|
22959
22572
|
async confirmConnect(host, name3, replacing) {
|
|
22960
|
-
const
|
|
22573
|
+
const text6 = (replacing ? "This Mac is already connected. Connecting again replaces that connection.\n\n" : "") + `Connect this Mac to ConBridge?
|
|
22961
22574
|
|
|
22962
22575
|
Your AI apps can use only the folders you choose, with the permissions you set in ConBridge.
|
|
22963
22576
|
|
|
22964
22577
|
Address: ${host}
|
|
22965
22578
|
Name: ${name3}`;
|
|
22966
|
-
const result2 = await osascript(`display dialog ${appleScriptString2(
|
|
22579
|
+
const result2 = await osascript(`display dialog ${appleScriptString2(text6)} with title "ConBridge" buttons {"Cancel", "Connect"} default button "Connect" cancel button "Cancel" giving up after 300`, 31e4);
|
|
22967
22580
|
return result2.ok && /button returned:Connect/.test(result2.stdout) && !/gave up:true/.test(result2.stdout);
|
|
22968
22581
|
},
|
|
22969
22582
|
async chooseFolders() {
|
|
@@ -22974,12 +22587,12 @@ Name: ${name3}`;
|
|
|
22974
22587
|
return result2.stdout.split("\n").map((line) => line.trim().replace(/\/$/, "")).filter(Boolean);
|
|
22975
22588
|
},
|
|
22976
22589
|
async askAllowChanges() {
|
|
22977
|
-
const
|
|
22978
|
-
const result2 = await osascript(`display dialog ${appleScriptString2(
|
|
22590
|
+
const text6 = "Should your AI apps be able to propose changes to these folders?\n\nYou still approve every change in ConBridge before anything is written.";
|
|
22591
|
+
const result2 = await osascript(`display dialog ${appleScriptString2(text6)} with title "ConBridge" buttons {"Read only", "Allow changes"} default button "Read only" giving up after 300`, 31e4);
|
|
22979
22592
|
return result2.ok && /button returned:Allow changes/.test(result2.stdout) && !/gave up:true/.test(result2.stdout);
|
|
22980
22593
|
},
|
|
22981
|
-
notify(
|
|
22982
|
-
void osascript(`display notification ${appleScriptString2(message)} with title ${appleScriptString2(
|
|
22594
|
+
notify(title, message) {
|
|
22595
|
+
void osascript(`display notification ${appleScriptString2(message)} with title ${appleScriptString2(title)}`, 1e4);
|
|
22983
22596
|
},
|
|
22984
22597
|
fail(message) {
|
|
22985
22598
|
void osascript(`display dialog ${appleScriptString2(message)} with title "ConBridge" buttons {"OK"} default button "OK" with icon caution`, 12e4);
|
|
@@ -23022,11 +22635,11 @@ var entrySchema = external_exports.discriminatedUnion("type", [
|
|
|
23022
22635
|
var watermarkSchema = external_exports.strictObject({ type: external_exports.literal("WATERMARK"), at_ms: external_exports.number().int(), watermark_ms: external_exports.number().int() });
|
|
23023
22636
|
var JOURNAL_RETENTION_MS = 30 * 24 * 60 * 60 * 1e3;
|
|
23024
22637
|
var JOURNAL_COMPACT_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
23025
|
-
function parseLines(
|
|
22638
|
+
function parseLines(text6) {
|
|
23026
22639
|
const entries = [];
|
|
23027
22640
|
let watermark = null;
|
|
23028
22641
|
let watermarkLines = 0;
|
|
23029
|
-
for (const line of
|
|
22642
|
+
for (const line of text6.split("\n")) {
|
|
23030
22643
|
if (line.trim() === "")
|
|
23031
22644
|
continue;
|
|
23032
22645
|
let value;
|
|
@@ -23061,14 +22674,14 @@ var Journal = class _Journal {
|
|
|
23061
22674
|
}
|
|
23062
22675
|
static async open(path) {
|
|
23063
22676
|
const journal = new _Journal(path);
|
|
23064
|
-
let
|
|
22677
|
+
let text6 = "";
|
|
23065
22678
|
try {
|
|
23066
|
-
|
|
22679
|
+
text6 = await (0, import_promises5.readFile)(path, "utf8");
|
|
23067
22680
|
} catch (error63) {
|
|
23068
22681
|
if (errorCode2(error63) !== "ENOENT")
|
|
23069
22682
|
throw error63;
|
|
23070
22683
|
}
|
|
23071
|
-
const parsed = parseLines(
|
|
22684
|
+
const parsed = parseLines(text6);
|
|
23072
22685
|
for (const entry of parsed.entries)
|
|
23073
22686
|
journal.#apply(entry);
|
|
23074
22687
|
journal.#watermark = parsed.watermark;
|
|
@@ -23169,16 +22782,16 @@ var Journal = class _Journal {
|
|
|
23169
22782
|
const cutoff = now - (options.retentionMs ?? JOURNAL_RETENTION_MS);
|
|
23170
22783
|
let stats = { kept_tasks: 0, dropped_tasks: 0, dropped_lines: 0 };
|
|
23171
22784
|
return this.#serialize(async () => {
|
|
23172
|
-
let
|
|
22785
|
+
let text6 = "";
|
|
23173
22786
|
try {
|
|
23174
|
-
|
|
22787
|
+
text6 = await (0, import_promises5.readFile)(this.#path, "utf8");
|
|
23175
22788
|
} catch (error63) {
|
|
23176
22789
|
if (errorCode2(error63) === "ENOENT")
|
|
23177
22790
|
return;
|
|
23178
22791
|
throw error63;
|
|
23179
22792
|
}
|
|
23180
|
-
const parsed = parseLines(
|
|
23181
|
-
const totalLines =
|
|
22793
|
+
const parsed = parseLines(text6);
|
|
22794
|
+
const totalLines = text6.split("\n").filter((line) => line.trim() !== "").length - parsed.watermarkLines;
|
|
23182
22795
|
const entries = parsed.entries;
|
|
23183
22796
|
let watermark = parsed.watermark;
|
|
23184
22797
|
const byTask = /* @__PURE__ */ new Map();
|
|
@@ -23670,13 +23283,13 @@ function buildEnvelope(identity, kind, taskId2, body, correlationId = (0, import
|
|
|
23670
23283
|
function encode3(envelope) {
|
|
23671
23284
|
return encodeEnvelope(envelope);
|
|
23672
23285
|
}
|
|
23673
|
-
function splitUtf8(
|
|
23674
|
-
if (
|
|
23286
|
+
function splitUtf8(text6, maxBytes = MAX_CHUNK_BYTES) {
|
|
23287
|
+
if (text6 === "")
|
|
23675
23288
|
return [""];
|
|
23676
23289
|
const pieces = [];
|
|
23677
23290
|
let current = "";
|
|
23678
23291
|
let currentBytes = 0;
|
|
23679
|
-
for (const char of
|
|
23292
|
+
for (const char of text6) {
|
|
23680
23293
|
const size = Buffer.byteLength(char, "utf8");
|
|
23681
23294
|
if (currentBytes + size > maxBytes) {
|
|
23682
23295
|
pieces.push(current);
|
|
@@ -23689,10 +23302,10 @@ function splitUtf8(text4, maxBytes = MAX_CHUNK_BYTES) {
|
|
|
23689
23302
|
pieces.push(current);
|
|
23690
23303
|
return pieces;
|
|
23691
23304
|
}
|
|
23692
|
-
function
|
|
23693
|
-
const
|
|
23694
|
-
if (
|
|
23695
|
-
return
|
|
23305
|
+
function excerpt(value) {
|
|
23306
|
+
const text6 = JSON.stringify(value);
|
|
23307
|
+
if (text6.length <= 4096)
|
|
23308
|
+
return text6;
|
|
23696
23309
|
const fallback = JSON.stringify({ ...Object.fromEntries(Object.entries(value).filter(([, v]) => typeof v !== "object")), excerpt_truncated: true });
|
|
23697
23310
|
return fallback.length <= 4096 ? fallback : JSON.stringify({ excerpt_truncated: true });
|
|
23698
23311
|
}
|
|
@@ -23995,10 +23608,10 @@ var RootedFs = class {
|
|
|
23995
23608
|
}
|
|
23996
23609
|
const truncated = size > keptBytes;
|
|
23997
23610
|
const prefix = truncated ? trimUtf8Tail(Buffer.concat(kept)) : Buffer.concat(kept);
|
|
23998
|
-
const
|
|
23999
|
-
if (
|
|
23611
|
+
const text6 = decodeText(prefix);
|
|
23612
|
+
if (text6 === null)
|
|
24000
23613
|
throw new FileOpError("NOT_TEXT", "File is not UTF-8 text", { path: rel });
|
|
24001
|
-
return { result: { path: rel, size, sha256: hash2.digest("hex"), truncated, bytes: prefix.length }, text:
|
|
23614
|
+
return { result: { path: rel, size, sha256: hash2.digest("hex"), truncated, bytes: prefix.length }, text: text6 };
|
|
24002
23615
|
} catch (error63) {
|
|
24003
23616
|
throw mapFsError(error63, rel);
|
|
24004
23617
|
} finally {
|
|
@@ -24080,11 +23693,11 @@ var RootedFs = class {
|
|
|
24080
23693
|
}
|
|
24081
23694
|
filesScanned += 1;
|
|
24082
23695
|
totalBytes += offset;
|
|
24083
|
-
const
|
|
24084
|
-
const
|
|
24085
|
-
if (
|
|
23696
|
+
const content = buffer.subarray(0, offset);
|
|
23697
|
+
const text6 = decodeText(info.size > offset ? trimUtf8Tail(content) : content);
|
|
23698
|
+
if (text6 === null)
|
|
24086
23699
|
return;
|
|
24087
|
-
const lines4 =
|
|
23700
|
+
const lines4 = text6.split("\n");
|
|
24088
23701
|
for (let index = 0; index < lines4.length; index += 1) {
|
|
24089
23702
|
const line = lines4[index];
|
|
24090
23703
|
const column = line.toLowerCase().indexOf(needle);
|
|
@@ -24243,14 +23856,14 @@ var RootedFs = class {
|
|
|
24243
23856
|
* or be null with the file absent. Writes a temp file in the same directory,
|
|
24244
23857
|
* fsyncs it, re-checks the version and renames over the target.
|
|
24245
23858
|
*/
|
|
24246
|
-
async write(input2, expectedSha256,
|
|
23859
|
+
async write(input2, expectedSha256, content) {
|
|
24247
23860
|
this.#requireWritable();
|
|
24248
23861
|
const { rel, rootReal, parentReal, name: name3, target } = await this.#resolveNew(input2);
|
|
24249
23862
|
const before = await this.#currentHash(rootReal, target);
|
|
24250
23863
|
if (before.sha256 !== expectedSha256) {
|
|
24251
23864
|
throw new FileOpError("WORKSPACE_VERSION_CONFLICT", "File changed since it was read", { path: rel, current_sha256: before.sha256 });
|
|
24252
23865
|
}
|
|
24253
|
-
const bytes3 = Buffer.from(
|
|
23866
|
+
const bytes3 = Buffer.from(content, "utf8");
|
|
24254
23867
|
await this.#replaceAtomic(rel, rootReal, parentReal, name3, target, before, bytes3);
|
|
24255
23868
|
return { path: rel, sha256_after: sha256OfBytes(bytes3), bytes: bytes3.length, created: before.sha256 === null };
|
|
24256
23869
|
}
|
|
@@ -24309,10 +23922,10 @@ var RootedFs = class {
|
|
|
24309
23922
|
} finally {
|
|
24310
23923
|
await handle.close().catch(() => void 0);
|
|
24311
23924
|
}
|
|
24312
|
-
const
|
|
24313
|
-
if (
|
|
23925
|
+
const text6 = decodeText(raw);
|
|
23926
|
+
if (text6 === null)
|
|
24314
23927
|
throw new FileOpError("NOT_TEXT", "File is not UTF-8 text", { path: rel });
|
|
24315
|
-
const parts =
|
|
23928
|
+
const parts = text6.split(oldText);
|
|
24316
23929
|
const found = parts.length - 1;
|
|
24317
23930
|
if (found !== expectedReplacements) {
|
|
24318
23931
|
throw new FileOpError("EDIT_MISMATCH", `old_text was found ${found} times, expected ${expectedReplacements}`, { path: rel, found });
|
|
@@ -24519,13 +24132,13 @@ var CANCELLED_BEFORE_START = Object.freeze({
|
|
|
24519
24132
|
state: "CANCELLED",
|
|
24520
24133
|
executed: false,
|
|
24521
24134
|
safe_message: "Task was cancelled before it started",
|
|
24522
|
-
output_excerpt:
|
|
24135
|
+
output_excerpt: excerpt({ error: "POLICY_DENIED", reason: "CANCELLED_BEFORE_START" })
|
|
24523
24136
|
});
|
|
24524
24137
|
var GRANT_EXPIRED = Object.freeze({
|
|
24525
24138
|
state: "EXPIRED",
|
|
24526
24139
|
executed: false,
|
|
24527
24140
|
safe_message: "Grant expired before execution",
|
|
24528
|
-
output_excerpt:
|
|
24141
|
+
output_excerpt: excerpt({ error: "CONTEXT_EXPIRED", reason: "GRANT_EXPIRED" })
|
|
24529
24142
|
});
|
|
24530
24143
|
var CONFIG_UNREADABLE = Object.freeze({
|
|
24531
24144
|
code: "POLICY_DENIED",
|
|
@@ -24541,7 +24154,7 @@ function denialResult(denial) {
|
|
|
24541
24154
|
state: "FAILED",
|
|
24542
24155
|
executed: false,
|
|
24543
24156
|
safe_message: denial.message,
|
|
24544
|
-
output_excerpt:
|
|
24157
|
+
output_excerpt: excerpt({ error: denial.code, reason: denial.reason, message: denial.message })
|
|
24545
24158
|
};
|
|
24546
24159
|
}
|
|
24547
24160
|
function fileErrorResult(error63) {
|
|
@@ -24549,7 +24162,7 @@ function fileErrorResult(error63) {
|
|
|
24549
24162
|
state: "FAILED",
|
|
24550
24163
|
executed: false,
|
|
24551
24164
|
safe_message: error63.message.slice(0, 256),
|
|
24552
|
-
output_excerpt:
|
|
24165
|
+
output_excerpt: excerpt({ error: error63.wireCode, reason: error63.reason, message: error63.message, ...error63.details })
|
|
24553
24166
|
};
|
|
24554
24167
|
}
|
|
24555
24168
|
var Dispatcher = class {
|
|
@@ -24608,7 +24221,7 @@ var Dispatcher = class {
|
|
|
24608
24221
|
this.#send(dispatch2, buildEnvelope(this.identity, "RESULT", dispatch2.task_id, {
|
|
24609
24222
|
state: "UNKNOWN",
|
|
24610
24223
|
safe_message: reason === "STARTED_WITHOUT_DONE" ? "Task started earlier but its outcome was not recorded; it will not be re-run" : "Task is older than the agent journal retention; whether it ran cannot be proven, it will not be run",
|
|
24611
|
-
output_excerpt:
|
|
24224
|
+
output_excerpt: excerpt({ error: "TASK_UNKNOWN", reason })
|
|
24612
24225
|
}, dispatch2.correlation_id));
|
|
24613
24226
|
}
|
|
24614
24227
|
#sendData(dispatch2, data) {
|
|
@@ -24712,7 +24325,7 @@ var Dispatcher = class {
|
|
|
24712
24325
|
state: "CANCELLED",
|
|
24713
24326
|
executed: false,
|
|
24714
24327
|
safe_message: "Write was declined on the device",
|
|
24715
|
-
output_excerpt:
|
|
24328
|
+
output_excerpt: excerpt({ error: "POLICY_DENIED", reason: "LOCAL_CONFIRM_DECLINED" })
|
|
24716
24329
|
};
|
|
24717
24330
|
await journal.done(taskId2, meta3, cancelled).catch(() => void 0);
|
|
24718
24331
|
this.#sendResult(dispatch2, cancelled);
|
|
@@ -24740,7 +24353,7 @@ var Dispatcher = class {
|
|
|
24740
24353
|
state: "FAILED",
|
|
24741
24354
|
executed: false,
|
|
24742
24355
|
safe_message: "Agent journal is unavailable; task not executed",
|
|
24743
|
-
output_excerpt:
|
|
24356
|
+
output_excerpt: excerpt({ error: "INVALID_MESSAGE", reason: "JOURNAL_UNAVAILABLE" })
|
|
24744
24357
|
});
|
|
24745
24358
|
return;
|
|
24746
24359
|
}
|
|
@@ -24752,7 +24365,7 @@ var Dispatcher = class {
|
|
|
24752
24365
|
state: "FAILED",
|
|
24753
24366
|
executed: authorized.capability !== "ssh.exec.output",
|
|
24754
24367
|
safe_message: "SSH task failed on the device",
|
|
24755
|
-
output_excerpt:
|
|
24368
|
+
output_excerpt: excerpt({ error: "INVALID_MESSAGE", reason: "SSH_ERROR" })
|
|
24756
24369
|
}
|
|
24757
24370
|
})) : isShellTask(authorized) ? await shellExecutor.run(authorized, taskContext).catch(() => ({
|
|
24758
24371
|
// Unexpected failure after STARTED: whether the action happened is not known, so never claim it did not.
|
|
@@ -24760,7 +24373,7 @@ var Dispatcher = class {
|
|
|
24760
24373
|
state: "FAILED",
|
|
24761
24374
|
executed: true,
|
|
24762
24375
|
safe_message: "Terminal task failed on the device",
|
|
24763
|
-
output_excerpt:
|
|
24376
|
+
output_excerpt: excerpt({ error: "INVALID_MESSAGE", reason: "SHELL_ERROR" })
|
|
24764
24377
|
}
|
|
24765
24378
|
})) : await this.#execute(fs, fileTask);
|
|
24766
24379
|
try {
|
|
@@ -24871,14 +24484,14 @@ var Dispatcher = class {
|
|
|
24871
24484
|
switch (task.capability) {
|
|
24872
24485
|
case "files.read": {
|
|
24873
24486
|
const payload = task.payload;
|
|
24874
|
-
const { result: result2, text:
|
|
24875
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24487
|
+
const { result: result2, text: text6 } = await fs.read(payload.path, payload.max_bytes);
|
|
24488
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...result2 }) }, data: text6 };
|
|
24876
24489
|
}
|
|
24877
24490
|
case "files.list": {
|
|
24878
24491
|
const payload = task.payload;
|
|
24879
24492
|
const result2 = await fs.list(payload.path);
|
|
24880
24493
|
return {
|
|
24881
|
-
result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24494
|
+
result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ path: result2.path, count: result2.entries.length, truncated: result2.truncated }) },
|
|
24882
24495
|
data: JSON.stringify(result2)
|
|
24883
24496
|
};
|
|
24884
24497
|
}
|
|
@@ -24889,7 +24502,7 @@ var Dispatcher = class {
|
|
|
24889
24502
|
result: {
|
|
24890
24503
|
state: "SUCCEEDED",
|
|
24891
24504
|
executed: true,
|
|
24892
|
-
output_excerpt:
|
|
24505
|
+
output_excerpt: excerpt({ path: result2.path, count: result2.matches.length, truncated: result2.truncated, files_scanned: result2.files_scanned })
|
|
24893
24506
|
},
|
|
24894
24507
|
data: JSON.stringify(result2)
|
|
24895
24508
|
};
|
|
@@ -24897,29 +24510,29 @@ var Dispatcher = class {
|
|
|
24897
24510
|
case "files.write": {
|
|
24898
24511
|
const payload = task.payload;
|
|
24899
24512
|
const result2 = await fs.write(payload.path, payload.expected_sha256, payload.content);
|
|
24900
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24513
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...result2 }) } };
|
|
24901
24514
|
}
|
|
24902
24515
|
case "files.info": {
|
|
24903
24516
|
const payload = task.payload;
|
|
24904
24517
|
const result2 = await fs.info(payload.path);
|
|
24905
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24518
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ path: result2.path, type: result2.type }) }, data: JSON.stringify(result2) };
|
|
24906
24519
|
}
|
|
24907
24520
|
case "files.edit": {
|
|
24908
24521
|
const payload = task.payload;
|
|
24909
24522
|
const result2 = await fs.edit(payload.path, payload.expected_sha256, payload.old_text, payload.new_text, payload.expected_replacements);
|
|
24910
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24523
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...result2 }) } };
|
|
24911
24524
|
}
|
|
24912
24525
|
case "files.mkdir": {
|
|
24913
24526
|
const payload = task.payload;
|
|
24914
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24527
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...await fs.mkdir(payload.path) }) } };
|
|
24915
24528
|
}
|
|
24916
24529
|
case "files.move": {
|
|
24917
24530
|
const payload = task.payload;
|
|
24918
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24531
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...await fs.move(payload.path, payload.to) }) } };
|
|
24919
24532
|
}
|
|
24920
24533
|
case "files.delete": {
|
|
24921
24534
|
const payload = task.payload;
|
|
24922
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
24535
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ ...await fs.delete(payload.path, payload.expected_sha256) }) } };
|
|
24923
24536
|
}
|
|
24924
24537
|
}
|
|
24925
24538
|
} catch (error63) {
|
|
@@ -25152,15 +24765,15 @@ function preferredKey(keys) {
|
|
|
25152
24765
|
return null;
|
|
25153
24766
|
}
|
|
25154
24767
|
async function loadSshHosts(paths) {
|
|
25155
|
-
let
|
|
24768
|
+
let text6;
|
|
25156
24769
|
try {
|
|
25157
|
-
|
|
24770
|
+
text6 = await (0, import_promises11.readFile)(paths.hosts, "utf8");
|
|
25158
24771
|
} catch (error63) {
|
|
25159
24772
|
if (errorCode2(error63) === "ENOENT")
|
|
25160
24773
|
return [];
|
|
25161
24774
|
throw error63;
|
|
25162
24775
|
}
|
|
25163
|
-
return hostsFileSchema.parse(JSON.parse(
|
|
24776
|
+
return hostsFileSchema.parse(JSON.parse(text6)).hosts;
|
|
25164
24777
|
}
|
|
25165
24778
|
async function ensureSshDirs(paths) {
|
|
25166
24779
|
for (const dir of [paths.dir, paths.knownHostsDir]) {
|
|
@@ -25403,7 +25016,7 @@ var VERSION_MAX = 128;
|
|
|
25403
25016
|
var ARCH_MAX = 32;
|
|
25404
25017
|
var PUBLISHER_MAX = 200;
|
|
25405
25018
|
var MAX_PACKAGES = INVENTORY_LIMITS.packages;
|
|
25406
|
-
function
|
|
25019
|
+
function text2(value, max) {
|
|
25407
25020
|
if (typeof value !== "string")
|
|
25408
25021
|
return "";
|
|
25409
25022
|
const trimmed = value.trim();
|
|
@@ -25412,10 +25025,10 @@ function text(value, max) {
|
|
|
25412
25025
|
return trimmed.slice(0, max).trimEnd();
|
|
25413
25026
|
}
|
|
25414
25027
|
function nameOf(value) {
|
|
25415
|
-
return
|
|
25028
|
+
return text2(value, NAME_MAX);
|
|
25416
25029
|
}
|
|
25417
25030
|
function versionOf(value) {
|
|
25418
|
-
return
|
|
25031
|
+
return text2(value, VERSION_MAX);
|
|
25419
25032
|
}
|
|
25420
25033
|
function asRecord(value) {
|
|
25421
25034
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -25430,7 +25043,7 @@ function push(result2, item) {
|
|
|
25430
25043
|
result2.push(item);
|
|
25431
25044
|
}
|
|
25432
25045
|
function integerText(value) {
|
|
25433
|
-
const raw =
|
|
25046
|
+
const raw = text2(value, 64);
|
|
25434
25047
|
if (!/^\d+$/.test(raw))
|
|
25435
25048
|
return void 0;
|
|
25436
25049
|
const number4 = Number(raw);
|
|
@@ -25483,15 +25096,15 @@ function parseDpkg(stdout) {
|
|
|
25483
25096
|
const parts = line.split(" ");
|
|
25484
25097
|
if (parts.length < 5)
|
|
25485
25098
|
continue;
|
|
25486
|
-
const status =
|
|
25099
|
+
const status = text2(parts[4], 16);
|
|
25487
25100
|
if (!status.startsWith("ii") && !status.startsWith("hi"))
|
|
25488
25101
|
continue;
|
|
25489
25102
|
const name3 = nameOf(parts[0]);
|
|
25490
25103
|
if (!name3)
|
|
25491
25104
|
continue;
|
|
25492
|
-
const
|
|
25493
|
-
const item = { name: name3, version:
|
|
25494
|
-
const arch3 =
|
|
25105
|
+
const version3 = versionOf(parts[1]);
|
|
25106
|
+
const item = { name: name3, version: version3, manager: "dpkg" };
|
|
25107
|
+
const arch3 = text2(parts[2], ARCH_MAX);
|
|
25495
25108
|
if (arch3)
|
|
25496
25109
|
item.arch = arch3;
|
|
25497
25110
|
const size = sizeFromKiB(parts[3]);
|
|
@@ -25501,7 +25114,7 @@ function parseDpkg(stdout) {
|
|
|
25501
25114
|
if (sourceName && sourceName !== name3)
|
|
25502
25115
|
item.source_name = sourceName;
|
|
25503
25116
|
const sourceVersion = versionOf(parts[6]);
|
|
25504
|
-
if (sourceVersion && sourceVersion !==
|
|
25117
|
+
if (sourceVersion && sourceVersion !== version3)
|
|
25505
25118
|
item.source_version = sourceVersion;
|
|
25506
25119
|
push(result2, item);
|
|
25507
25120
|
}
|
|
@@ -25516,14 +25129,14 @@ function parseRpm(stdout) {
|
|
|
25516
25129
|
const name3 = nameOf(parts[0]);
|
|
25517
25130
|
if (!name3 || name3 === "gpg-pubkey")
|
|
25518
25131
|
continue;
|
|
25519
|
-
const
|
|
25132
|
+
const version3 = versionOf(parts[2]);
|
|
25520
25133
|
const release2 = versionOf(parts[3]);
|
|
25521
|
-
if (!
|
|
25134
|
+
if (!version3 || !release2)
|
|
25522
25135
|
continue;
|
|
25523
|
-
const epoch =
|
|
25136
|
+
const epoch = text2(parts[1], 32);
|
|
25524
25137
|
const epochPrefix = /^\d+$/.test(epoch) ? `${epoch}:` : "";
|
|
25525
|
-
const item = { name: name3, version: versionOf(`${epochPrefix}${
|
|
25526
|
-
const arch3 =
|
|
25138
|
+
const item = { name: name3, version: versionOf(`${epochPrefix}${version3}-${release2}`), manager: "rpm" };
|
|
25139
|
+
const arch3 = text2(parts[4], ARCH_MAX);
|
|
25527
25140
|
if (arch3 && arch3 !== "(none)")
|
|
25528
25141
|
item.arch = arch3;
|
|
25529
25142
|
const size = integerText(parts[5]);
|
|
@@ -25545,7 +25158,7 @@ function parseApk(stdout) {
|
|
|
25545
25158
|
continue;
|
|
25546
25159
|
const item = { name: name3, version: versionOf(match[2]), manager: "apk" };
|
|
25547
25160
|
const rest = trimmed.slice(match[0].length).trim().split(/\s+/);
|
|
25548
|
-
const arch3 =
|
|
25161
|
+
const arch3 = text2(rest[0], ARCH_MAX);
|
|
25549
25162
|
if (arch3)
|
|
25550
25163
|
item.arch = arch3;
|
|
25551
25164
|
push(result2, item);
|
|
@@ -25577,7 +25190,7 @@ function parseSnap(stdout) {
|
|
|
25577
25190
|
if (!name3)
|
|
25578
25191
|
continue;
|
|
25579
25192
|
const item = { name: name3, version: versionOf(parts[1]), manager: "snap" };
|
|
25580
|
-
const publisher =
|
|
25193
|
+
const publisher = text2(parts[4], PUBLISHER_MAX).replace(/[✓*]+$/u, "").trim();
|
|
25581
25194
|
if (publisher && publisher !== "-")
|
|
25582
25195
|
item.publisher = publisher;
|
|
25583
25196
|
push(result2, item);
|
|
@@ -25628,16 +25241,16 @@ function parseMacApps(json2) {
|
|
|
25628
25241
|
const name3 = nameOf(info._name);
|
|
25629
25242
|
if (!name3)
|
|
25630
25243
|
continue;
|
|
25631
|
-
const path =
|
|
25244
|
+
const path = text2(info.path, 4096);
|
|
25632
25245
|
if (!isApplicationPath(path))
|
|
25633
25246
|
continue;
|
|
25634
|
-
const
|
|
25635
|
-
const key = `${name3}\0${
|
|
25247
|
+
const version3 = versionOf(info.version);
|
|
25248
|
+
const key = `${name3}\0${version3}`;
|
|
25636
25249
|
if (seen.has(key))
|
|
25637
25250
|
continue;
|
|
25638
25251
|
seen.add(key);
|
|
25639
|
-
const item = { name: name3, version:
|
|
25640
|
-
const source =
|
|
25252
|
+
const item = { name: name3, version: version3, manager: "macos-app" };
|
|
25253
|
+
const source = text2(info.obtained_from, 60);
|
|
25641
25254
|
if (source === "apple")
|
|
25642
25255
|
item.publisher = "Apple";
|
|
25643
25256
|
else if (source === "mac_app_store")
|
|
@@ -25658,13 +25271,13 @@ function parseWindowsPrograms(json2) {
|
|
|
25658
25271
|
const name3 = nameOf(info.DisplayName);
|
|
25659
25272
|
if (!name3)
|
|
25660
25273
|
continue;
|
|
25661
|
-
const
|
|
25662
|
-
const key = `${name3}\0${
|
|
25274
|
+
const version3 = versionOf(info.DisplayVersion);
|
|
25275
|
+
const key = `${name3}\0${version3}`;
|
|
25663
25276
|
if (seen.has(key))
|
|
25664
25277
|
continue;
|
|
25665
25278
|
seen.add(key);
|
|
25666
|
-
const item = { name: name3, version:
|
|
25667
|
-
const publisher =
|
|
25279
|
+
const item = { name: name3, version: version3, manager: "windows" };
|
|
25280
|
+
const publisher = text2(info.Publisher, PUBLISHER_MAX);
|
|
25668
25281
|
if (publisher)
|
|
25669
25282
|
item.publisher = publisher;
|
|
25670
25283
|
const size = sizeFromKb(info.EstimatedSize);
|
|
@@ -25695,9 +25308,9 @@ function splitSections(output2) {
|
|
|
25695
25308
|
let end = buffer.length;
|
|
25696
25309
|
while (end > 0 && buffer[end - 1] === "")
|
|
25697
25310
|
end -= 1;
|
|
25698
|
-
const
|
|
25311
|
+
const content = buffer.slice(0, end).join("\n");
|
|
25699
25312
|
if (!sections.has(current))
|
|
25700
|
-
sections.set(current,
|
|
25313
|
+
sections.set(current, content);
|
|
25701
25314
|
current = void 0;
|
|
25702
25315
|
buffer = [];
|
|
25703
25316
|
};
|
|
@@ -25744,11 +25357,11 @@ function unquote(raw) {
|
|
|
25744
25357
|
}
|
|
25745
25358
|
return value;
|
|
25746
25359
|
}
|
|
25747
|
-
function parseOsRelease(
|
|
25360
|
+
function parseOsRelease(text6) {
|
|
25748
25361
|
const result2 = {};
|
|
25749
|
-
if (typeof
|
|
25362
|
+
if (typeof text6 !== "string")
|
|
25750
25363
|
return result2;
|
|
25751
|
-
for (const rawLine of
|
|
25364
|
+
for (const rawLine of text6.split(/\r?\n/)) {
|
|
25752
25365
|
const line = rawLine.trim();
|
|
25753
25366
|
if (!line || line.startsWith("#"))
|
|
25754
25367
|
continue;
|
|
@@ -25766,11 +25379,11 @@ function parseOsRelease(text4) {
|
|
|
25766
25379
|
}
|
|
25767
25380
|
return result2;
|
|
25768
25381
|
}
|
|
25769
|
-
function parseSwVers(
|
|
25382
|
+
function parseSwVers(text6) {
|
|
25770
25383
|
const result2 = {};
|
|
25771
|
-
if (typeof
|
|
25384
|
+
if (typeof text6 !== "string")
|
|
25772
25385
|
return result2;
|
|
25773
|
-
for (const rawLine of
|
|
25386
|
+
for (const rawLine of text6.split(/\r?\n/)) {
|
|
25774
25387
|
const line = rawLine.trim();
|
|
25775
25388
|
if (!line)
|
|
25776
25389
|
continue;
|
|
@@ -25823,19 +25436,19 @@ function parseWindowsOs(json2) {
|
|
|
25823
25436
|
if (!info)
|
|
25824
25437
|
return null;
|
|
25825
25438
|
const caption = stringField(info.Caption).replace(/^Microsoft\s+/i, "");
|
|
25826
|
-
const
|
|
25827
|
-
if (!caption || !
|
|
25439
|
+
const version3 = stringField(info.Version);
|
|
25440
|
+
if (!caption || !version3)
|
|
25828
25441
|
return null;
|
|
25829
25442
|
const buildNumber = stringField(info.BuildNumber);
|
|
25830
25443
|
const ubr = info.UBR;
|
|
25831
25444
|
const build = typeof ubr === "number" ? `${buildNumber}.${ubr}` : buildNumber;
|
|
25832
|
-
return { caption, version:
|
|
25445
|
+
return { caption, version: version3, build, arch: windowsArch(stringField(info.OSArchitecture)) };
|
|
25833
25446
|
}
|
|
25834
25447
|
var MODEL_PLACEHOLDERS = /* @__PURE__ */ new Set(["to be filled by o.e.m.", "system product name", "default string"]);
|
|
25835
|
-
function cleanModel(
|
|
25836
|
-
if (typeof
|
|
25448
|
+
function cleanModel(text6) {
|
|
25449
|
+
if (typeof text6 !== "string")
|
|
25837
25450
|
return null;
|
|
25838
|
-
const cleaned =
|
|
25451
|
+
const cleaned = text6.replace(/\0/g, "").trim().slice(0, 200);
|
|
25839
25452
|
if (!cleaned)
|
|
25840
25453
|
return null;
|
|
25841
25454
|
if (MODEL_PLACEHOLDERS.has(cleaned.toLowerCase()))
|
|
@@ -25850,7 +25463,7 @@ function firstNonEmptyLine(output2) {
|
|
|
25850
25463
|
}
|
|
25851
25464
|
return "";
|
|
25852
25465
|
}
|
|
25853
|
-
function
|
|
25466
|
+
function group2(match) {
|
|
25854
25467
|
if (!match)
|
|
25855
25468
|
return null;
|
|
25856
25469
|
const value = match[1];
|
|
@@ -25860,7 +25473,7 @@ function group(match) {
|
|
|
25860
25473
|
return trimmed ? trimmed : null;
|
|
25861
25474
|
}
|
|
25862
25475
|
function capture(pattern, value) {
|
|
25863
|
-
return
|
|
25476
|
+
return group2(pattern.exec(value));
|
|
25864
25477
|
}
|
|
25865
25478
|
var GENERIC_VERSION = /^v?(\d+\.\d+(?:\.\d+)?(?:[-+][0-9A-Za-z.-]+)?)\s*$/;
|
|
25866
25479
|
var VERSION_PARSERS = {
|
|
@@ -25900,10 +25513,10 @@ function extractVersion(key, output2) {
|
|
|
25900
25513
|
if (typeof key !== "string" || typeof output2 !== "string")
|
|
25901
25514
|
return null;
|
|
25902
25515
|
const parser = VERSION_PARSERS[key];
|
|
25903
|
-
const
|
|
25904
|
-
if (!
|
|
25516
|
+
const version3 = parser ? parser(output2) : capture(GENERIC_VERSION, firstNonEmptyLine(output2));
|
|
25517
|
+
if (!version3)
|
|
25905
25518
|
return null;
|
|
25906
|
-
return
|
|
25519
|
+
return version3.slice(0, 128);
|
|
25907
25520
|
}
|
|
25908
25521
|
|
|
25909
25522
|
// dist/inventory/ssh.js
|
|
@@ -26221,6 +25834,7 @@ var InventoryLoop = class {
|
|
|
26221
25834
|
|
|
26222
25835
|
// dist/inventory/collector.js
|
|
26223
25836
|
var import_node_child_process7 = require("node:child_process");
|
|
25837
|
+
var import_node_fs3 = require("node:fs");
|
|
26224
25838
|
var import_promises12 = require("node:fs/promises");
|
|
26225
25839
|
var import_node_os4 = require("node:os");
|
|
26226
25840
|
|
|
@@ -26228,7 +25842,7 @@ var import_node_os4 = require("node:os");
|
|
|
26228
25842
|
var NAME_MAX2 = 200;
|
|
26229
25843
|
var DESCRIPTION_MAX = 200;
|
|
26230
25844
|
var MAX_SERVICES = INVENTORY_LIMITS.services;
|
|
26231
|
-
function
|
|
25845
|
+
function text3(value, max) {
|
|
26232
25846
|
if (typeof value !== "string")
|
|
26233
25847
|
return "";
|
|
26234
25848
|
const trimmed = value.trim();
|
|
@@ -26257,8 +25871,8 @@ function sorted(result2) {
|
|
|
26257
25871
|
result2.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
26258
25872
|
return result2.slice(0, MAX_SERVICES);
|
|
26259
25873
|
}
|
|
26260
|
-
function unitName(
|
|
26261
|
-
return
|
|
25874
|
+
function unitName(unit2) {
|
|
25875
|
+
return unit2.endsWith(".service") ? unit2.slice(0, -".service".length) : unit2;
|
|
26262
25876
|
}
|
|
26263
25877
|
function systemdState(active, sub) {
|
|
26264
25878
|
if (active === "active")
|
|
@@ -26277,16 +25891,16 @@ function unitFileEnablement(unitFiles) {
|
|
|
26277
25891
|
const enablement = /* @__PURE__ */ new Map();
|
|
26278
25892
|
for (const line of lines2(unitFiles)) {
|
|
26279
25893
|
const parts = line.trim().split(/\s+/);
|
|
26280
|
-
const
|
|
25894
|
+
const unit2 = parts[0];
|
|
26281
25895
|
const state2 = parts[1];
|
|
26282
|
-
if (!
|
|
25896
|
+
if (!unit2 || !state2)
|
|
26283
25897
|
continue;
|
|
26284
25898
|
if (state2 === "enabled" || state2 === "enabled-runtime")
|
|
26285
|
-
enablement.set(unitName(
|
|
25899
|
+
enablement.set(unitName(unit2), true);
|
|
26286
25900
|
else if (state2 === "disabled" || state2 === "masked")
|
|
26287
|
-
enablement.set(unitName(
|
|
25901
|
+
enablement.set(unitName(unit2), false);
|
|
26288
25902
|
else
|
|
26289
|
-
enablement.set(unitName(
|
|
25903
|
+
enablement.set(unitName(unit2), null);
|
|
26290
25904
|
}
|
|
26291
25905
|
return enablement;
|
|
26292
25906
|
}
|
|
@@ -26306,7 +25920,7 @@ function parseSystemd(units, unitFiles) {
|
|
|
26306
25920
|
continue;
|
|
26307
25921
|
if (load === "not-found")
|
|
26308
25922
|
continue;
|
|
26309
|
-
const name3 =
|
|
25923
|
+
const name3 = text3(unitName(unitToken), NAME_MAX2);
|
|
26310
25924
|
if (!name3)
|
|
26311
25925
|
continue;
|
|
26312
25926
|
const item = {
|
|
@@ -26315,7 +25929,7 @@ function parseSystemd(units, unitFiles) {
|
|
|
26315
25929
|
state: systemdState(active.toLowerCase(), sub.toLowerCase()),
|
|
26316
25930
|
enabled: enablement.get(name3) ?? null
|
|
26317
25931
|
};
|
|
26318
|
-
const description =
|
|
25932
|
+
const description = text3(match[5] ?? "", DESCRIPTION_MAX);
|
|
26319
25933
|
if (description)
|
|
26320
25934
|
item.description = description;
|
|
26321
25935
|
result2.push(item);
|
|
@@ -26330,7 +25944,7 @@ function parseLaunchctl(stdout) {
|
|
|
26330
25944
|
continue;
|
|
26331
25945
|
const pid = (parts[0] ?? "").trim();
|
|
26332
25946
|
const statusText = (parts[1] ?? "").trim();
|
|
26333
|
-
const label =
|
|
25947
|
+
const label = text3(parts[2], NAME_MAX2);
|
|
26334
25948
|
if (!label)
|
|
26335
25949
|
continue;
|
|
26336
25950
|
if (label.startsWith("com.apple.") || label.startsWith("application."))
|
|
@@ -26358,7 +25972,7 @@ function parseBrewServices(json2) {
|
|
|
26358
25972
|
const info = asRecord3(value);
|
|
26359
25973
|
if (!info)
|
|
26360
25974
|
continue;
|
|
26361
|
-
const name3 =
|
|
25975
|
+
const name3 = text3(info.name, NAME_MAX2);
|
|
26362
25976
|
if (!name3)
|
|
26363
25977
|
continue;
|
|
26364
25978
|
const status = typeof info.status === "string" ? info.status.trim().toLowerCase() : "";
|
|
@@ -26434,7 +26048,7 @@ function parseWindowsServices(json2) {
|
|
|
26434
26048
|
const info = asRecord3(value);
|
|
26435
26049
|
if (!info)
|
|
26436
26050
|
continue;
|
|
26437
|
-
const name3 =
|
|
26051
|
+
const name3 = text3(info.Name, NAME_MAX2);
|
|
26438
26052
|
if (!name3)
|
|
26439
26053
|
continue;
|
|
26440
26054
|
const item = {
|
|
@@ -26443,7 +26057,7 @@ function parseWindowsServices(json2) {
|
|
|
26443
26057
|
state: windowsState(info.Status),
|
|
26444
26058
|
enabled: windowsEnabled(info.StartType)
|
|
26445
26059
|
};
|
|
26446
|
-
const description =
|
|
26060
|
+
const description = text3(info.DisplayName, DESCRIPTION_MAX);
|
|
26447
26061
|
if (description && description !== name3)
|
|
26448
26062
|
item.description = description;
|
|
26449
26063
|
result2.push(item);
|
|
@@ -26481,7 +26095,7 @@ var BYTE_MULTIPLIERS = {
|
|
|
26481
26095
|
gib: 1024 * 1024 * 1024,
|
|
26482
26096
|
tib: 1024 * 1024 * 1024 * 1024
|
|
26483
26097
|
};
|
|
26484
|
-
function
|
|
26098
|
+
function text4(value, max) {
|
|
26485
26099
|
if (typeof value !== "string")
|
|
26486
26100
|
return "";
|
|
26487
26101
|
const trimmed = value.trim();
|
|
@@ -26490,7 +26104,7 @@ function text3(value, max) {
|
|
|
26490
26104
|
return trimmed.slice(0, max).trimEnd();
|
|
26491
26105
|
}
|
|
26492
26106
|
function nameOf2(value) {
|
|
26493
|
-
return
|
|
26107
|
+
return text4(value, NAME_MAX3);
|
|
26494
26108
|
}
|
|
26495
26109
|
function asRecord4(value) {
|
|
26496
26110
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
@@ -26562,7 +26176,7 @@ function dockerPorts(value) {
|
|
|
26562
26176
|
return [];
|
|
26563
26177
|
const ports = [];
|
|
26564
26178
|
for (const part of value.split(",")) {
|
|
26565
|
-
const port =
|
|
26179
|
+
const port = text4(part, PORT_MAX);
|
|
26566
26180
|
if (!port)
|
|
26567
26181
|
continue;
|
|
26568
26182
|
ports.push(port);
|
|
@@ -26574,7 +26188,7 @@ function dockerPorts(value) {
|
|
|
26574
26188
|
function portText(value) {
|
|
26575
26189
|
if (typeof value === "number" && Number.isFinite(value))
|
|
26576
26190
|
return String(value);
|
|
26577
|
-
return
|
|
26191
|
+
return text4(value, 16);
|
|
26578
26192
|
}
|
|
26579
26193
|
function podmanPorts(value) {
|
|
26580
26194
|
if (!Array.isArray(value))
|
|
@@ -26584,13 +26198,13 @@ function podmanPorts(value) {
|
|
|
26584
26198
|
const port = asRecord4(entry);
|
|
26585
26199
|
if (!port)
|
|
26586
26200
|
continue;
|
|
26587
|
-
const hostIp =
|
|
26201
|
+
const hostIp = text4(port.host_ip, 64) || "0.0.0.0";
|
|
26588
26202
|
const hostPort = portText(port.host_port);
|
|
26589
26203
|
const containerPort = portText(port.container_port);
|
|
26590
26204
|
if (!hostPort || !containerPort)
|
|
26591
26205
|
continue;
|
|
26592
|
-
const protocol =
|
|
26593
|
-
const rendered =
|
|
26206
|
+
const protocol = text4(port.protocol, 8) || "tcp";
|
|
26207
|
+
const rendered = text4(`${hostIp}:${hostPort}->${containerPort}/${protocol}`, PORT_MAX);
|
|
26594
26208
|
if (!rendered)
|
|
26595
26209
|
continue;
|
|
26596
26210
|
ports.push(rendered);
|
|
@@ -26654,7 +26268,7 @@ function splitImageName(value) {
|
|
|
26654
26268
|
if (colon > slash) {
|
|
26655
26269
|
return {
|
|
26656
26270
|
repository: nameOf2(name3.slice(0, colon)) || "<none>",
|
|
26657
|
-
tag:
|
|
26271
|
+
tag: text4(name3.slice(colon + 1), TAG_MAX)
|
|
26658
26272
|
};
|
|
26659
26273
|
}
|
|
26660
26274
|
return { repository: nameOf2(name3) || "<none>", tag: "" };
|
|
@@ -26699,7 +26313,7 @@ function parseDockerPs(jsonLines) {
|
|
|
26699
26313
|
image,
|
|
26700
26314
|
engine: "docker",
|
|
26701
26315
|
state: containerState(info.State),
|
|
26702
|
-
status:
|
|
26316
|
+
status: text4(info.Status, STATUS_MAX),
|
|
26703
26317
|
ports: dockerPorts(info.Ports)
|
|
26704
26318
|
};
|
|
26705
26319
|
const createdAt = parseDockerTime(typeof info.CreatedAt === "string" ? info.CreatedAt : "");
|
|
@@ -26728,7 +26342,7 @@ function parseDockerImages(jsonLines) {
|
|
|
26728
26342
|
if (!id)
|
|
26729
26343
|
continue;
|
|
26730
26344
|
const repository = nameOf2(info.Repository) || "<none>";
|
|
26731
|
-
const rawTag =
|
|
26345
|
+
const rawTag = text4(info.Tag, TAG_MAX);
|
|
26732
26346
|
const tag = rawTag === "<none>" ? "" : rawTag;
|
|
26733
26347
|
const key = `${id}\0${repository}\0${tag}`;
|
|
26734
26348
|
if (seen.has(key))
|
|
@@ -26767,7 +26381,7 @@ function parsePodmanPs(json2) {
|
|
|
26767
26381
|
image,
|
|
26768
26382
|
engine: "podman",
|
|
26769
26383
|
state: containerState(info.State),
|
|
26770
|
-
status:
|
|
26384
|
+
status: text4(info.Status, STATUS_MAX),
|
|
26771
26385
|
ports: podmanPorts(info.Ports)
|
|
26772
26386
|
};
|
|
26773
26387
|
const createdAt = isoFromUnix(info.Created) ?? isoString(info.CreatedAt);
|
|
@@ -26835,14 +26449,14 @@ function parsePodmanPods(json2) {
|
|
|
26835
26449
|
const item = {
|
|
26836
26450
|
name: name3,
|
|
26837
26451
|
engine: "podman",
|
|
26838
|
-
status:
|
|
26452
|
+
status: text4(info.Status, POD_STATUS_MAX) || "Unknown",
|
|
26839
26453
|
containers
|
|
26840
26454
|
};
|
|
26841
26455
|
if (containerList) {
|
|
26842
26456
|
let ready = 0;
|
|
26843
26457
|
for (const entry of containerList) {
|
|
26844
26458
|
const container = asRecord4(entry);
|
|
26845
|
-
if (container &&
|
|
26459
|
+
if (container && text4(container.Status, POD_STATUS_MAX).toLowerCase() === "running")
|
|
26846
26460
|
ready += 1;
|
|
26847
26461
|
}
|
|
26848
26462
|
item.ready = ready;
|
|
@@ -26882,7 +26496,7 @@ function parseKubectlPods(stdout) {
|
|
|
26882
26496
|
const item = {
|
|
26883
26497
|
name: name3,
|
|
26884
26498
|
engine: "kubernetes",
|
|
26885
|
-
status:
|
|
26499
|
+
status: text4(parts[2], POD_STATUS_MAX) || "Unknown",
|
|
26886
26500
|
containers
|
|
26887
26501
|
};
|
|
26888
26502
|
if (namespace)
|
|
@@ -26894,7 +26508,7 @@ function parseKubectlPods(stdout) {
|
|
|
26894
26508
|
const node2 = nameOf2(parts[3]);
|
|
26895
26509
|
if (node2 && node2 !== "<none>")
|
|
26896
26510
|
item.node = node2;
|
|
26897
|
-
const created =
|
|
26511
|
+
const created = text4(parts[4], 64);
|
|
26898
26512
|
if (created && created !== "<none>") {
|
|
26899
26513
|
const createdAt = isoString(created);
|
|
26900
26514
|
if (createdAt)
|
|
@@ -26905,74 +26519,1019 @@ function parseKubectlPods(stdout) {
|
|
|
26905
26519
|
return result2;
|
|
26906
26520
|
}
|
|
26907
26521
|
|
|
26908
|
-
// dist/inventory/
|
|
26909
|
-
var
|
|
26910
|
-
var
|
|
26911
|
-
|
|
26912
|
-
|
|
26913
|
-
|
|
26914
|
-
|
|
26915
|
-
|
|
26916
|
-
return
|
|
26522
|
+
// dist/inventory/parsers/sbom.js
|
|
26523
|
+
var NAME_MAX4 = 200;
|
|
26524
|
+
var VERSION_MAX2 = 128;
|
|
26525
|
+
var DISTRO_MAX = 40;
|
|
26526
|
+
var MAX_PACKAGES2 = INVENTORY_LIMITS.imagePackages;
|
|
26527
|
+
var DISTRO_ID = /^[a-z0-9._-]{1,40}$/;
|
|
26528
|
+
var MANAGERS = { deb: "dpkg", apk: "apk", npm: "npm" };
|
|
26529
|
+
function asRecord5(value) {
|
|
26530
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
26917
26531
|
}
|
|
26918
|
-
|
|
26919
|
-
|
|
26920
|
-
|
|
26921
|
-
|
|
26922
|
-
|
|
26923
|
-
|
|
26924
|
-
|
|
26925
|
-
|
|
26926
|
-
|
|
26927
|
-
|
|
26928
|
-
|
|
26929
|
-
|
|
26930
|
-
|
|
26931
|
-
|
|
26932
|
-
|
|
26933
|
-
|
|
26934
|
-
|
|
26935
|
-
|
|
26936
|
-
|
|
26937
|
-
|
|
26938
|
-
|
|
26939
|
-
|
|
26940
|
-
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
|
|
26944
|
-
|
|
26945
|
-
|
|
26946
|
-
|
|
26947
|
-
|
|
26948
|
-
|
|
26949
|
-
|
|
26950
|
-
|
|
26951
|
-
|
|
26952
|
-
|
|
26953
|
-
|
|
26954
|
-
|
|
26955
|
-
|
|
26956
|
-
|
|
26957
|
-
|
|
26958
|
-
|
|
26959
|
-
|
|
26960
|
-
|
|
26961
|
-
|
|
26962
|
-
|
|
26963
|
-
|
|
26964
|
-
|
|
26965
|
-
|
|
26966
|
-
|
|
26967
|
-
|
|
26968
|
-
|
|
26969
|
-
|
|
26970
|
-
|
|
26971
|
-
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
|
|
26975
|
-
|
|
26532
|
+
function parseJson4(stdout) {
|
|
26533
|
+
if (typeof stdout !== "string")
|
|
26534
|
+
return void 0;
|
|
26535
|
+
try {
|
|
26536
|
+
return JSON.parse(stdout);
|
|
26537
|
+
} catch {
|
|
26538
|
+
return void 0;
|
|
26539
|
+
}
|
|
26540
|
+
}
|
|
26541
|
+
function valueOf(value, max) {
|
|
26542
|
+
if (typeof value !== "string")
|
|
26543
|
+
return void 0;
|
|
26544
|
+
const trimmed = value.trim();
|
|
26545
|
+
if (!trimmed || trimmed.length > max)
|
|
26546
|
+
return void 0;
|
|
26547
|
+
return trimmed;
|
|
26548
|
+
}
|
|
26549
|
+
function distroId(value) {
|
|
26550
|
+
const id = valueOf(value, DISTRO_MAX)?.toLowerCase();
|
|
26551
|
+
return id !== void 0 && DISTRO_ID.test(id) ? id : void 0;
|
|
26552
|
+
}
|
|
26553
|
+
function distroVersion(value) {
|
|
26554
|
+
return valueOf(value, DISTRO_MAX);
|
|
26555
|
+
}
|
|
26556
|
+
function isArtifactType(value) {
|
|
26557
|
+
return typeof value === "string" && Object.hasOwn(MANAGERS, value);
|
|
26558
|
+
}
|
|
26559
|
+
function packageOf(type, artifact) {
|
|
26560
|
+
const name3 = valueOf(artifact.name, NAME_MAX4);
|
|
26561
|
+
const version3 = valueOf(artifact.version, VERSION_MAX2);
|
|
26562
|
+
if (!name3 || !version3)
|
|
26563
|
+
return void 0;
|
|
26564
|
+
const item = { name: name3, version: version3, manager: MANAGERS[type] };
|
|
26565
|
+
const metadata = asRecord5(artifact.metadata);
|
|
26566
|
+
if (type === "deb") {
|
|
26567
|
+
const source = valueOf(metadata?.source, NAME_MAX4);
|
|
26568
|
+
if (source && source !== name3) {
|
|
26569
|
+
item.source_name = source;
|
|
26570
|
+
item.source_version = valueOf(metadata?.sourceVersion, VERSION_MAX2) ?? version3;
|
|
26571
|
+
}
|
|
26572
|
+
} else if (type === "apk") {
|
|
26573
|
+
const origin = valueOf(metadata?.originPackage, NAME_MAX4);
|
|
26574
|
+
if (origin && origin !== name3) {
|
|
26575
|
+
item.source_name = origin;
|
|
26576
|
+
item.source_version = version3;
|
|
26577
|
+
}
|
|
26578
|
+
}
|
|
26579
|
+
return item;
|
|
26580
|
+
}
|
|
26581
|
+
function parseSyftJson(stdout) {
|
|
26582
|
+
const root = asRecord5(parseJson4(stdout));
|
|
26583
|
+
const artifacts = root?.artifacts;
|
|
26584
|
+
if (!root || !Array.isArray(artifacts))
|
|
26585
|
+
return { packages: [] };
|
|
26586
|
+
const result2 = { packages: [] };
|
|
26587
|
+
const distro = asRecord5(root.distro);
|
|
26588
|
+
const id = distroId(distro?.id);
|
|
26589
|
+
if (id)
|
|
26590
|
+
result2.distro_id = id;
|
|
26591
|
+
const version3 = distroVersion(distro?.versionID) ?? distroVersion(distro?.version);
|
|
26592
|
+
if (version3)
|
|
26593
|
+
result2.distro_version = version3;
|
|
26594
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26595
|
+
for (const value of artifacts) {
|
|
26596
|
+
const artifact = asRecord5(value);
|
|
26597
|
+
if (!artifact || !isArtifactType(artifact.type))
|
|
26598
|
+
continue;
|
|
26599
|
+
const item = packageOf(artifact.type, artifact);
|
|
26600
|
+
if (!item)
|
|
26601
|
+
continue;
|
|
26602
|
+
const key = `${item.manager}\0${item.name}\0${item.version}\0${item.source_name ?? ""}\0${item.source_version ?? ""}`;
|
|
26603
|
+
if (seen.has(key))
|
|
26604
|
+
continue;
|
|
26605
|
+
seen.add(key);
|
|
26606
|
+
result2.packages.push(item);
|
|
26607
|
+
if (result2.packages.length >= MAX_PACKAGES2)
|
|
26608
|
+
break;
|
|
26609
|
+
}
|
|
26610
|
+
return result2;
|
|
26611
|
+
}
|
|
26612
|
+
|
|
26613
|
+
// dist/inventory/parsers/apt-policy.js
|
|
26614
|
+
var MAX_PACKAGES3 = INVENTORY_LIMITS.packages;
|
|
26615
|
+
var NOT_INSTALLED = "(none)";
|
|
26616
|
+
var LOCAL_STATUS = "/var/lib/dpkg/status";
|
|
26617
|
+
var DISTRO_DOMAINS = ["ubuntu.com", "debian.org", "raspbian.org", "raspberrypi.com", "raspberrypi.org"];
|
|
26618
|
+
var ESM_HOST = "esm.ubuntu.com";
|
|
26619
|
+
var THIRD_PARTY_HOSTS = /* @__PURE__ */ new Set([
|
|
26620
|
+
"ppa.launchpadcontent.net",
|
|
26621
|
+
"ppa.launchpad.net",
|
|
26622
|
+
"deb.nodesource.com",
|
|
26623
|
+
"deb.sury.org",
|
|
26624
|
+
"packages.sury.org",
|
|
26625
|
+
"download.docker.com",
|
|
26626
|
+
"nginx.org",
|
|
26627
|
+
"packages.microsoft.com",
|
|
26628
|
+
"apt.postgresql.org",
|
|
26629
|
+
"repo.mysql.com"
|
|
26630
|
+
]);
|
|
26631
|
+
var MIRROR_PATH_SEGMENTS = /* @__PURE__ */ new Set(["ubuntu", "ubuntu-ports", "debian", "debian-security", "raspbian"]);
|
|
26632
|
+
var DISTRO_COMPONENTS = /* @__PURE__ */ new Set(["main", "restricted", "universe", "multiverse", "contrib", "non-free", "non-free-firmware"]);
|
|
26633
|
+
var ORIGIN_ORDER = ["esm", "distro", "third_party", "local"];
|
|
26634
|
+
function isHostOrSubdomain(host, domain2) {
|
|
26635
|
+
return host === domain2 || host.endsWith(`.${domain2}`);
|
|
26636
|
+
}
|
|
26637
|
+
function stripCredentials(location) {
|
|
26638
|
+
return location.replace(/^(https?:\/\/)[^/?#]*@/i, "$1");
|
|
26639
|
+
}
|
|
26640
|
+
function httpUrl3(location) {
|
|
26641
|
+
if (!/^https?:\/\//i.test(location))
|
|
26642
|
+
return null;
|
|
26643
|
+
try {
|
|
26644
|
+
const url2 = new URL(location);
|
|
26645
|
+
if (url2.protocol !== "http:" && url2.protocol !== "https:")
|
|
26646
|
+
return null;
|
|
26647
|
+
return { host: url2.hostname.toLowerCase(), path: url2.pathname };
|
|
26648
|
+
} catch {
|
|
26649
|
+
return null;
|
|
26650
|
+
}
|
|
26651
|
+
}
|
|
26652
|
+
function firstPathSegment(path) {
|
|
26653
|
+
return path.split("/").find((segment) => segment !== "") ?? "";
|
|
26654
|
+
}
|
|
26655
|
+
function suiteComponent(suite) {
|
|
26656
|
+
if (typeof suite !== "string")
|
|
26657
|
+
return null;
|
|
26658
|
+
const slash = suite.trim().indexOf("/");
|
|
26659
|
+
if (slash < 0)
|
|
26660
|
+
return null;
|
|
26661
|
+
const component = suite.trim().slice(slash + 1);
|
|
26662
|
+
return component === "" ? null : component;
|
|
26663
|
+
}
|
|
26664
|
+
function parseAptPolicy(stdout) {
|
|
26665
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
26666
|
+
if (typeof stdout !== "string")
|
|
26667
|
+
return result2;
|
|
26668
|
+
let name3 = null;
|
|
26669
|
+
let installed = null;
|
|
26670
|
+
let inInstalledVersion = false;
|
|
26671
|
+
let sources = [];
|
|
26672
|
+
let full = false;
|
|
26673
|
+
const finish = () => {
|
|
26674
|
+
if (name3 !== null && installed !== null)
|
|
26675
|
+
result2.set(name3, originOf(sources));
|
|
26676
|
+
name3 = null;
|
|
26677
|
+
installed = null;
|
|
26678
|
+
inInstalledVersion = false;
|
|
26679
|
+
sources = [];
|
|
26680
|
+
if (result2.size >= MAX_PACKAGES3)
|
|
26681
|
+
full = true;
|
|
26682
|
+
};
|
|
26683
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
26684
|
+
if (full)
|
|
26685
|
+
break;
|
|
26686
|
+
if (line.trim() === "")
|
|
26687
|
+
continue;
|
|
26688
|
+
if (/^[NWE]:/.test(line))
|
|
26689
|
+
continue;
|
|
26690
|
+
const first = line.charAt(0);
|
|
26691
|
+
if (first !== " " && first !== " ") {
|
|
26692
|
+
if (!line.endsWith(":") || line.length < 2)
|
|
26693
|
+
continue;
|
|
26694
|
+
finish();
|
|
26695
|
+
if (full)
|
|
26696
|
+
break;
|
|
26697
|
+
name3 = line.slice(0, -1);
|
|
26698
|
+
continue;
|
|
26699
|
+
}
|
|
26700
|
+
const body = line.trimStart();
|
|
26701
|
+
const indent = line.length - body.length;
|
|
26702
|
+
if (indent >= 8) {
|
|
26703
|
+
const source = inInstalledVersion ? sourceOf(body) : null;
|
|
26704
|
+
if (source)
|
|
26705
|
+
sources.push(source);
|
|
26706
|
+
continue;
|
|
26707
|
+
}
|
|
26708
|
+
if (line.startsWith(" *** ")) {
|
|
26709
|
+
inInstalledVersion = true;
|
|
26710
|
+
continue;
|
|
26711
|
+
}
|
|
26712
|
+
if (indent === 2 && body.startsWith("Installed:")) {
|
|
26713
|
+
const value = body.slice("Installed:".length).trim();
|
|
26714
|
+
installed = value === "" || value === NOT_INSTALLED ? null : value;
|
|
26715
|
+
continue;
|
|
26716
|
+
}
|
|
26717
|
+
if (inInstalledVersion && indent >= 4)
|
|
26718
|
+
inInstalledVersion = false;
|
|
26719
|
+
}
|
|
26720
|
+
if (!full)
|
|
26721
|
+
finish();
|
|
26722
|
+
return result2;
|
|
26723
|
+
}
|
|
26724
|
+
function sourceOf(body) {
|
|
26725
|
+
const parts = body.split(/\s+/).filter((part) => part !== "");
|
|
26726
|
+
const priority = parts[0];
|
|
26727
|
+
const location = parts[1];
|
|
26728
|
+
if (priority === void 0 || location === void 0)
|
|
26729
|
+
return null;
|
|
26730
|
+
if (!/^\d+$/.test(priority) || location === "")
|
|
26731
|
+
return null;
|
|
26732
|
+
return { location, suite: parts[2] ?? null };
|
|
26733
|
+
}
|
|
26734
|
+
function originOf(sources) {
|
|
26735
|
+
const firstByOrigin = /* @__PURE__ */ new Map();
|
|
26736
|
+
for (const source of sources) {
|
|
26737
|
+
const origin = classifyAptSource(source.location, source.suite);
|
|
26738
|
+
if (!firstByOrigin.has(origin))
|
|
26739
|
+
firstByOrigin.set(origin, source.location);
|
|
26740
|
+
}
|
|
26741
|
+
for (const origin of ORIGIN_ORDER) {
|
|
26742
|
+
const location = firstByOrigin.get(origin);
|
|
26743
|
+
if (location === void 0)
|
|
26744
|
+
continue;
|
|
26745
|
+
return { origin, repository: origin === "local" ? null : stripCredentials(location) };
|
|
26746
|
+
}
|
|
26747
|
+
return { origin: "unknown", repository: null };
|
|
26748
|
+
}
|
|
26749
|
+
function classifyAptSource(location, suite) {
|
|
26750
|
+
if (typeof location !== "string")
|
|
26751
|
+
return "third_party";
|
|
26752
|
+
if (location.trim() === LOCAL_STATUS)
|
|
26753
|
+
return "local";
|
|
26754
|
+
const url2 = httpUrl3(location.trim());
|
|
26755
|
+
if (!url2)
|
|
26756
|
+
return "third_party";
|
|
26757
|
+
if (url2.host === ESM_HOST)
|
|
26758
|
+
return "esm";
|
|
26759
|
+
if (DISTRO_DOMAINS.some((domain2) => isHostOrSubdomain(url2.host, domain2)))
|
|
26760
|
+
return "distro";
|
|
26761
|
+
if (THIRD_PARTY_HOSTS.has(url2.host))
|
|
26762
|
+
return "third_party";
|
|
26763
|
+
const component = suiteComponent(suite);
|
|
26764
|
+
if (MIRROR_PATH_SEGMENTS.has(firstPathSegment(url2.path)) && component !== null && DISTRO_COMPONENTS.has(component)) {
|
|
26765
|
+
return "distro";
|
|
26766
|
+
}
|
|
26767
|
+
return "third_party";
|
|
26768
|
+
}
|
|
26769
|
+
|
|
26770
|
+
// dist/inventory/parsers/health.js
|
|
26771
|
+
var SOURCE_MAX = 120;
|
|
26772
|
+
var TEMPLATE_MAX = 300;
|
|
26773
|
+
var MAX_COUNT = 1e6;
|
|
26774
|
+
var WINDOW_MS = 24 * 60 * 60 * 1e3;
|
|
26775
|
+
var MAX_DATE_MS = 864e13;
|
|
26776
|
+
var MAX_JOURNAL_LINES = 5e3;
|
|
26777
|
+
var MAX_WEB_LINES = 2e4;
|
|
26778
|
+
var LEVEL_ORDER = { critical: 0, error: 1, warning: 2 };
|
|
26779
|
+
var WEB_LEVELS = {
|
|
26780
|
+
emerg: "critical",
|
|
26781
|
+
alert: "critical",
|
|
26782
|
+
crit: "critical",
|
|
26783
|
+
error: "error",
|
|
26784
|
+
warn: "warning"
|
|
26785
|
+
};
|
|
26786
|
+
var PHP_FPM_LEVELS = {
|
|
26787
|
+
ALERT: "critical",
|
|
26788
|
+
EMERGENCY: "critical",
|
|
26789
|
+
ERROR: "error",
|
|
26790
|
+
WARNING: "warning"
|
|
26791
|
+
};
|
|
26792
|
+
var PHP_LEVELS = {
|
|
26793
|
+
"Fatal error": "critical",
|
|
26794
|
+
"Parse error": "critical",
|
|
26795
|
+
Uncaught: "critical",
|
|
26796
|
+
Warning: "warning"
|
|
26797
|
+
};
|
|
26798
|
+
var WINDOWS_LEVELS = { 1: "critical", 2: "error", 3: "warning" };
|
|
26799
|
+
var MONTHS = {
|
|
26800
|
+
jan: 1,
|
|
26801
|
+
feb: 2,
|
|
26802
|
+
mar: 3,
|
|
26803
|
+
apr: 4,
|
|
26804
|
+
may: 5,
|
|
26805
|
+
jun: 6,
|
|
26806
|
+
jul: 7,
|
|
26807
|
+
aug: 8,
|
|
26808
|
+
sep: 9,
|
|
26809
|
+
oct: 10,
|
|
26810
|
+
nov: 11,
|
|
26811
|
+
dec: 12
|
|
26812
|
+
};
|
|
26813
|
+
var OOM_MESSAGE = /Out of memory: Killed process|oom-kill:|invoked oom-killer/i;
|
|
26814
|
+
var TIMESTAMP_PREFIX = /^(?:\d{4}[-/]\d{2}[-/]\d{2}[T ]\d{2}:\d{2}:\d{2}(?:[.,]\d+)?(?:Z|[+-]\d{2}:?\d{2})?|[A-Z][a-z]{2} {1,2}\d{1,2} \d{2}:\d{2}:\d{2}(?:\.\d+)?)\s+/;
|
|
26815
|
+
var PID_PREFIX = /^(?:pid[:\s]+\d+|\[\s*\d+\s*\]|\d+#\d+:?)\s*/i;
|
|
26816
|
+
function asRecord6(value) {
|
|
26817
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
26818
|
+
}
|
|
26819
|
+
function text5(value) {
|
|
26820
|
+
return typeof value === "string" ? value.trim() : "";
|
|
26821
|
+
}
|
|
26822
|
+
function sourceOf2(value, fallback) {
|
|
26823
|
+
const raw = typeof value === "string" ? value.trim() : "";
|
|
26824
|
+
const cut = raw.length > SOURCE_MAX ? raw.slice(0, SOURCE_MAX) : raw;
|
|
26825
|
+
return cut === "" ? fallback : cut;
|
|
26826
|
+
}
|
|
26827
|
+
function templateOf(message) {
|
|
26828
|
+
return redactLogMessage(message).slice(0, TEMPLATE_MAX);
|
|
26829
|
+
}
|
|
26830
|
+
function validMs(value) {
|
|
26831
|
+
if (value === void 0 || !Number.isFinite(value) || Math.abs(value) > MAX_DATE_MS)
|
|
26832
|
+
return void 0;
|
|
26833
|
+
return value;
|
|
26834
|
+
}
|
|
26835
|
+
function iso(ms) {
|
|
26836
|
+
return new Date(ms).toISOString();
|
|
26837
|
+
}
|
|
26838
|
+
function inWindow(atMs, now) {
|
|
26839
|
+
const nowMs = now instanceof Date ? now.getTime() : Number.NaN;
|
|
26840
|
+
if (!Number.isFinite(nowMs))
|
|
26841
|
+
return true;
|
|
26842
|
+
return atMs >= nowMs - WINDOW_MS;
|
|
26843
|
+
}
|
|
26844
|
+
function stripLogPrefix(message) {
|
|
26845
|
+
let result2 = message.trim();
|
|
26846
|
+
for (let pass = 0; pass < 2; pass += 1) {
|
|
26847
|
+
const next = result2.replace(TIMESTAMP_PREFIX, "").replace(PID_PREFIX, "").trim();
|
|
26848
|
+
if (next === result2)
|
|
26849
|
+
return result2;
|
|
26850
|
+
result2 = next;
|
|
26851
|
+
}
|
|
26852
|
+
return result2;
|
|
26853
|
+
}
|
|
26854
|
+
function keyOf(fields, extra = "") {
|
|
26855
|
+
return `${fields.kind}\0${fields.source}\0${fields.template}\0${extra}`;
|
|
26856
|
+
}
|
|
26857
|
+
function noteTime(bucket, atMs) {
|
|
26858
|
+
if (atMs === void 0)
|
|
26859
|
+
return;
|
|
26860
|
+
if (bucket.firstMs === void 0 || atMs < bucket.firstMs)
|
|
26861
|
+
bucket.firstMs = atMs;
|
|
26862
|
+
if (bucket.lastMs === void 0 || atMs > bucket.lastMs)
|
|
26863
|
+
bucket.lastMs = atMs;
|
|
26864
|
+
}
|
|
26865
|
+
function addTo(map2, key, fields, atMs, amount = 1) {
|
|
26866
|
+
const existing = map2.get(key);
|
|
26867
|
+
if (existing) {
|
|
26868
|
+
existing.count = Math.min(existing.count + amount, MAX_COUNT);
|
|
26869
|
+
if (LEVEL_ORDER[fields.level] < LEVEL_ORDER[existing.level])
|
|
26870
|
+
existing.level = fields.level;
|
|
26871
|
+
noteTime(existing, atMs);
|
|
26872
|
+
return;
|
|
26873
|
+
}
|
|
26874
|
+
const bucket = {
|
|
26875
|
+
source: fields.source,
|
|
26876
|
+
kind: fields.kind,
|
|
26877
|
+
level: fields.level,
|
|
26878
|
+
template: fields.template,
|
|
26879
|
+
count: Math.min(amount, MAX_COUNT),
|
|
26880
|
+
firstMs: void 0,
|
|
26881
|
+
lastMs: void 0
|
|
26882
|
+
};
|
|
26883
|
+
noteTime(bucket, atMs);
|
|
26884
|
+
map2.set(key, bucket);
|
|
26885
|
+
}
|
|
26886
|
+
function compareEvents(a, b) {
|
|
26887
|
+
const level = LEVEL_ORDER[a.level] - LEVEL_ORDER[b.level];
|
|
26888
|
+
if (level !== 0)
|
|
26889
|
+
return level;
|
|
26890
|
+
if (a.count !== b.count)
|
|
26891
|
+
return b.count - a.count;
|
|
26892
|
+
if (a.source !== b.source)
|
|
26893
|
+
return a.source < b.source ? -1 : 1;
|
|
26894
|
+
if (a.template !== b.template)
|
|
26895
|
+
return a.template < b.template ? -1 : 1;
|
|
26896
|
+
return 0;
|
|
26897
|
+
}
|
|
26898
|
+
function sortEvents(events) {
|
|
26899
|
+
return [...events].sort(compareEvents);
|
|
26900
|
+
}
|
|
26901
|
+
function toEvents(map2) {
|
|
26902
|
+
const events = [];
|
|
26903
|
+
for (const bucket of map2.values()) {
|
|
26904
|
+
const event = {
|
|
26905
|
+
source: bucket.source,
|
|
26906
|
+
kind: bucket.kind,
|
|
26907
|
+
level: bucket.level,
|
|
26908
|
+
template: bucket.template,
|
|
26909
|
+
count: bucket.count
|
|
26910
|
+
};
|
|
26911
|
+
if (bucket.firstMs !== void 0)
|
|
26912
|
+
event.first_seen = iso(bucket.firstMs);
|
|
26913
|
+
if (bucket.lastMs !== void 0)
|
|
26914
|
+
event.last_seen = iso(bucket.lastMs);
|
|
26915
|
+
const parsed = inventoryHealthEventSchema.safeParse(event);
|
|
26916
|
+
if (parsed.success)
|
|
26917
|
+
events.push(parsed.data);
|
|
26918
|
+
}
|
|
26919
|
+
return sortEvents(events);
|
|
26920
|
+
}
|
|
26921
|
+
function journalPriority(value) {
|
|
26922
|
+
const raw = typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
26923
|
+
if (!/^[0-7]$/.test(raw))
|
|
26924
|
+
return void 0;
|
|
26925
|
+
const priority = Number(raw);
|
|
26926
|
+
if (priority <= 2)
|
|
26927
|
+
return "critical";
|
|
26928
|
+
if (priority === 3)
|
|
26929
|
+
return "error";
|
|
26930
|
+
return void 0;
|
|
26931
|
+
}
|
|
26932
|
+
function journalMessage(value) {
|
|
26933
|
+
if (typeof value === "string")
|
|
26934
|
+
return value;
|
|
26935
|
+
if (!Array.isArray(value))
|
|
26936
|
+
return void 0;
|
|
26937
|
+
const bytes3 = new Uint8Array(value.length);
|
|
26938
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
26939
|
+
const byte = value[index];
|
|
26940
|
+
if (typeof byte !== "number" || !Number.isInteger(byte) || byte < 0 || byte > 255)
|
|
26941
|
+
return void 0;
|
|
26942
|
+
bytes3[index] = byte;
|
|
26943
|
+
}
|
|
26944
|
+
try {
|
|
26945
|
+
return new TextDecoder().decode(bytes3);
|
|
26946
|
+
} catch {
|
|
26947
|
+
return void 0;
|
|
26948
|
+
}
|
|
26949
|
+
}
|
|
26950
|
+
function journalTime(value) {
|
|
26951
|
+
const raw = typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
26952
|
+
if (!/^\d+$/.test(raw))
|
|
26953
|
+
return void 0;
|
|
26954
|
+
const micros = Number(raw);
|
|
26955
|
+
if (!Number.isFinite(micros))
|
|
26956
|
+
return void 0;
|
|
26957
|
+
return validMs(Math.trunc(micros / 1e3));
|
|
26958
|
+
}
|
|
26959
|
+
function journalSource(entry) {
|
|
26960
|
+
for (const field of ["_SYSTEMD_UNIT", "SYSLOG_IDENTIFIER", "_COMM"]) {
|
|
26961
|
+
const value = sourceOf2(entry[field], "");
|
|
26962
|
+
if (value !== "")
|
|
26963
|
+
return value;
|
|
26964
|
+
}
|
|
26965
|
+
return "journal";
|
|
26966
|
+
}
|
|
26967
|
+
function parseJournalJson(stdout, now) {
|
|
26968
|
+
try {
|
|
26969
|
+
if (typeof stdout !== "string")
|
|
26970
|
+
return [];
|
|
26971
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
26972
|
+
const all = stdout.split(/\r?\n/);
|
|
26973
|
+
const limit = Math.min(all.length, MAX_JOURNAL_LINES);
|
|
26974
|
+
for (let index = 0; index < limit; index += 1) {
|
|
26975
|
+
const line = all[index];
|
|
26976
|
+
if (line === void 0 || line.trim() === "")
|
|
26977
|
+
continue;
|
|
26978
|
+
let parsed;
|
|
26979
|
+
try {
|
|
26980
|
+
parsed = JSON.parse(line);
|
|
26981
|
+
} catch {
|
|
26982
|
+
continue;
|
|
26983
|
+
}
|
|
26984
|
+
const entry = asRecord6(parsed);
|
|
26985
|
+
if (!entry)
|
|
26986
|
+
continue;
|
|
26987
|
+
const level = journalPriority(entry.PRIORITY);
|
|
26988
|
+
if (level === void 0)
|
|
26989
|
+
continue;
|
|
26990
|
+
const message = journalMessage(entry.MESSAGE);
|
|
26991
|
+
if (message === void 0)
|
|
26992
|
+
continue;
|
|
26993
|
+
const template = templateOf(stripLogPrefix(message));
|
|
26994
|
+
if (template === "")
|
|
26995
|
+
continue;
|
|
26996
|
+
const atMs = journalTime(entry.__REALTIME_TIMESTAMP);
|
|
26997
|
+
if (atMs !== void 0 && !inWindow(atMs, now))
|
|
26998
|
+
continue;
|
|
26999
|
+
const fields = OOM_MESSAGE.test(message) ? { source: "kernel", kind: "oom", level: "critical", template } : { source: journalSource(entry), kind: "log_error", level, template };
|
|
27000
|
+
addTo(map2, keyOf(fields), fields, atMs);
|
|
27001
|
+
}
|
|
27002
|
+
return toEvents(map2);
|
|
27003
|
+
} catch {
|
|
27004
|
+
return [];
|
|
27005
|
+
}
|
|
27006
|
+
}
|
|
27007
|
+
function utcMs(year, month, day, hour, minute, second, millis = 0) {
|
|
27008
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day))
|
|
27009
|
+
return void 0;
|
|
27010
|
+
if (month < 1 || month > 12 || day < 1 || day > 31)
|
|
27011
|
+
return void 0;
|
|
27012
|
+
if (hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59)
|
|
27013
|
+
return void 0;
|
|
27014
|
+
if (millis < 0 || millis > 999)
|
|
27015
|
+
return void 0;
|
|
27016
|
+
return validMs(Date.UTC(year, month - 1, day, hour, minute, second, millis));
|
|
27017
|
+
}
|
|
27018
|
+
function fractionMs(fraction) {
|
|
27019
|
+
if (fraction === void 0 || fraction === "")
|
|
27020
|
+
return 0;
|
|
27021
|
+
return Number(fraction.slice(0, 3).padEnd(3, "0"));
|
|
27022
|
+
}
|
|
27023
|
+
function nginxRecord(line) {
|
|
27024
|
+
const match = /^(\d{4})\/(\d{2})\/(\d{2}) (\d{2}):(\d{2}):(\d{2}) \[([A-Za-z]+)\] \d+#\d+: (?:\*\d+ )?(.*)$/.exec(line);
|
|
27025
|
+
if (!match)
|
|
27026
|
+
return void 0;
|
|
27027
|
+
const [, year, month, day, hour, minute, second, token, message] = match;
|
|
27028
|
+
if (year === void 0 || month === void 0 || day === void 0)
|
|
27029
|
+
return void 0;
|
|
27030
|
+
if (hour === void 0 || minute === void 0 || second === void 0)
|
|
27031
|
+
return void 0;
|
|
27032
|
+
const level = WEB_LEVELS[(token ?? "").toLowerCase()];
|
|
27033
|
+
if (level === void 0)
|
|
27034
|
+
return void 0;
|
|
27035
|
+
return {
|
|
27036
|
+
level,
|
|
27037
|
+
message: message ?? "",
|
|
27038
|
+
atMs: utcMs(Number(year), Number(month), Number(day), Number(hour), Number(minute), Number(second))
|
|
27039
|
+
};
|
|
27040
|
+
}
|
|
27041
|
+
function apacheRecord(line) {
|
|
27042
|
+
const match = /^\[(?:[A-Z][a-z]{2} )?([A-Z][a-z]{2}) +(\d{1,2}) (\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,9}))? (\d{4})\] \[[A-Za-z0-9_.-]+:([A-Za-z]+)\] (?:\[pid [^\]]*\] )?(?:\[client [^\]]*\] )?(.*)$/.exec(line);
|
|
27043
|
+
if (!match)
|
|
27044
|
+
return void 0;
|
|
27045
|
+
const [, monthName, day, hour, minute, second, fraction, year, token, message] = match;
|
|
27046
|
+
if (monthName === void 0 || day === void 0 || hour === void 0)
|
|
27047
|
+
return void 0;
|
|
27048
|
+
if (minute === void 0 || second === void 0 || year === void 0)
|
|
27049
|
+
return void 0;
|
|
27050
|
+
const month = MONTHS[monthName.toLowerCase()];
|
|
27051
|
+
if (month === void 0)
|
|
27052
|
+
return void 0;
|
|
27053
|
+
const level = WEB_LEVELS[(token ?? "").toLowerCase()];
|
|
27054
|
+
if (level === void 0)
|
|
27055
|
+
return void 0;
|
|
27056
|
+
return {
|
|
27057
|
+
level,
|
|
27058
|
+
message: message ?? "",
|
|
27059
|
+
atMs: utcMs(Number(year), month, Number(day), Number(hour), Number(minute), Number(second), fractionMs(fraction))
|
|
27060
|
+
};
|
|
27061
|
+
}
|
|
27062
|
+
function fpmRecord(line) {
|
|
27063
|
+
const match = /^\[(\d{2})-([A-Z][a-z]{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})\] ([A-Z]+):\s*(.*)$/.exec(line);
|
|
27064
|
+
if (!match)
|
|
27065
|
+
return void 0;
|
|
27066
|
+
const [, day, monthName, year, hour, minute, second, token, message] = match;
|
|
27067
|
+
if (day === void 0 || monthName === void 0 || year === void 0)
|
|
27068
|
+
return void 0;
|
|
27069
|
+
if (hour === void 0 || minute === void 0 || second === void 0)
|
|
27070
|
+
return void 0;
|
|
27071
|
+
const month = MONTHS[monthName.toLowerCase()];
|
|
27072
|
+
if (month === void 0)
|
|
27073
|
+
return void 0;
|
|
27074
|
+
const level = PHP_FPM_LEVELS[token ?? ""];
|
|
27075
|
+
if (level === void 0)
|
|
27076
|
+
return void 0;
|
|
27077
|
+
return {
|
|
27078
|
+
level,
|
|
27079
|
+
message: message ?? "",
|
|
27080
|
+
atMs: utcMs(Number(year), month, Number(day), Number(hour), Number(minute), Number(second))
|
|
27081
|
+
};
|
|
27082
|
+
}
|
|
27083
|
+
function phpLogRecord(line) {
|
|
27084
|
+
const match = /^\[(\d{2})-([A-Z][a-z]{2})-(\d{4}) (\d{2}):(\d{2}):(\d{2})(?: [A-Za-z][A-Za-z_+\/-]{0,31})?\] (PHP )?(Fatal error|Parse error|Uncaught|Warning|Deprecated|Notice|Strict Standards):\s*(.*)$/.exec(line);
|
|
27085
|
+
if (!match)
|
|
27086
|
+
return void 0;
|
|
27087
|
+
const [, day, monthName, year, hour, minute, second, phpWord, label, message] = match;
|
|
27088
|
+
if (day === void 0 || monthName === void 0 || year === void 0)
|
|
27089
|
+
return void 0;
|
|
27090
|
+
if (hour === void 0 || minute === void 0 || second === void 0)
|
|
27091
|
+
return void 0;
|
|
27092
|
+
const month = MONTHS[monthName.toLowerCase()];
|
|
27093
|
+
if (month === void 0)
|
|
27094
|
+
return void 0;
|
|
27095
|
+
const level = PHP_LEVELS[label ?? ""];
|
|
27096
|
+
if (level === void 0)
|
|
27097
|
+
return void 0;
|
|
27098
|
+
const body = `${phpWord ?? ""}${label ?? ""}: ${message ?? ""}`.trim();
|
|
27099
|
+
return {
|
|
27100
|
+
level,
|
|
27101
|
+
message: body,
|
|
27102
|
+
atMs: utcMs(Number(year), month, Number(day), Number(hour), Number(minute), Number(second))
|
|
27103
|
+
};
|
|
27104
|
+
}
|
|
27105
|
+
function webRecord(line) {
|
|
27106
|
+
return nginxRecord(line) ?? apacheRecord(line) ?? fpmRecord(line) ?? phpLogRecord(line);
|
|
27107
|
+
}
|
|
27108
|
+
function parseWebErrorLog(text6, source, now) {
|
|
27109
|
+
try {
|
|
27110
|
+
if (typeof text6 !== "string")
|
|
27111
|
+
return [];
|
|
27112
|
+
const label = sourceOf2(source, "web");
|
|
27113
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
27114
|
+
const all = text6.split(/\r?\n/);
|
|
27115
|
+
const start = Math.max(0, all.length - MAX_WEB_LINES);
|
|
27116
|
+
for (let index = start; index < all.length; index += 1) {
|
|
27117
|
+
const line = all[index];
|
|
27118
|
+
if (line === void 0 || line.trim() === "")
|
|
27119
|
+
continue;
|
|
27120
|
+
const record2 = webRecord(line);
|
|
27121
|
+
if (record2 === void 0)
|
|
27122
|
+
continue;
|
|
27123
|
+
if (record2.atMs !== void 0 && !inWindow(record2.atMs, now))
|
|
27124
|
+
continue;
|
|
27125
|
+
const template = templateOf(record2.message);
|
|
27126
|
+
if (template === "")
|
|
27127
|
+
continue;
|
|
27128
|
+
const fields = { source: label, kind: "web_error", level: record2.level, template };
|
|
27129
|
+
addTo(map2, keyOf(fields), fields, record2.atMs);
|
|
27130
|
+
}
|
|
27131
|
+
return toEvents(map2);
|
|
27132
|
+
} catch {
|
|
27133
|
+
return [];
|
|
27134
|
+
}
|
|
27135
|
+
}
|
|
27136
|
+
function parseLaunchctlList(stdout) {
|
|
27137
|
+
try {
|
|
27138
|
+
if (typeof stdout !== "string")
|
|
27139
|
+
return [];
|
|
27140
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
27141
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
27142
|
+
if (line.trim() === "")
|
|
27143
|
+
continue;
|
|
27144
|
+
if (/^PID\s+Status\s+Label\s*$/.test(line) || /^PID\t/.test(line))
|
|
27145
|
+
continue;
|
|
27146
|
+
const parts = line.split(" ");
|
|
27147
|
+
if (parts.length < 3)
|
|
27148
|
+
continue;
|
|
27149
|
+
const pid = (parts[0] ?? "").trim();
|
|
27150
|
+
const statusText = (parts[1] ?? "").trim();
|
|
27151
|
+
const label = sourceOf2(parts[2], "");
|
|
27152
|
+
if (pid !== "-" || label === "" || label.startsWith("com.apple."))
|
|
27153
|
+
continue;
|
|
27154
|
+
if (!/^-?\d+$/.test(statusText))
|
|
27155
|
+
continue;
|
|
27156
|
+
const status = Number(statusText);
|
|
27157
|
+
if (!Number.isSafeInteger(status) || status === 0)
|
|
27158
|
+
continue;
|
|
27159
|
+
const fields = {
|
|
27160
|
+
source: label,
|
|
27161
|
+
kind: "job_failed",
|
|
27162
|
+
level: "error",
|
|
27163
|
+
template: `exited with status ${status}`
|
|
27164
|
+
};
|
|
27165
|
+
addTo(map2, keyOf(fields), fields);
|
|
27166
|
+
}
|
|
27167
|
+
return toEvents(map2);
|
|
27168
|
+
} catch {
|
|
27169
|
+
return [];
|
|
27170
|
+
}
|
|
27171
|
+
}
|
|
27172
|
+
function crashProcessName(name3) {
|
|
27173
|
+
const base2 = name3.replace(/\.(?:ips|crash|diag)$/i, "").trim();
|
|
27174
|
+
if (base2 === "")
|
|
27175
|
+
return "";
|
|
27176
|
+
const marker = /[-_]\d{4}(?=\D|$)/.exec(base2);
|
|
27177
|
+
if (marker && marker.index > 0)
|
|
27178
|
+
return base2.slice(0, marker.index).trim();
|
|
27179
|
+
return base2;
|
|
27180
|
+
}
|
|
27181
|
+
function crashReportEvents(files, now) {
|
|
27182
|
+
try {
|
|
27183
|
+
if (!Array.isArray(files))
|
|
27184
|
+
return [];
|
|
27185
|
+
const nowMs = now instanceof Date ? now.getTime() : Number.NaN;
|
|
27186
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
27187
|
+
for (const file2 of files) {
|
|
27188
|
+
const entry = asRecord6(file2);
|
|
27189
|
+
if (!entry)
|
|
27190
|
+
continue;
|
|
27191
|
+
const name3 = text5(entry.name);
|
|
27192
|
+
const mtimeMs = typeof entry.mtimeMs === "number" ? validMs(entry.mtimeMs) : void 0;
|
|
27193
|
+
if (name3 === "" || mtimeMs === void 0)
|
|
27194
|
+
continue;
|
|
27195
|
+
if (!/\.(?:ips|crash|diag)$/i.test(name3))
|
|
27196
|
+
continue;
|
|
27197
|
+
if (Number.isFinite(nowMs) && mtimeMs < nowMs - WINDOW_MS)
|
|
27198
|
+
continue;
|
|
27199
|
+
const process2 = crashProcessName(name3);
|
|
27200
|
+
if (process2 === "")
|
|
27201
|
+
continue;
|
|
27202
|
+
const fields = {
|
|
27203
|
+
source: process2.slice(0, SOURCE_MAX),
|
|
27204
|
+
kind: "crash",
|
|
27205
|
+
level: "error",
|
|
27206
|
+
template: "crashed"
|
|
27207
|
+
};
|
|
27208
|
+
addTo(map2, keyOf(fields), fields, mtimeMs);
|
|
27209
|
+
}
|
|
27210
|
+
return toEvents(map2);
|
|
27211
|
+
} catch {
|
|
27212
|
+
return [];
|
|
27213
|
+
}
|
|
27214
|
+
}
|
|
27215
|
+
function windowsTime(value) {
|
|
27216
|
+
if (typeof value !== "string")
|
|
27217
|
+
return void 0;
|
|
27218
|
+
const raw = value.trim();
|
|
27219
|
+
const legacy = /^\/Date\((-?\d+)(?:[+-]\d{2}:?\d{2})?\)\/$/.exec(raw);
|
|
27220
|
+
if (legacy)
|
|
27221
|
+
return validMs(Number(legacy[1] ?? ""));
|
|
27222
|
+
return validMs(Date.parse(raw.replace(/(\.\d{3})\d+/, "$1")));
|
|
27223
|
+
}
|
|
27224
|
+
function windowsTemplate(message, id) {
|
|
27225
|
+
const first = (message.split(/\r?\n/, 1)[0] ?? "").trim();
|
|
27226
|
+
const template = templateOf(first);
|
|
27227
|
+
return template === "" ? `Event ${id}` : template;
|
|
27228
|
+
}
|
|
27229
|
+
function parseWindowsEvents(stdout) {
|
|
27230
|
+
try {
|
|
27231
|
+
if (typeof stdout !== "string")
|
|
27232
|
+
return [];
|
|
27233
|
+
let parsed;
|
|
27234
|
+
try {
|
|
27235
|
+
parsed = JSON.parse(stdout);
|
|
27236
|
+
} catch {
|
|
27237
|
+
return [];
|
|
27238
|
+
}
|
|
27239
|
+
const items = Array.isArray(parsed) ? parsed : [parsed];
|
|
27240
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
27241
|
+
for (const item of items) {
|
|
27242
|
+
const entry = asRecord6(item);
|
|
27243
|
+
if (!entry)
|
|
27244
|
+
continue;
|
|
27245
|
+
const source = sourceOf2(entry.ProviderName, "");
|
|
27246
|
+
if (source === "")
|
|
27247
|
+
continue;
|
|
27248
|
+
const id = typeof entry.Id === "number" && Number.isInteger(entry.Id) ? entry.Id : void 0;
|
|
27249
|
+
if (id === void 0)
|
|
27250
|
+
continue;
|
|
27251
|
+
const level = typeof entry.Level === "number" ? WINDOWS_LEVELS[entry.Level] : void 0;
|
|
27252
|
+
if (level === void 0)
|
|
27253
|
+
continue;
|
|
27254
|
+
const message = typeof entry.Message === "string" ? entry.Message : "";
|
|
27255
|
+
const fields = {
|
|
27256
|
+
source,
|
|
27257
|
+
kind: "event_error",
|
|
27258
|
+
level,
|
|
27259
|
+
template: windowsTemplate(message, id)
|
|
27260
|
+
};
|
|
27261
|
+
addTo(map2, keyOf(fields, String(id)), fields, windowsTime(entry.TimeCreated));
|
|
27262
|
+
}
|
|
27263
|
+
return toEvents(map2);
|
|
27264
|
+
} catch {
|
|
27265
|
+
return [];
|
|
27266
|
+
}
|
|
27267
|
+
}
|
|
27268
|
+
function rebootRequiredEvents(flag, packages) {
|
|
27269
|
+
try {
|
|
27270
|
+
if (flag !== true)
|
|
27271
|
+
return [];
|
|
27272
|
+
const names = /* @__PURE__ */ new Set();
|
|
27273
|
+
if (typeof packages === "string") {
|
|
27274
|
+
for (const line of packages.split(/\r?\n/)) {
|
|
27275
|
+
const name3 = line.trim();
|
|
27276
|
+
if (name3 !== "")
|
|
27277
|
+
names.add(name3);
|
|
27278
|
+
}
|
|
27279
|
+
}
|
|
27280
|
+
const template = names.size > 0 ? `Restart required by ${names.size} packages` : "Restart required";
|
|
27281
|
+
const fields = { source: "system", kind: "reboot_required", level: "warning", template };
|
|
27282
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
27283
|
+
addTo(map2, keyOf(fields), fields);
|
|
27284
|
+
return toEvents(map2);
|
|
27285
|
+
} catch {
|
|
27286
|
+
return [];
|
|
27287
|
+
}
|
|
27288
|
+
}
|
|
27289
|
+
function capHealthEvents(events) {
|
|
27290
|
+
try {
|
|
27291
|
+
if (!Array.isArray(events))
|
|
27292
|
+
return [];
|
|
27293
|
+
const valid2 = events.filter((event) => inventoryHealthEventSchema.safeParse(event).success);
|
|
27294
|
+
return sortEvents(valid2).slice(0, INVENTORY_LIMITS.health);
|
|
27295
|
+
} catch {
|
|
27296
|
+
return [];
|
|
27297
|
+
}
|
|
27298
|
+
}
|
|
27299
|
+
|
|
27300
|
+
// dist/inventory/tls.js
|
|
27301
|
+
var import_node_https = require("node:https");
|
|
27302
|
+
var import_node_tls = require("node:tls");
|
|
27303
|
+
var TLS_PORTS = Object.freeze([443, 8443, 9443, 465, 993, 995, 636]);
|
|
27304
|
+
var WEB_PORTS = /* @__PURE__ */ new Set([443, 8443, 9443]);
|
|
27305
|
+
var TIMEOUT_MS = 3e3;
|
|
27306
|
+
var NAME_MAX5 = 100;
|
|
27307
|
+
var clean = (value) => value.replace(/[\u0000-\u001f\u007f]+/g, " ").trim().slice(0, NAME_MAX5);
|
|
27308
|
+
function nameOf3(entry) {
|
|
27309
|
+
const value = Array.isArray(entry) ? entry[0] : entry;
|
|
27310
|
+
return typeof value === "string" && clean(value) ? clean(value) : void 0;
|
|
27311
|
+
}
|
|
27312
|
+
function isoOf(text6) {
|
|
27313
|
+
if (typeof text6 !== "string")
|
|
27314
|
+
return void 0;
|
|
27315
|
+
const ms = Date.parse(text6);
|
|
27316
|
+
return Number.isNaN(ms) ? void 0 : new Date(ms).toISOString();
|
|
27317
|
+
}
|
|
27318
|
+
var canonical = (entry) => entry && typeof entry === "object" ? JSON.stringify(Object.entries(entry).sort(([a], [b]) => a < b ? -1 : 1)) : "";
|
|
27319
|
+
function endpointOf(port, protocol, cert, hsts) {
|
|
27320
|
+
if (!protocol || !/^TLSv1(\.[0-3])?$/.test(protocol))
|
|
27321
|
+
return null;
|
|
27322
|
+
const subject = nameOf3(cert?.subject?.CN);
|
|
27323
|
+
const issuer = nameOf3(cert?.issuer?.CN);
|
|
27324
|
+
const notBefore = isoOf(cert?.valid_from);
|
|
27325
|
+
const notAfter = isoOf(cert?.valid_to);
|
|
27326
|
+
const selfSigned = Boolean(cert?.subject && cert?.issuer && canonical(cert.subject) === canonical(cert.issuer));
|
|
27327
|
+
return {
|
|
27328
|
+
port,
|
|
27329
|
+
protocol,
|
|
27330
|
+
...subject ? { subject } : {},
|
|
27331
|
+
...issuer ? { issuer } : {},
|
|
27332
|
+
...notBefore ? { not_before: notBefore } : {},
|
|
27333
|
+
...notAfter ? { not_after: notAfter } : {},
|
|
27334
|
+
self_signed: selfSigned,
|
|
27335
|
+
...hsts === void 0 ? {} : { hsts }
|
|
27336
|
+
};
|
|
27337
|
+
}
|
|
27338
|
+
function hstsOf(port) {
|
|
27339
|
+
return new Promise((resolve8) => {
|
|
27340
|
+
let settled = false;
|
|
27341
|
+
const finish = (value) => {
|
|
27342
|
+
if (!settled) {
|
|
27343
|
+
settled = true;
|
|
27344
|
+
resolve8(value);
|
|
27345
|
+
}
|
|
27346
|
+
};
|
|
27347
|
+
const req = (0, import_node_https.request)({ host: "127.0.0.1", port, method: "HEAD", path: "/", rejectUnauthorized: false, timeout: TIMEOUT_MS, headers: { host: "localhost", "user-agent": "conbridge-agent/tls-check" } }, (res) => {
|
|
27348
|
+
finish(typeof res.headers["strict-transport-security"] === "string");
|
|
27349
|
+
res.resume();
|
|
27350
|
+
req.destroy();
|
|
27351
|
+
});
|
|
27352
|
+
req.once("timeout", () => {
|
|
27353
|
+
finish(void 0);
|
|
27354
|
+
req.destroy();
|
|
27355
|
+
});
|
|
27356
|
+
req.once("error", () => finish(void 0));
|
|
27357
|
+
req.end();
|
|
27358
|
+
});
|
|
27359
|
+
}
|
|
27360
|
+
function createTlsProbe(webPorts = WEB_PORTS) {
|
|
27361
|
+
return (port) => new Promise((resolve8) => {
|
|
27362
|
+
let settled = false;
|
|
27363
|
+
const socket = (0, import_node_tls.connect)({
|
|
27364
|
+
host: "127.0.0.1",
|
|
27365
|
+
port,
|
|
27366
|
+
rejectUnauthorized: false,
|
|
27367
|
+
timeout: TIMEOUT_MS,
|
|
27368
|
+
// An old-only server must still show its protocol (and be flagged), so the probe offers every version.
|
|
27369
|
+
minVersion: "TLSv1",
|
|
27370
|
+
ciphers: "DEFAULT:@SECLEVEL=0"
|
|
27371
|
+
});
|
|
27372
|
+
const finish = (value) => {
|
|
27373
|
+
if (!settled) {
|
|
27374
|
+
settled = true;
|
|
27375
|
+
socket.destroy();
|
|
27376
|
+
resolve8(value);
|
|
27377
|
+
}
|
|
27378
|
+
};
|
|
27379
|
+
socket.once("secureConnect", () => {
|
|
27380
|
+
const protocol = socket.getProtocol();
|
|
27381
|
+
const cert = socket.getPeerCertificate(false);
|
|
27382
|
+
if (!webPorts.has(port)) {
|
|
27383
|
+
finish(endpointOf(port, protocol, cert));
|
|
27384
|
+
return;
|
|
27385
|
+
}
|
|
27386
|
+
void hstsOf(port).then((hsts) => finish(endpointOf(port, protocol, cert, hsts)));
|
|
27387
|
+
});
|
|
27388
|
+
socket.once("timeout", () => finish(null));
|
|
27389
|
+
socket.once("error", () => finish(null));
|
|
27390
|
+
});
|
|
27391
|
+
}
|
|
27392
|
+
async function collectTlsEndpoints(probe, ports = TLS_PORTS, width = 4) {
|
|
27393
|
+
const found = new Array(ports.length).fill(null);
|
|
27394
|
+
let next = 0;
|
|
27395
|
+
await Promise.all(Array.from({ length: Math.min(width, ports.length) }, async () => {
|
|
27396
|
+
while (next < ports.length) {
|
|
27397
|
+
const index = next++;
|
|
27398
|
+
try {
|
|
27399
|
+
found[index] = await probe(ports[index]);
|
|
27400
|
+
} catch {
|
|
27401
|
+
found[index] = null;
|
|
27402
|
+
}
|
|
27403
|
+
}
|
|
27404
|
+
}));
|
|
27405
|
+
return found.filter((entry) => entry !== null);
|
|
27406
|
+
}
|
|
27407
|
+
|
|
27408
|
+
// dist/inventory/collector.js
|
|
27409
|
+
var POSIX_PATH = ["/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/opt/homebrew/bin", "/opt/homebrew/sbin", "/snap/bin"];
|
|
27410
|
+
var DENIED = /permission denied|EACCES|access is denied|got permission denied while trying to connect/i;
|
|
27411
|
+
function collectorEnv(env = process.env, platform2 = process.platform) {
|
|
27412
|
+
const base2 = { ...env, NO_COLOR: "1", PAGER: "cat", SYSTEMD_PAGER: "", TERM: "dumb", COMPOSER_ALLOW_SUPERUSER: "1", HOMEBREW_NO_AUTO_UPDATE: "1", SYFT_CHECK_FOR_APP_UPDATE: "false" };
|
|
27413
|
+
if (platform2 === "win32")
|
|
27414
|
+
return base2;
|
|
27415
|
+
const path = [.../* @__PURE__ */ new Set([...(env.PATH ?? "").split(":").filter(Boolean), ...POSIX_PATH])].join(":");
|
|
27416
|
+
return platform2 === "linux" ? { ...base2, PATH: path, LC_ALL: "C.UTF-8", LANGUAGE: "" } : { ...base2, PATH: path };
|
|
27417
|
+
}
|
|
27418
|
+
var defaultRunner = (file2, args, { timeoutMs, maxBytes }) => new Promise((resolve8) => {
|
|
27419
|
+
(0, import_node_child_process7.execFile)(file2, [...args], {
|
|
27420
|
+
timeout: timeoutMs,
|
|
27421
|
+
maxBuffer: maxBytes,
|
|
27422
|
+
killSignal: "SIGKILL",
|
|
27423
|
+
windowsHide: true,
|
|
27424
|
+
encoding: "utf8",
|
|
27425
|
+
env: collectorEnv()
|
|
27426
|
+
}, (error63, stdout, stderr) => {
|
|
27427
|
+
const code = error63?.code;
|
|
27428
|
+
const killed = error63?.killed === true;
|
|
27429
|
+
const out = String(stdout ?? ""), err = String(stderr ?? "");
|
|
27430
|
+
resolve8({
|
|
27431
|
+
stdout: out,
|
|
27432
|
+
stderr: err,
|
|
27433
|
+
ok: !error63,
|
|
27434
|
+
missing: code === "ENOENT",
|
|
27435
|
+
timedOut: killed && !code,
|
|
27436
|
+
denied: DENIED.test(err) || code === "EACCES"
|
|
27437
|
+
});
|
|
27438
|
+
});
|
|
27439
|
+
});
|
|
27440
|
+
var defaultReader = async (path) => (0, import_promises12.readFile)(path, "utf8").catch(() => null);
|
|
27441
|
+
async function findExecutablesOnPath(name3, path = collectorEnv().PATH ?? "") {
|
|
27442
|
+
const found = [];
|
|
27443
|
+
for (const dir of path.split(":").filter((entry) => entry.startsWith("/"))) {
|
|
27444
|
+
try {
|
|
27445
|
+
const real = await (0, import_promises12.realpath)(`${dir}/${name3}`);
|
|
27446
|
+
await (0, import_promises12.access)(real, import_node_fs3.constants.X_OK);
|
|
27447
|
+
if (!found.includes(real))
|
|
27448
|
+
found.push(real);
|
|
27449
|
+
} catch {
|
|
27450
|
+
}
|
|
27451
|
+
}
|
|
27452
|
+
return found;
|
|
27453
|
+
}
|
|
27454
|
+
function installOf(real, home = (0, import_node_os4.homedir)()) {
|
|
27455
|
+
if (/^\/(opt\/homebrew|usr\/local\/Cellar|home\/linuxbrew\/\.linuxbrew)\//.test(real))
|
|
27456
|
+
return "homebrew";
|
|
27457
|
+
if (/^\/(usr\/(bin|sbin|lib|libexec|share)|bin|sbin|snap)\//.test(real))
|
|
27458
|
+
return "system";
|
|
27459
|
+
if (home && real.startsWith(`${home}/`) || /^\/(home|Users|root)\//.test(real))
|
|
27460
|
+
return "user";
|
|
27461
|
+
if (/^\/(usr\/local|opt)\//.test(real))
|
|
27462
|
+
return "local";
|
|
27463
|
+
return "other";
|
|
27464
|
+
}
|
|
27465
|
+
async function readFileTail(path, bytes3) {
|
|
27466
|
+
let handle = null;
|
|
27467
|
+
try {
|
|
27468
|
+
handle = await (0, import_promises12.open)(path, "r");
|
|
27469
|
+
const { size } = await handle.stat();
|
|
27470
|
+
const length = Math.min(size, bytes3);
|
|
27471
|
+
const buffer = Buffer.alloc(length);
|
|
27472
|
+
await handle.read(buffer, 0, length, size - length);
|
|
27473
|
+
const text6 = buffer.toString("utf8");
|
|
27474
|
+
return size > length ? text6.slice(text6.indexOf("\n") + 1) : text6;
|
|
27475
|
+
} catch {
|
|
27476
|
+
return null;
|
|
27477
|
+
} finally {
|
|
27478
|
+
await handle?.close().catch(() => void 0);
|
|
27479
|
+
}
|
|
27480
|
+
}
|
|
27481
|
+
async function listDirFiles(path, dirs = false) {
|
|
27482
|
+
try {
|
|
27483
|
+
const entries = await (0, import_promises12.readdir)(path, { withFileTypes: true });
|
|
27484
|
+
const files = [];
|
|
27485
|
+
for (const entry of entries.filter((item) => dirs ? item.isDirectory() : item.isFile()).slice(0, 2e3)) {
|
|
27486
|
+
try {
|
|
27487
|
+
files.push({ name: entry.name, mtimeMs: (await (0, import_promises12.stat)(`${path}/${entry.name}`)).mtimeMs });
|
|
27488
|
+
} catch {
|
|
27489
|
+
}
|
|
27490
|
+
}
|
|
27491
|
+
return files;
|
|
27492
|
+
} catch {
|
|
27493
|
+
return null;
|
|
27494
|
+
}
|
|
27495
|
+
}
|
|
27496
|
+
var defaultCollectorSystem = {
|
|
27497
|
+
platform: (0, import_node_os4.platform)(),
|
|
27498
|
+
arch: (0, import_node_os4.arch)(),
|
|
27499
|
+
kernel: (0, import_node_os4.release)(),
|
|
27500
|
+
run: defaultRunner,
|
|
27501
|
+
readText: defaultReader,
|
|
27502
|
+
now: () => /* @__PURE__ */ new Date(),
|
|
27503
|
+
probeTls: createTlsProbe(),
|
|
27504
|
+
readTail: readFileTail,
|
|
27505
|
+
listDir: listDirFiles,
|
|
27506
|
+
...(0, import_node_os4.platform)() === "win32" ? {} : { findExecutables: (name3) => findExecutablesOnPath(name3) }
|
|
27507
|
+
};
|
|
27508
|
+
var SHORT = { timeoutMs: 1e4, maxBytes: 2 * 1024 * 1024 };
|
|
27509
|
+
var LIST = { timeoutMs: 45e3, maxBytes: 48 * 1024 * 1024 };
|
|
27510
|
+
var POWERSHELL = ["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command"];
|
|
27511
|
+
var PS_PREFIX = "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $ProgressPreference = 'SilentlyContinue'; ";
|
|
27512
|
+
var PS_OS = PS_PREFIX + "$o = Get-CimInstance Win32_OperatingSystem; $ubr = (Get-ItemProperty 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion' -ErrorAction SilentlyContinue).UBR; [pscustomobject]@{Caption=$o.Caption;Version=$o.Version;BuildNumber=$o.BuildNumber;OSArchitecture=$o.OSArchitecture;UBR=$ubr} | ConvertTo-Json -Compress";
|
|
27513
|
+
var PS_PROGRAMS = PS_PREFIX + "$p = 'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*','HKLM:\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*','HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'; Get-ItemProperty -Path $p -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -and -not $_.SystemComponent } | Select-Object DisplayName,DisplayVersion,Publisher,EstimatedSize,InstallDate | ConvertTo-Json -Compress";
|
|
27514
|
+
var PS_SERVICES = PS_PREFIX + "Get-Service | Select-Object Name,DisplayName,Status,StartType | ConvertTo-Json -Compress";
|
|
27515
|
+
var SOFTWARE_PROBES = Object.freeze([
|
|
27516
|
+
{ key: "node", name: "Node.js", kind: "runtime", commands: [["node", "--version"], ["nodejs", "--version"]] },
|
|
27517
|
+
{ key: "python", name: "Python", kind: "runtime", commands: [["python3", "--version"], ["python", "--version"]] },
|
|
27518
|
+
{ key: "php", name: "PHP", kind: "runtime", commands: [["php", "--version"]] },
|
|
27519
|
+
{ key: "ruby", name: "Ruby", kind: "runtime", commands: [["ruby", "--version"]] },
|
|
27520
|
+
{ key: "go", name: "Go", kind: "runtime", commands: [["go", "version"]] },
|
|
27521
|
+
{ key: "java", name: "Java", kind: "runtime", commands: [["java", "-version"]] },
|
|
27522
|
+
{ key: "dotnet", name: ".NET", kind: "runtime", commands: [["dotnet", "--version"]] },
|
|
27523
|
+
{ key: "deno", name: "Deno", kind: "runtime", commands: [["deno", "--version"]] },
|
|
27524
|
+
{ key: "bun", name: "Bun", kind: "runtime", commands: [["bun", "--version"]] },
|
|
27525
|
+
{ key: "rust", name: "Rust", kind: "runtime", commands: [["rustc", "--version"]] },
|
|
27526
|
+
{ key: "nginx", name: "nginx", kind: "web_server", commands: [["nginx", "-v"]], posixOnly: true },
|
|
27527
|
+
{ key: "apache", name: "Apache HTTP Server", kind: "web_server", commands: [["apache2ctl", "-v"], ["httpd", "-v"]], posixOnly: true },
|
|
27528
|
+
{ key: "caddy", name: "Caddy", kind: "web_server", commands: [["caddy", "version"]] },
|
|
27529
|
+
{ key: "haproxy", name: "HAProxy", kind: "web_server", commands: [["haproxy", "-v"]], posixOnly: true },
|
|
27530
|
+
{ key: "traefik", name: "Traefik", kind: "web_server", commands: [["traefik", "version"]] },
|
|
27531
|
+
{ key: "mysql", name: "MySQL", kind: "database", commands: [["mysql", "--version"]] },
|
|
27532
|
+
{ key: "mariadb", name: "MariaDB", kind: "database", commands: [["mariadb", "--version"]] },
|
|
27533
|
+
{ key: "postgresql", name: "PostgreSQL", kind: "database", commands: [["psql", "--version"]] },
|
|
27534
|
+
{ key: "redis", name: "Redis", kind: "database", commands: [["redis-server", "--version"]] },
|
|
26976
27535
|
{ key: "mongodb", name: "MongoDB", kind: "database", commands: [["mongod", "--version"]] },
|
|
26977
27536
|
{ key: "sqlite", name: "SQLite", kind: "database", commands: [["sqlite3", "--version"]] },
|
|
26978
27537
|
{ key: "docker", name: "Docker", kind: "container_engine", commands: [["docker", "--version"]] },
|
|
@@ -27015,7 +27574,10 @@ var Collection = class {
|
|
|
27015
27574
|
services = [];
|
|
27016
27575
|
containers = [];
|
|
27017
27576
|
images = [];
|
|
27577
|
+
imagePackages = [];
|
|
27578
|
+
tlsEndpoints = [];
|
|
27018
27579
|
pods = [];
|
|
27580
|
+
health = [];
|
|
27019
27581
|
coverage = [];
|
|
27020
27582
|
constructor(system) {
|
|
27021
27583
|
this.system = system;
|
|
@@ -27051,6 +27613,8 @@ async function collectOs(c) {
|
|
|
27051
27613
|
if (platform2 === "linux") {
|
|
27052
27614
|
const release2 = parseOsRelease(await c.system.readText("/etc/os-release") ?? await c.system.readText("/usr/lib/os-release") ?? "");
|
|
27053
27615
|
const model = cleanModel(await c.system.readText("/proc/device-tree/model") ?? await c.system.readText("/sys/devices/virtual/dmi/id/product_name") ?? "");
|
|
27616
|
+
const signature = (await c.system.readText("/proc/version_signature") ?? "").trim().slice(0, 128);
|
|
27617
|
+
const livepatch = c.system.listDir ? await c.system.listDir("/sys/kernel/livepatch", true) : null;
|
|
27054
27618
|
return {
|
|
27055
27619
|
family: "linux",
|
|
27056
27620
|
name: release2.prettyName ?? release2.name ?? "Linux",
|
|
@@ -27060,7 +27624,9 @@ async function collectOs(c) {
|
|
|
27060
27624
|
...release2.id ? { distro_id: release2.id } : {},
|
|
27061
27625
|
...release2.versionId ? { distro_version: release2.versionId } : {},
|
|
27062
27626
|
...release2.codename ? { distro_codename: release2.codename } : {},
|
|
27063
|
-
...model ? { model } : {}
|
|
27627
|
+
...model ? { model } : {},
|
|
27628
|
+
...signature ? { kernel_signature: signature } : {},
|
|
27629
|
+
...livepatch !== null ? { livepatch: livepatch.length > 0 } : {}
|
|
27064
27630
|
};
|
|
27065
27631
|
}
|
|
27066
27632
|
if (platform2 === "darwin") {
|
|
@@ -27080,6 +27646,23 @@ async function collectOs(c) {
|
|
|
27080
27646
|
}
|
|
27081
27647
|
return { family: "other", name: platform2, version: kernel, kernel, arch: arch3 };
|
|
27082
27648
|
}
|
|
27649
|
+
var APT_POLICY_BATCH = 300;
|
|
27650
|
+
async function addAptOrigins(c, items) {
|
|
27651
|
+
const names = [...new Set(items.map((item) => item.name))].filter((name3) => /^[a-z0-9][a-z0-9+.-]*$/.test(name3));
|
|
27652
|
+
const origins = /* @__PURE__ */ new Map();
|
|
27653
|
+
for (let offset = 0; offset < names.length; offset += APT_POLICY_BATCH) {
|
|
27654
|
+
const stdout = await c.command("apt-policy", "apt-cache", ["policy", ...names.slice(offset, offset + APT_POLICY_BATCH)], LIST);
|
|
27655
|
+
if (stdout === null)
|
|
27656
|
+
return;
|
|
27657
|
+
for (const [name3, entry] of parseAptPolicy(stdout))
|
|
27658
|
+
origins.set(name3.split(":")[0], entry.origin);
|
|
27659
|
+
}
|
|
27660
|
+
for (const item of items) {
|
|
27661
|
+
const origin = origins.get(item.name);
|
|
27662
|
+
if (origin)
|
|
27663
|
+
item.origin = origin;
|
|
27664
|
+
}
|
|
27665
|
+
}
|
|
27083
27666
|
async function collectPackages(c) {
|
|
27084
27667
|
const { platform: platform2 } = c.system;
|
|
27085
27668
|
const add = (collector, items) => {
|
|
@@ -27088,9 +27671,11 @@ async function collectPackages(c) {
|
|
|
27088
27671
|
};
|
|
27089
27672
|
if (platform2 === "linux") {
|
|
27090
27673
|
const dpkg = await c.command("dpkg", "dpkg-query", ["-W", "-f=${Package}\\t${Version}\\t${Architecture}\\t${Installed-Size}\\t${db:Status-Abbrev}\\t${source:Package}\\t${source:Version}\\n"], LIST);
|
|
27091
|
-
if (dpkg !== null)
|
|
27092
|
-
|
|
27093
|
-
|
|
27674
|
+
if (dpkg !== null) {
|
|
27675
|
+
const items = parseDpkg(dpkg);
|
|
27676
|
+
await addAptOrigins(c, items);
|
|
27677
|
+
add("dpkg", items);
|
|
27678
|
+
} else {
|
|
27094
27679
|
const rpm = await c.command("rpm", "rpm", ["-qa", "--qf", "%{NAME}\\t%{EPOCH}\\t%{VERSION}\\t%{RELEASE}\\t%{ARCH}\\t%{SIZE}\\n"], LIST);
|
|
27095
27680
|
if (rpm !== null)
|
|
27096
27681
|
add("rpm", parseRpm(rpm));
|
|
@@ -27127,24 +27712,51 @@ async function collectPackages(c) {
|
|
|
27127
27712
|
if (npm !== null)
|
|
27128
27713
|
add("npm-global", parseNpmGlobal(npm));
|
|
27129
27714
|
}
|
|
27715
|
+
var MAX_INSTALLS = 6;
|
|
27716
|
+
async function collectInstalls(c, probe, found) {
|
|
27717
|
+
const seen = /* @__PURE__ */ new Set();
|
|
27718
|
+
const binaries = [];
|
|
27719
|
+
for (const [file2, ...args] of probe.commands) {
|
|
27720
|
+
for (const real of await c.system.findExecutables(file2)) {
|
|
27721
|
+
if (seen.has(real))
|
|
27722
|
+
continue;
|
|
27723
|
+
seen.add(real);
|
|
27724
|
+
binaries.push([real, args]);
|
|
27725
|
+
}
|
|
27726
|
+
}
|
|
27727
|
+
const entries = /* @__PURE__ */ new Map();
|
|
27728
|
+
for (const [real, args] of binaries.slice(0, MAX_INSTALLS)) {
|
|
27729
|
+
const result2 = await c.system.run(real, args, { timeoutMs: 8e3, maxBytes: 256 * 1024 });
|
|
27730
|
+
const version3 = result2.missing ? null : extractVersion(probe.key, `${result2.stdout}
|
|
27731
|
+
${result2.stderr}`);
|
|
27732
|
+
if (!version3)
|
|
27733
|
+
continue;
|
|
27734
|
+
const install = installOf(real);
|
|
27735
|
+
entries.set(`${version3}\0${install}`, { key: probe.key, name: probe.name, version: version3, kind: probe.kind, install });
|
|
27736
|
+
}
|
|
27737
|
+
found.push(...entries.values());
|
|
27738
|
+
return entries.size > 0;
|
|
27739
|
+
}
|
|
27130
27740
|
async function collectSoftware(c) {
|
|
27131
27741
|
const probes = SOFTWARE_PROBES.filter((probe) => !(probe.posixOnly && c.system.platform === "win32"));
|
|
27132
27742
|
const found = [];
|
|
27133
27743
|
const started = Date.now();
|
|
27134
27744
|
await pool(probes, 4, async (probe) => {
|
|
27745
|
+
if (probe.kind === "runtime" && c.system.findExecutables && await collectInstalls(c, probe, found))
|
|
27746
|
+
return;
|
|
27135
27747
|
for (const [file2, ...args] of probe.commands) {
|
|
27136
27748
|
const result2 = await c.system.run(file2, args, { timeoutMs: 8e3, maxBytes: 256 * 1024 });
|
|
27137
27749
|
if (result2.missing)
|
|
27138
27750
|
continue;
|
|
27139
|
-
const
|
|
27751
|
+
const version3 = extractVersion(probe.key, `${result2.stdout}
|
|
27140
27752
|
${result2.stderr}`);
|
|
27141
|
-
if (
|
|
27142
|
-
found.push({ key: probe.key, name: probe.name, version:
|
|
27753
|
+
if (version3) {
|
|
27754
|
+
found.push({ key: probe.key, name: probe.name, version: version3, kind: probe.kind });
|
|
27143
27755
|
break;
|
|
27144
27756
|
}
|
|
27145
27757
|
}
|
|
27146
27758
|
});
|
|
27147
|
-
found.sort((a, b) => SOFTWARE_PROBES.findIndex((p) => p.key === a.key) - SOFTWARE_PROBES.findIndex((p) => p.key === b.key));
|
|
27759
|
+
found.sort((a, b) => SOFTWARE_PROBES.findIndex((p) => p.key === a.key) - SOFTWARE_PROBES.findIndex((p) => p.key === b.key) || (a.install ?? "").localeCompare(b.install ?? "") || a.version.localeCompare(b.version));
|
|
27148
27760
|
c.software.push(...found);
|
|
27149
27761
|
c.cover("software", "ok", found.length, Date.now() - started);
|
|
27150
27762
|
}
|
|
@@ -27236,6 +27848,94 @@ async function collectContainers(c) {
|
|
|
27236
27848
|
image.containers = count3;
|
|
27237
27849
|
}
|
|
27238
27850
|
}
|
|
27851
|
+
var SBOM_IMAGES = 4;
|
|
27852
|
+
var SBOM_LIMITS = { timeoutMs: 9e4, maxBytes: 40 * 1024 * 1024 };
|
|
27853
|
+
async function collectImageSboms(c) {
|
|
27854
|
+
const images = c.images.filter((image) => (image.containers ?? 0) > 0 && /^[0-9a-f]{12}$/.test(image.id)).sort((a, b) => (b.containers ?? 0) - (a.containers ?? 0)).slice(0, SBOM_IMAGES);
|
|
27855
|
+
if (images.length === 0)
|
|
27856
|
+
return;
|
|
27857
|
+
const started = Date.now();
|
|
27858
|
+
let failure4 = null;
|
|
27859
|
+
for (const image of images) {
|
|
27860
|
+
const result2 = await c.system.run("syft", [`${image.engine}:${image.id}`, "-o", "json", "--quiet"], SBOM_LIMITS);
|
|
27861
|
+
if (result2.missing) {
|
|
27862
|
+
c.cover("image-sbom", "unavailable", 0, Date.now() - started);
|
|
27863
|
+
return;
|
|
27864
|
+
}
|
|
27865
|
+
if (!result2.ok) {
|
|
27866
|
+
failure4 ??= result2.timedOut ? "timeout" : result2.denied ? "denied" : "failed";
|
|
27867
|
+
continue;
|
|
27868
|
+
}
|
|
27869
|
+
const parsed = parseSyftJson(result2.stdout);
|
|
27870
|
+
if (parsed.distro_id) {
|
|
27871
|
+
image.distro_id = parsed.distro_id;
|
|
27872
|
+
if (parsed.distro_version)
|
|
27873
|
+
image.distro_version = parsed.distro_version;
|
|
27874
|
+
}
|
|
27875
|
+
for (const item of parsed.packages)
|
|
27876
|
+
c.imagePackages.push({ image: image.id, ...item });
|
|
27877
|
+
}
|
|
27878
|
+
c.cover("image-sbom", failure4 ?? "ok", c.imagePackages.length, Date.now() - started);
|
|
27879
|
+
c.counted("image-sbom", c.imagePackages.length, INVENTORY_LIMITS.imagePackages);
|
|
27880
|
+
}
|
|
27881
|
+
async function collectTls(c) {
|
|
27882
|
+
const probe = c.system.probeTls;
|
|
27883
|
+
if (!probe)
|
|
27884
|
+
return;
|
|
27885
|
+
const started = Date.now();
|
|
27886
|
+
const endpoints = await collectTlsEndpoints(probe);
|
|
27887
|
+
c.tlsEndpoints.push(...endpoints);
|
|
27888
|
+
c.cover("tls", "ok", endpoints.length, Date.now() - started);
|
|
27889
|
+
}
|
|
27890
|
+
var LOG_TAIL_BYTES = 256 * 1024;
|
|
27891
|
+
var WEB_ERROR_LOGS = Object.freeze([
|
|
27892
|
+
["/var/log/nginx/error.log", "nginx/error.log"],
|
|
27893
|
+
["/var/log/apache2/error.log", "apache2/error.log"],
|
|
27894
|
+
["/var/log/httpd/error_log", "httpd/error_log"],
|
|
27895
|
+
["/var/log/php-fpm/error.log", "php-fpm/error.log"]
|
|
27896
|
+
]);
|
|
27897
|
+
var PHP_FPM_LOG = /^php\d+(?:\.\d+)?-fpm\.log$/;
|
|
27898
|
+
var PS_EVENTS = PS_PREFIX + "Get-WinEvent -FilterHashtable @{LogName='System','Application'; Level=1,2; StartTime=(Get-Date).AddHours(-24)} -MaxEvents 2000 -ErrorAction SilentlyContinue | Select-Object ProviderName,Id,Level,TimeCreated,Message | ConvertTo-Json -Compress -Depth 2";
|
|
27899
|
+
async function collectHealth(c) {
|
|
27900
|
+
const { platform: platform2 } = c.system;
|
|
27901
|
+
const now = c.system.now();
|
|
27902
|
+
const started = Date.now();
|
|
27903
|
+
if (platform2 === "linux") {
|
|
27904
|
+
const journal = await c.command("health-journal", "journalctl", ["-p", "err", "-o", "json", "--since=-24h", "-n", "5000", "--no-pager", "-q"], LIST);
|
|
27905
|
+
if (journal !== null)
|
|
27906
|
+
c.health.push(...parseJournalJson(journal, now));
|
|
27907
|
+
if (c.system.readTail) {
|
|
27908
|
+
const logs = [...WEB_ERROR_LOGS];
|
|
27909
|
+
for (const file2 of await c.system.listDir?.("/var/log") ?? [])
|
|
27910
|
+
if (PHP_FPM_LOG.test(file2.name))
|
|
27911
|
+
logs.push([`/var/log/${file2.name}`, file2.name]);
|
|
27912
|
+
let read = 0;
|
|
27913
|
+
for (const [path, source] of logs) {
|
|
27914
|
+
const text6 = await c.system.readTail(path, LOG_TAIL_BYTES);
|
|
27915
|
+
if (text6 === null)
|
|
27916
|
+
continue;
|
|
27917
|
+
read += 1;
|
|
27918
|
+
c.health.push(...parseWebErrorLog(text6, source, now));
|
|
27919
|
+
}
|
|
27920
|
+
c.cover("health-web-logs", "ok", read, Date.now() - started);
|
|
27921
|
+
}
|
|
27922
|
+
const flag = await c.system.readText("/var/run/reboot-required");
|
|
27923
|
+
c.health.push(...rebootRequiredEvents(flag !== null, flag === null ? null : await c.system.readText("/var/run/reboot-required.pkgs")));
|
|
27924
|
+
} else if (platform2 === "darwin") {
|
|
27925
|
+
const jobs = await c.command("health-launchd", "launchctl", ["list"], SHORT);
|
|
27926
|
+
if (jobs !== null)
|
|
27927
|
+
c.health.push(...parseLaunchctlList(jobs));
|
|
27928
|
+
if (c.system.listDir) {
|
|
27929
|
+
const files = [...await c.system.listDir("/Library/Logs/DiagnosticReports") ?? [], ...await c.system.listDir(`${(0, import_node_os4.homedir)()}/Library/Logs/DiagnosticReports`) ?? []];
|
|
27930
|
+
c.health.push(...crashReportEvents(files, now));
|
|
27931
|
+
c.cover("health-crash-reports", "ok", files.length, Date.now() - started);
|
|
27932
|
+
}
|
|
27933
|
+
} else if (platform2 === "win32") {
|
|
27934
|
+
const events = await c.command("health-windows-events", "powershell.exe", [...POWERSHELL, PS_EVENTS], LIST);
|
|
27935
|
+
if (events !== null)
|
|
27936
|
+
c.health.push(...parseWindowsEvents(events));
|
|
27937
|
+
}
|
|
27938
|
+
}
|
|
27239
27939
|
async function collectInventory(system = defaultCollectorSystem) {
|
|
27240
27940
|
const c = new Collection(system);
|
|
27241
27941
|
const os = await collectOs(c);
|
|
@@ -27243,6 +27943,11 @@ async function collectInventory(system = defaultCollectorSystem) {
|
|
|
27243
27943
|
await collectSoftware(c);
|
|
27244
27944
|
await collectServices(c);
|
|
27245
27945
|
await collectContainers(c);
|
|
27946
|
+
await collectImageSboms(c);
|
|
27947
|
+
await collectTls(c);
|
|
27948
|
+
await collectHealth(c);
|
|
27949
|
+
const tlsEndpoints = valid(inventoryTlsEndpointSchema, c.tlsEndpoints, INVENTORY_LIMITS.tlsEndpoints);
|
|
27950
|
+
const health = capHealthEvents(valid(inventoryHealthEventSchema, c.health, Number.MAX_SAFE_INTEGER));
|
|
27246
27951
|
const snapshot = {
|
|
27247
27952
|
schema: 1,
|
|
27248
27953
|
collected_at: system.now().toISOString(),
|
|
@@ -27253,7 +27958,10 @@ async function collectInventory(system = defaultCollectorSystem) {
|
|
|
27253
27958
|
services: valid(inventoryServiceSchema, c.services, INVENTORY_LIMITS.services),
|
|
27254
27959
|
containers: valid(inventoryContainerSchema, c.containers, INVENTORY_LIMITS.containers),
|
|
27255
27960
|
images: valid(inventoryImageSchema, c.images, INVENTORY_LIMITS.images),
|
|
27961
|
+
...c.imagePackages.length > 0 ? { image_packages: valid(inventoryImagePackageSchema, c.imagePackages, INVENTORY_LIMITS.imagePackages) } : {},
|
|
27962
|
+
...tlsEndpoints.length > 0 ? { tls_endpoints: tlsEndpoints } : {},
|
|
27256
27963
|
pods: valid(inventoryPodSchema, c.pods, INVENTORY_LIMITS.pods),
|
|
27964
|
+
...health.length > 0 ? { health } : {},
|
|
27257
27965
|
coverage: valid(inventoryCoverageSchema, c.coverage, INVENTORY_LIMITS.coverage)
|
|
27258
27966
|
};
|
|
27259
27967
|
return inventorySnapshotSchema.parse(snapshot);
|
|
@@ -27291,8 +27999,8 @@ var RelaySession = class {
|
|
|
27291
27999
|
return { tenant_id, user_id, device_uuid };
|
|
27292
28000
|
}
|
|
27293
28001
|
/** Feed one incoming text frame; frames are processed strictly in order. */
|
|
27294
|
-
onMessage(
|
|
27295
|
-
const next = this.#queue.then(() => this.#process(
|
|
28002
|
+
onMessage(text6) {
|
|
28003
|
+
const next = this.#queue.then(() => this.#process(text6));
|
|
27296
28004
|
this.#queue = next.catch(() => void 0);
|
|
27297
28005
|
return next;
|
|
27298
28006
|
}
|
|
@@ -27306,13 +28014,13 @@ var RelaySession = class {
|
|
|
27306
28014
|
markClosed() {
|
|
27307
28015
|
this.#state = "closed";
|
|
27308
28016
|
}
|
|
27309
|
-
async #process(
|
|
28017
|
+
async #process(text6) {
|
|
27310
28018
|
if (this.#state === "closed")
|
|
27311
28019
|
return;
|
|
27312
28020
|
if (this.#state === "challenge" || this.#state === "auth_sent") {
|
|
27313
28021
|
let frame;
|
|
27314
28022
|
try {
|
|
27315
|
-
frame = JSON.parse(
|
|
28023
|
+
frame = JSON.parse(text6);
|
|
27316
28024
|
} catch {
|
|
27317
28025
|
return this.#fail("invalid pre-auth frame");
|
|
27318
28026
|
}
|
|
@@ -27322,7 +28030,7 @@ var RelaySession = class {
|
|
|
27322
28030
|
}
|
|
27323
28031
|
let envelope;
|
|
27324
28032
|
try {
|
|
27325
|
-
envelope = decodeEnvelope(
|
|
28033
|
+
envelope = decodeEnvelope(text6);
|
|
27326
28034
|
} catch (error63) {
|
|
27327
28035
|
this.#logger.warn("ignoring invalid envelope", { code: error63 instanceof ProtocolDecodeError ? error63.code : "INVALID_MESSAGE" });
|
|
27328
28036
|
return;
|
|
@@ -27441,7 +28149,7 @@ var SSH_STATUS_MAX_BYTES = 64 * 1024;
|
|
|
27441
28149
|
var SSH_OUTPUT_TTL_MS = 15 * 60 * 1e3;
|
|
27442
28150
|
var SSH_OUTPUT_CACHE_ENTRIES = 16;
|
|
27443
28151
|
function failure2(code, reason, message, executed = false, extra = {}) {
|
|
27444
|
-
return { result: { state: "FAILED", executed, safe_message: message, output_excerpt:
|
|
28152
|
+
return { result: { state: "FAILED", executed, safe_message: message, output_excerpt: excerpt({ error: code, reason, message, ...extra }) } };
|
|
27445
28153
|
}
|
|
27446
28154
|
var SshExecutor = class {
|
|
27447
28155
|
#options;
|
|
@@ -27469,7 +28177,7 @@ var SshExecutor = class {
|
|
|
27469
28177
|
return failure2("TARGET_OFFLINE", "SSH_TIMEOUT", "Status check timed out", true);
|
|
27470
28178
|
const output2 = result2.stdout + (result2.stderr ? (result2.stdout ? "\n" : "") + result2.stderr : "");
|
|
27471
28179
|
return {
|
|
27472
|
-
result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28180
|
+
result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ check: payload.check, ...this.#meta(result2) }) },
|
|
27473
28181
|
data: output2
|
|
27474
28182
|
};
|
|
27475
28183
|
}
|
|
@@ -27486,9 +28194,9 @@ var SshExecutor = class {
|
|
|
27486
28194
|
const meta3 = this.#meta(result2);
|
|
27487
28195
|
this.#logger.info("ssh command finished", { task_id: context.taskId, host: task.host.alias, exit_code: meta3.exit_code, timed_out: result2.timedOut });
|
|
27488
28196
|
if (result2.timedOut) {
|
|
27489
|
-
return { result: { state: "FAILED", executed: true, safe_message: `Command timed out after ${payload.timeout_s} s`, output_excerpt:
|
|
28197
|
+
return { result: { state: "FAILED", executed: true, safe_message: `Command timed out after ${payload.timeout_s} s`, output_excerpt: excerpt(meta3) } };
|
|
27490
28198
|
}
|
|
27491
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28199
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt(meta3) } };
|
|
27492
28200
|
}
|
|
27493
28201
|
case "ssh.exec.output": {
|
|
27494
28202
|
const payload = task.payload;
|
|
@@ -27498,7 +28206,7 @@ var SshExecutor = class {
|
|
|
27498
28206
|
return failure2("TASK_UNKNOWN", "SSH_OUTPUT_UNAVAILABLE", "No output is available for that task in this context (it expires after 15 minutes or when the agent restarts)");
|
|
27499
28207
|
}
|
|
27500
28208
|
return {
|
|
27501
|
-
result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28209
|
+
result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ exec_task_id: payload.task_id, stdout_bytes: Buffer.byteLength(cached2.stdout), stderr_bytes: Buffer.byteLength(cached2.stderr) }) },
|
|
27502
28210
|
data: JSON.stringify({ stdout: cached2.stdout, stderr: cached2.stderr })
|
|
27503
28211
|
};
|
|
27504
28212
|
}
|
|
@@ -27702,9 +28410,9 @@ function commandEnv(env = process.env, taskId2) {
|
|
|
27702
28410
|
var run = (file2, args) => new Promise((resolve8) => {
|
|
27703
28411
|
(0, import_node_child_process8.execFile)(file2, [...args], { windowsHide: true, maxBuffer: 16 * 1024 * 1024, timeout: 2e4 }, (error63, stdout) => resolve8({ ok: !error63, stdout: String(stdout) }));
|
|
27704
28412
|
});
|
|
27705
|
-
function parsePs(
|
|
28413
|
+
function parsePs(text6) {
|
|
27706
28414
|
const entries = [];
|
|
27707
|
-
for (const line of
|
|
28415
|
+
for (const line of text6.split("\n")) {
|
|
27708
28416
|
const match = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+([\d.]+)\s+([\d.]+)\s+(\S+)\s+(.*)$/.exec(line);
|
|
27709
28417
|
if (!match)
|
|
27710
28418
|
continue;
|
|
@@ -27720,10 +28428,10 @@ function parsePs(text4) {
|
|
|
27720
28428
|
}
|
|
27721
28429
|
return entries;
|
|
27722
28430
|
}
|
|
27723
|
-
function parseWindowsProcesses(
|
|
28431
|
+
function parseWindowsProcesses(text6) {
|
|
27724
28432
|
let value;
|
|
27725
28433
|
try {
|
|
27726
|
-
value = JSON.parse(
|
|
28434
|
+
value = JSON.parse(text6);
|
|
27727
28435
|
} catch {
|
|
27728
28436
|
return [];
|
|
27729
28437
|
}
|
|
@@ -27821,7 +28529,7 @@ var INLINE_OUTPUT_BYTES = 64 * 1024;
|
|
|
27821
28529
|
var INPUT_SETTLE_MS = 1500;
|
|
27822
28530
|
var KILL_GRACE_MS = 3e3;
|
|
27823
28531
|
function failure3(code, reason, message, executed = false, extra = {}) {
|
|
27824
|
-
return { result: { state: "FAILED", executed, safe_message: message.slice(0, 256), output_excerpt:
|
|
28532
|
+
return { result: { state: "FAILED", executed, safe_message: message.slice(0, 256), output_excerpt: excerpt({ error: code, reason, message, ...extra }) } };
|
|
27825
28533
|
}
|
|
27826
28534
|
function resolveCwd(input2, home = (0, import_node_os6.homedir)()) {
|
|
27827
28535
|
if (input2 === void 0 || input2 === "~")
|
|
@@ -27894,7 +28602,7 @@ var ShellExecutor = class {
|
|
|
27894
28602
|
duration_ms: (session.endedAtMs ?? this.#now()) - session.startedAtMs,
|
|
27895
28603
|
output_bytes: session.output.total
|
|
27896
28604
|
}));
|
|
27897
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28605
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ count: sessions.length }) }, data: JSON.stringify({ sessions }) };
|
|
27898
28606
|
}
|
|
27899
28607
|
case "process.list": {
|
|
27900
28608
|
const payload = task.payload;
|
|
@@ -27911,7 +28619,7 @@ var ShellExecutor = class {
|
|
|
27911
28619
|
this.#logger.warn("process list failed", { error: error63 instanceof ProcessListError ? error63.message : "unknown" });
|
|
27912
28620
|
return failure3("INVALID_MESSAGE", "PROCESS_LIST_FAILED", "The process list could not be read on the device");
|
|
27913
28621
|
}
|
|
27914
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28622
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ count: listed.processes.length, total: listed.total }) }, data: JSON.stringify(listed) };
|
|
27915
28623
|
}
|
|
27916
28624
|
case "process.kill": {
|
|
27917
28625
|
const payload = task.payload;
|
|
@@ -27929,11 +28637,11 @@ var ShellExecutor = class {
|
|
|
27929
28637
|
return failure3("INVALID_MESSAGE", "KILL_FAILED", `Could not stop process ${payload.pid}`);
|
|
27930
28638
|
}
|
|
27931
28639
|
this.#logger.info("process stopped on request", { pid: payload.pid, force: payload.force === true });
|
|
27932
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28640
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ pid: payload.pid, signal: payload.force ? "SIGKILL" : "SIGTERM" }) } };
|
|
27933
28641
|
}
|
|
27934
28642
|
case "system.info": {
|
|
27935
28643
|
const info = await systemInfo();
|
|
27936
|
-
return { result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28644
|
+
return { result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt({ platform: info.platform, arch: info.arch }) }, data: JSON.stringify(info) };
|
|
27937
28645
|
}
|
|
27938
28646
|
}
|
|
27939
28647
|
}
|
|
@@ -28053,7 +28761,7 @@ var ShellExecutor = class {
|
|
|
28053
28761
|
duration_ms: (session.endedAtMs ?? this.#now()) - session.startedAtMs
|
|
28054
28762
|
};
|
|
28055
28763
|
return {
|
|
28056
|
-
result: { state: "SUCCEEDED", executed: true, output_excerpt:
|
|
28764
|
+
result: { state: "SUCCEEDED", executed: true, output_excerpt: excerpt(mutated ? meta3 : { ...meta3, read_bytes: read.next_offset - read.offset }) },
|
|
28057
28765
|
data: JSON.stringify({ ...meta3, output: read.text, offset: read.offset, next_offset: read.next_offset, skipped_bytes: read.skipped_bytes })
|
|
28058
28766
|
};
|
|
28059
28767
|
}
|
|
@@ -28419,10 +29127,10 @@ var AgentRunner = class {
|
|
|
28419
29127
|
socket.addEventListener("message", (event) => {
|
|
28420
29128
|
if (settled)
|
|
28421
29129
|
return;
|
|
28422
|
-
const
|
|
28423
|
-
if (
|
|
29130
|
+
const text6 = frameText(event.data);
|
|
29131
|
+
if (text6 === null)
|
|
28424
29132
|
return;
|
|
28425
|
-
session.onMessage(
|
|
29133
|
+
session.onMessage(text6).catch((error63) => this.#logger.warn("frame handling failed", { error: errorMessage(error63) }));
|
|
28426
29134
|
});
|
|
28427
29135
|
socket.addEventListener("error", () => {
|
|
28428
29136
|
if (settled)
|
|
@@ -28643,12 +29351,12 @@ async function runInstalledCopy(paths, argv, io, keepsIdentity = true) {
|
|
|
28643
29351
|
}
|
|
28644
29352
|
return status;
|
|
28645
29353
|
}
|
|
28646
|
-
async function keychainUpdateProblem(identity,
|
|
29354
|
+
async function keychainUpdateProblem(identity, open7) {
|
|
28647
29355
|
const descriptor = identity?.key_store;
|
|
28648
29356
|
if (!descriptor || descriptor.type !== "keychain")
|
|
28649
29357
|
return null;
|
|
28650
29358
|
try {
|
|
28651
|
-
await (await
|
|
29359
|
+
await (await open7(descriptor)).load();
|
|
28652
29360
|
return null;
|
|
28653
29361
|
} catch (error63) {
|
|
28654
29362
|
const reason = error63 instanceof KeychainError && error63.code === "DENIED" ? `macOS does not let agent ${AGENT_VERSION} read this Mac's device key (it was created by an older agent build, or the Keychain is locked)` : `agent ${AGENT_VERSION} could not check this Mac's device key (${errorMessage(error63)})`;
|
|
@@ -29166,12 +29874,12 @@ async function cmdLogs(paths, args, io) {
|
|
|
29166
29874
|
return child.status ?? 1;
|
|
29167
29875
|
}
|
|
29168
29876
|
const logPath = serviceLogPath(io.env);
|
|
29169
|
-
const
|
|
29170
|
-
if (
|
|
29877
|
+
const text6 = await (0, import_promises15.readFile)(logPath, "utf8").catch(() => null);
|
|
29878
|
+
if (text6 === null) {
|
|
29171
29879
|
io.err(`No log at ${logPath} yet.`);
|
|
29172
29880
|
return 1;
|
|
29173
29881
|
}
|
|
29174
|
-
for (const line of
|
|
29882
|
+
for (const line of text6.split("\n").slice(-lines4 - 1))
|
|
29175
29883
|
if (line !== "")
|
|
29176
29884
|
io.out(line);
|
|
29177
29885
|
if (!values.follow)
|
|
@@ -29263,7 +29971,7 @@ function invokedDirectly() {
|
|
|
29263
29971
|
if (!entry)
|
|
29264
29972
|
return false;
|
|
29265
29973
|
try {
|
|
29266
|
-
return (0, import_node_url3.pathToFileURL)((0,
|
|
29974
|
+
return (0, import_node_url3.pathToFileURL)((0, import_node_fs4.realpathSync)(entry)).href === __conbridge_import_meta_url;
|
|
29267
29975
|
} catch {
|
|
29268
29976
|
return false;
|
|
29269
29977
|
}
|