qatools-cli 1.2.43 → 1.2.45
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/agents.js +104 -104
- package/brief.js +60 -53
- package/coding-agents.js +86 -0
- package/mcp-core.js +1150 -1125
- package/own-login.js +20 -11
- package/package.json +41 -39
- package/qatools.js +4666 -4574
- package/security-severity.js +30 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// backlog.security-signal: security is a marking on an item of any type. No severity means not a security item.
|
|
2
|
+
// functions/security-severity.js is a copy made by scripts/sync-mcp-core.js.
|
|
3
|
+
const SECURITY_SEVERITIES = ["critical", "high", "medium", "low"];
|
|
4
|
+
const CLOSED_STATUSES = ["resolved", "rejected", "closed"];
|
|
5
|
+
const ITEM_TYPE_PREFIX = { bug: "AVV", requirement_gap: "GAP", technical_defect: "DEF", improvement: "IMP" };
|
|
6
|
+
|
|
7
|
+
function severityOfScanLevel(level) {
|
|
8
|
+
return level === "error" ? "high" : level === "note" ? "low" : "medium";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Open security items of at least the given severity, most severe first
|
|
12
|
+
function openSecurityItems(items, failOn = "high") {
|
|
13
|
+
const rank = (s) => SECURITY_SEVERITIES.indexOf(s);
|
|
14
|
+
const limit = rank(failOn);
|
|
15
|
+
return items
|
|
16
|
+
.filter(i => rank(i.securitySeverity) >= 0 && rank(i.securitySeverity) <= limit && !CLOSED_STATUSES.includes(i.status))
|
|
17
|
+
.sort((a, b) => rank(a.securitySeverity) - rank(b.securitySeverity) || (a.bugNumber || 0) - (b.bugNumber || 0));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// ci.security-gate: exit code 1 and the items when something open is at least failOn, else 0
|
|
21
|
+
// Names the items without their text: a build log can be public, and the text can describe the vulnerability.
|
|
22
|
+
function securityGateResult(items, failOn = "high", projectName = "") {
|
|
23
|
+
const open = openSecurityItems(items, failOn);
|
|
24
|
+
const label = (i) => `${ITEM_TYPE_PREFIX[i.type] || "AVV"}-${i.bugNumber}`;
|
|
25
|
+
const where = projectName ? ` in ${projectName}` : "";
|
|
26
|
+
if (!open.length) return { code: 0, lines: [`Security gate passed${where}: no open security items at ${failOn} or above.`] };
|
|
27
|
+
return { code: 1, lines: [`Security gate failed${where}: ${open.length} open at ${failOn} or above.`, ...open.map(i => ` ${label(i)} [${i.securitySeverity}] ${i.status}`)] };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { SECURITY_SEVERITIES, ITEM_TYPE_PREFIX, severityOfScanLevel, openSecurityItems, securityGateResult };
|