@greenarmor/ges-web-dashboard 1.2.1 → 1.2.3
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/index.js +50 -4
- package/dist/template.js +2 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -52,6 +52,17 @@ function loadControlsForConfig(projectPath, config) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function loadFindings(projectPath) {
|
|
55
|
+
try {
|
|
56
|
+
const auditPath = path.join(projectPath, ".ges", "last-audit.json");
|
|
57
|
+
if (fs.existsSync(auditPath)) {
|
|
58
|
+
const raw = fs.readFileSync(auditPath, "utf-8");
|
|
59
|
+
const data = JSON.parse(raw);
|
|
60
|
+
if (data.findings && Array.isArray(data.findings)) {
|
|
61
|
+
return data.findings;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch { /* fall through to live audit */ }
|
|
55
66
|
try {
|
|
56
67
|
const result = runAudit(projectPath);
|
|
57
68
|
return deduplicateFindings(result.findings);
|
|
@@ -60,6 +71,38 @@ function loadFindings(projectPath) {
|
|
|
60
71
|
return [];
|
|
61
72
|
}
|
|
62
73
|
}
|
|
74
|
+
const SCANNABLE_CATEGORIES = new Set([
|
|
75
|
+
"encryption", "authentication", "audit", "security",
|
|
76
|
+
"database", "secrets", "injection", "xss",
|
|
77
|
+
"infrastructure", "dependencies",
|
|
78
|
+
]);
|
|
79
|
+
function updateControlsFromFindings(controls, findings) {
|
|
80
|
+
const controlsWithFindings = new Set(findings.flatMap(f => f.controlIds));
|
|
81
|
+
return controls.map(control => {
|
|
82
|
+
if (control.status === "pass" || control.status === "not-applicable")
|
|
83
|
+
return control;
|
|
84
|
+
const relevantFindings = findings.filter(f => f.controlIds.includes(control.id));
|
|
85
|
+
if (relevantFindings.length === 0) {
|
|
86
|
+
if (SCANNABLE_CATEGORIES.has(control.category) && !controlsWithFindings.has(control.id)) {
|
|
87
|
+
return {
|
|
88
|
+
...control,
|
|
89
|
+
checks: control.checks.map(check => ({ ...check, status: "pass" })),
|
|
90
|
+
status: "pass",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return control;
|
|
94
|
+
}
|
|
95
|
+
const hasCritical = relevantFindings.some(f => f.severity === "critical" || f.severity === "high");
|
|
96
|
+
return {
|
|
97
|
+
...control,
|
|
98
|
+
checks: control.checks.map(check => ({
|
|
99
|
+
...check,
|
|
100
|
+
status: hasCritical ? "fail" : "warning",
|
|
101
|
+
})),
|
|
102
|
+
status: hasCritical ? "fail" : "warning",
|
|
103
|
+
};
|
|
104
|
+
});
|
|
105
|
+
}
|
|
63
106
|
function buildPackSummary(pack, controls, findings, installedPacks) {
|
|
64
107
|
const packControlIds = new Set(pack.controls.map(c => c.id));
|
|
65
108
|
const packControls = controls.filter(c => packControlIds.has(c.id));
|
|
@@ -116,8 +159,9 @@ function getInstalledPackIds(projectPath, config) {
|
|
|
116
159
|
export function collectDashboardData(projectPath) {
|
|
117
160
|
const config = loadConfig(projectPath);
|
|
118
161
|
let score = loadScore(projectPath);
|
|
119
|
-
const
|
|
162
|
+
const baseControls = config ? loadControlsForConfig(projectPath, config) : [];
|
|
120
163
|
const findings = loadFindings(projectPath);
|
|
164
|
+
const controls = updateControlsFromFindings(baseControls, findings);
|
|
121
165
|
if (config) {
|
|
122
166
|
try {
|
|
123
167
|
const freshScore = generateScoreFile(controls, config.frameworks, findings);
|
|
@@ -145,7 +189,7 @@ export function collectDashboardData(projectPath) {
|
|
|
145
189
|
projectName: config?.project_name || "Unknown Project",
|
|
146
190
|
projectType: config?.project_type || "unknown",
|
|
147
191
|
frameworks: config?.frameworks || [],
|
|
148
|
-
gesfVersion: "1.2.
|
|
192
|
+
gesfVersion: "1.2.3",
|
|
149
193
|
score,
|
|
150
194
|
controls,
|
|
151
195
|
findings,
|
|
@@ -159,8 +203,9 @@ export function collectPackDetail(projectPath, packId) {
|
|
|
159
203
|
if (!pack)
|
|
160
204
|
return null;
|
|
161
205
|
const config = loadConfig(projectPath);
|
|
162
|
-
const
|
|
206
|
+
const baseControls = config ? loadControlsForConfig(projectPath, config) : [];
|
|
163
207
|
const findings = loadFindings(projectPath);
|
|
208
|
+
const controls = updateControlsFromFindings(baseControls, findings);
|
|
164
209
|
const packControlIds = new Set(pack.controls.map(c => c.id));
|
|
165
210
|
const packControls = pack.controls;
|
|
166
211
|
const installedPacks = getInstalledPackIds(projectPath, config || undefined);
|
|
@@ -238,8 +283,9 @@ export function collectControlDetail(projectPath, controlId) {
|
|
|
238
283
|
const config = loadConfig(projectPath);
|
|
239
284
|
if (!config)
|
|
240
285
|
return null;
|
|
241
|
-
const
|
|
286
|
+
const baseControls = loadControlsForConfig(projectPath, config);
|
|
242
287
|
const findings = loadFindings(projectPath);
|
|
288
|
+
const controls = updateControlsFromFindings(baseControls, findings);
|
|
243
289
|
const control = controls.find(c => c.id === controlId);
|
|
244
290
|
if (!control)
|
|
245
291
|
return null;
|
package/dist/template.js
CHANGED
|
@@ -703,7 +703,7 @@ export function renderDashboard(data) {
|
|
|
703
703
|
|
|
704
704
|
html += '<div class="tab-bar">';
|
|
705
705
|
html += '<button class="tab-btn active" onclick="showPackTab(\\'all\\',this)">All Controls (' + controls.length + ')</button>';
|
|
706
|
-
html += '<button class="tab-btn" onclick="showPackTab(\\'failing\\',this)">Failing (' + (controls.filter(function(c){return c.status
|
|
706
|
+
html += '<button class="tab-btn" onclick="showPackTab(\\'failing\\',this)">Failing (' + (controls.filter(function(c){return c.status!=="pass"&&c.status!=="not-applicable"}).length) + ')</button>';
|
|
707
707
|
html += '<button class="tab-btn" onclick="showPackTab(\\'withfindings\\',this)">With Findings (' + (controls.filter(function(c){return c.relatedFindings.length>0}).length) + ')</button>';
|
|
708
708
|
html += '</div>';
|
|
709
709
|
|
|
@@ -711,7 +711,7 @@ export function renderDashboard(data) {
|
|
|
711
711
|
html += renderControlsTable(controls);
|
|
712
712
|
html += '</div>';
|
|
713
713
|
html += '<div id="pack-controls-failing" style="display:none;">';
|
|
714
|
-
html += renderControlsTable(controls.filter(function(c){return c.status
|
|
714
|
+
html += renderControlsTable(controls.filter(function(c){return c.status!=="pass"&&c.status!=="not-applicable"}));
|
|
715
715
|
html += '</div>';
|
|
716
716
|
html += '<div id="pack-controls-withfindings" style="display:none;">';
|
|
717
717
|
html += renderControlsTable(controls.filter(function(c){return c.relatedFindings.length>0}));
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@greenarmor/ges-audit-engine": "1.2.
|
|
4
|
-
"@greenarmor/ges-core": "1.2.
|
|
5
|
-
"@greenarmor/ges-policy-engine": "1.2.
|
|
6
|
-
"@greenarmor/ges-scoring-engine": "1.2.
|
|
3
|
+
"@greenarmor/ges-audit-engine": "1.2.3",
|
|
4
|
+
"@greenarmor/ges-core": "1.2.3",
|
|
5
|
+
"@greenarmor/ges-policy-engine": "1.2.3",
|
|
6
|
+
"@greenarmor/ges-scoring-engine": "1.2.3"
|
|
7
7
|
},
|
|
8
8
|
"description": "GESF Web Dashboard - Visual compliance dashboard for teams",
|
|
9
9
|
"devDependencies": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"type": "module",
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
|
-
"version": "1.2.
|
|
43
|
+
"version": "1.2.3",
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsc",
|
|
46
46
|
"clean": "rm -rf dist tsconfig.tsbuildinfo",
|