ccperm 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/interactive.js +13 -2
- package/package.json +1 -1
package/dist/interactive.js
CHANGED
|
@@ -7,6 +7,15 @@ exports.startInteractive = startInteractive;
|
|
|
7
7
|
const node_readline_1 = __importDefault(require("node:readline"));
|
|
8
8
|
const colors_js_1 = require("./colors.js");
|
|
9
9
|
const explain_js_1 = require("./explain.js");
|
|
10
|
+
function severityTag(s) {
|
|
11
|
+
const labels = {
|
|
12
|
+
critical: `${colors_js_1.RED}CRITICAL${colors_js_1.NC}`,
|
|
13
|
+
high: `${colors_js_1.YELLOW}HIGH${colors_js_1.NC} `,
|
|
14
|
+
medium: `${colors_js_1.DIM}MEDIUM${colors_js_1.NC} `,
|
|
15
|
+
low: `${colors_js_1.DIM}LOW${colors_js_1.NC} `,
|
|
16
|
+
};
|
|
17
|
+
return labels[s];
|
|
18
|
+
}
|
|
10
19
|
// Clean up messy bash permission labels for display
|
|
11
20
|
function cleanLabel(label) {
|
|
12
21
|
let s = label;
|
|
@@ -201,10 +210,12 @@ function renderDetail(state, withPerms, results) {
|
|
|
201
210
|
const clean = cleanLabel(item.name);
|
|
202
211
|
if (state.showInfo) {
|
|
203
212
|
const info = (0, explain_js_1.explain)(group.category, item.name);
|
|
204
|
-
const
|
|
213
|
+
const tag = severityTag(info.risk);
|
|
214
|
+
const tagLen = info.risk.length + 2; // tag visual width (e.g. "CRITICAL" + 2 spaces)
|
|
215
|
+
const nameMax = Math.min(30, w - tagLen - 14);
|
|
205
216
|
const name = clean.length > nameMax ? clean.slice(0, nameMax - 1) + '…' : clean;
|
|
206
217
|
const desc = info.description ? `${colors_js_1.DIM}${info.description}${colors_js_1.NC}` : '';
|
|
207
|
-
navRows.push({ text: ` ${pad(name, nameMax)}
|
|
218
|
+
navRows.push({ text: ` ${pad(name, nameMax)} ${tag} ${desc}`, perm: item.name });
|
|
208
219
|
}
|
|
209
220
|
else {
|
|
210
221
|
const maxLen = w - 8;
|