coverme-scanner 1.0.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 +227 -0
- package/commands/scan.md +317 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +39 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init.d.ts +6 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +636 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/scan.d.ts +11 -0
- package/dist/cli/scan.d.ts.map +1 -0
- package/dist/cli/scan.js +498 -0
- package/dist/cli/scan.js.map +1 -0
- package/dist/report/generator.d.ts +48 -0
- package/dist/report/generator.d.ts.map +1 -0
- package/dist/report/generator.js +368 -0
- package/dist/report/generator.js.map +1 -0
- package/dist/report/index.d.ts +35 -0
- package/dist/report/index.d.ts.map +1 -0
- package/dist/report/index.js +463 -0
- package/dist/report/index.js.map +1 -0
- package/dist/templates/report.html +796 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +48 -0
- package/src/cli/index.ts +43 -0
- package/src/cli/init.ts +611 -0
- package/src/cli/scan.ts +483 -0
- package/src/prompts/architecture-reviewer.md +171 -0
- package/src/prompts/consensus-builder.md +247 -0
- package/src/prompts/context-discovery.md +174 -0
- package/src/prompts/cross-validator.md +224 -0
- package/src/prompts/deep-dive-expert.md +224 -0
- package/src/prompts/dependency-auditor.md +190 -0
- package/src/prompts/performance-hunter.md +200 -0
- package/src/prompts/quality-analyzer.md +150 -0
- package/src/prompts/report-generator.md +285 -0
- package/src/prompts/security-scanner.md +180 -0
- package/src/report/generator.ts +382 -0
- package/src/report/index.ts +483 -0
- package/src/templates/report.html +796 -0
- package/src/types.ts +107 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.calculateScore = calculateScore;
|
|
40
|
+
exports.generateExecutiveSummary = generateExecutiveSummary;
|
|
41
|
+
exports.renderTemplate = renderTemplate;
|
|
42
|
+
exports.generatePdfReport = generatePdfReport;
|
|
43
|
+
exports.generateHtmlReport = generateHtmlReport;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const puppeteer_1 = __importDefault(require("puppeteer"));
|
|
47
|
+
function calculateScore(result) {
|
|
48
|
+
// Scoring: Start at 100, subtract based on findings
|
|
49
|
+
// Critical: -15 each
|
|
50
|
+
// High: -8 each
|
|
51
|
+
// Medium: -3 each
|
|
52
|
+
// Low: -1 each
|
|
53
|
+
// Info: 0
|
|
54
|
+
let score = 100;
|
|
55
|
+
score -= result.summary.critical * 15;
|
|
56
|
+
score -= result.summary.high * 8;
|
|
57
|
+
score -= result.summary.medium * 3;
|
|
58
|
+
score -= result.summary.low * 1;
|
|
59
|
+
score = Math.max(0, Math.min(100, score));
|
|
60
|
+
let grade;
|
|
61
|
+
if (score >= 90)
|
|
62
|
+
grade = 'a';
|
|
63
|
+
else if (score >= 80)
|
|
64
|
+
grade = 'b';
|
|
65
|
+
else if (score >= 70)
|
|
66
|
+
grade = 'c';
|
|
67
|
+
else if (score >= 60)
|
|
68
|
+
grade = 'd';
|
|
69
|
+
else
|
|
70
|
+
grade = 'f';
|
|
71
|
+
return { grade, value: score };
|
|
72
|
+
}
|
|
73
|
+
function generateExecutiveSummary(result) {
|
|
74
|
+
const total = result.summary.total;
|
|
75
|
+
const critical = result.summary.critical;
|
|
76
|
+
const high = result.summary.high;
|
|
77
|
+
if (critical > 0) {
|
|
78
|
+
return `This scan identified ${total} security and quality findings, including ${critical} critical issue${critical > 1 ? 's' : ''} that require immediate attention. ${high > 0 ? `Additionally, ${high} high-priority issues were found that should be addressed soon.` : ''} The codebase requires immediate remediation before production deployment.`;
|
|
79
|
+
}
|
|
80
|
+
if (high > 0) {
|
|
81
|
+
return `This scan identified ${total} findings, with ${high} high-priority issue${high > 1 ? 's' : ''} that should be addressed in the near term. No critical vulnerabilities were detected, but the high-priority findings could pose security risks if left unaddressed.`;
|
|
82
|
+
}
|
|
83
|
+
if (total > 0) {
|
|
84
|
+
return `This scan identified ${total} findings, primarily medium and low priority items. No critical or high-severity issues were detected. The codebase demonstrates reasonable security practices with room for improvement in the areas noted below.`;
|
|
85
|
+
}
|
|
86
|
+
return `Excellent! This scan found no significant security or quality issues. The codebase demonstrates strong security practices and code quality. Continue maintaining these standards.`;
|
|
87
|
+
}
|
|
88
|
+
function escapeHtml(text) {
|
|
89
|
+
return text
|
|
90
|
+
.replace(/&/g, '&')
|
|
91
|
+
.replace(/</g, '<')
|
|
92
|
+
.replace(/>/g, '>')
|
|
93
|
+
.replace(/"/g, '"')
|
|
94
|
+
.replace(/'/g, ''');
|
|
95
|
+
}
|
|
96
|
+
function renderFindings(findings, template) {
|
|
97
|
+
if (!findings || findings.length === 0)
|
|
98
|
+
return '';
|
|
99
|
+
return findings.map(f => {
|
|
100
|
+
let html = template;
|
|
101
|
+
html = html.replace(/\{\{id\}\}/g, escapeHtml(f.id));
|
|
102
|
+
html = html.replace(/\{\{title\}\}/g, escapeHtml(f.title));
|
|
103
|
+
html = html.replace(/\{\{file\}\}/g, escapeHtml(f.file || 'N/A'));
|
|
104
|
+
html = html.replace(/\{\{line\}\}/g, String(f.line || ''));
|
|
105
|
+
html = html.replace(/\{\{confidence\}\}/g, String(f.confidence || 0));
|
|
106
|
+
html = html.replace(/\{\{description\}\}/g, escapeHtml(f.description));
|
|
107
|
+
html = html.replace(/\{\{category\}\}/g, escapeHtml(f.category));
|
|
108
|
+
html = html.replace(/\{\{cwe\}\}/g, escapeHtml(f.cwe || 'N/A'));
|
|
109
|
+
html = html.replace(/\{\{code\}\}/g, escapeHtml(f.code || ''));
|
|
110
|
+
html = html.replace(/\{\{recommendation\}\}/g, escapeHtml(f.recommendation));
|
|
111
|
+
html = html.replace(/\{\{severity\}\}/g, f.severity);
|
|
112
|
+
// New fields: why, context, checkBefore
|
|
113
|
+
html = html.replace(/\{\{why\}\}/g, escapeHtml(f.why || ''));
|
|
114
|
+
html = html.replace(/\{\{context\}\}/g, escapeHtml(f.context || ''));
|
|
115
|
+
html = html.replace(/\{\{checkBefore\}\}/g, escapeHtml(f.checkBefore || ''));
|
|
116
|
+
// Handle {{#if why}} blocks
|
|
117
|
+
if (f.why) {
|
|
118
|
+
html = html.replace(/\{\{#if why\}\}/g, '').replace(/\{\{\/if\}\}/g, '');
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
html = html.replace(/\{\{#if why\}\}[\s\S]*?\{\{\/if\}\}/g, '');
|
|
122
|
+
}
|
|
123
|
+
if (f.context) {
|
|
124
|
+
html = html.replace(/\{\{#if context\}\}/g, '').replace(/\{\{\/if\}\}/g, '');
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
html = html.replace(/\{\{#if context\}\}[\s\S]*?\{\{\/if\}\}/g, '');
|
|
128
|
+
}
|
|
129
|
+
if (f.checkBefore) {
|
|
130
|
+
html = html.replace(/\{\{#if checkBefore\}\}/g, '').replace(/\{\{\/if\}\}/g, '');
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
html = html.replace(/\{\{#if checkBefore\}\}[\s\S]*?\{\{\/if\}\}/g, '');
|
|
134
|
+
}
|
|
135
|
+
return html;
|
|
136
|
+
}).join('\n');
|
|
137
|
+
}
|
|
138
|
+
function renderTemplate(templateHtml, data) {
|
|
139
|
+
let html = templateHtml;
|
|
140
|
+
// Simple replacements
|
|
141
|
+
html = html.replace(/\{\{projectName\}\}/g, escapeHtml(data.projectName));
|
|
142
|
+
html = html.replace(/\{\{scanDate\}\}/g, escapeHtml(data.scanDate));
|
|
143
|
+
html = html.replace(/\{\{scoreGrade\}\}/g, data.scoreGrade);
|
|
144
|
+
html = html.replace(/\{\{scoreValue\}\}/g, String(data.scoreValue));
|
|
145
|
+
html = html.replace(/\{\{criticalCount\}\}/g, String(data.criticalCount));
|
|
146
|
+
html = html.replace(/\{\{highCount\}\}/g, String(data.highCount));
|
|
147
|
+
html = html.replace(/\{\{mediumCount\}\}/g, String(data.mediumCount));
|
|
148
|
+
html = html.replace(/\{\{lowCount\}\}/g, String(data.lowCount));
|
|
149
|
+
html = html.replace(/\{\{infoCount\}\}/g, String(data.infoCount));
|
|
150
|
+
html = html.replace(/\{\{lowInfoCount\}\}/g, String(data.lowInfoCount));
|
|
151
|
+
html = html.replace(/\{\{falsePositiveCount\}\}/g, String(data.falsePositiveCount));
|
|
152
|
+
html = html.replace(/\{\{executiveSummary\}\}/g, escapeHtml(data.executiveSummary));
|
|
153
|
+
html = html.replace(/\{\{scanDuration\}\}/g, escapeHtml(data.scanDuration));
|
|
154
|
+
html = html.replace(/\{\{agentCount\}\}/g, String(data.agentCount));
|
|
155
|
+
// Extract finding template from HTML
|
|
156
|
+
const findingTemplateMatch = html.match(/<div class="finding">[\s\S]*?<\/div>\s*<\/div>\s*<\/div>/);
|
|
157
|
+
const findingTemplate = findingTemplateMatch ? findingTemplateMatch[0] : '';
|
|
158
|
+
// Render each section with {{#each}} blocks
|
|
159
|
+
// Critical findings
|
|
160
|
+
const criticalSection = html.match(/\{\{#if criticalFindings\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
161
|
+
if (criticalSection) {
|
|
162
|
+
if (data.criticalFindings.length > 0) {
|
|
163
|
+
let section = criticalSection[0]
|
|
164
|
+
.replace('{{#if criticalFindings}}', '')
|
|
165
|
+
.replace('{{/if}}', '');
|
|
166
|
+
const eachMatch = section.match(/\{\{#each criticalFindings\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
167
|
+
if (eachMatch) {
|
|
168
|
+
const rendered = renderFindings(data.criticalFindings, eachMatch[1]);
|
|
169
|
+
section = section.replace(eachMatch[0], rendered);
|
|
170
|
+
}
|
|
171
|
+
html = html.replace(criticalSection[0], section);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
html = html.replace(criticalSection[0], '');
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
// High findings
|
|
178
|
+
const highSection = html.match(/\{\{#if highFindings\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
179
|
+
if (highSection) {
|
|
180
|
+
if (data.highFindings.length > 0) {
|
|
181
|
+
let section = highSection[0]
|
|
182
|
+
.replace('{{#if highFindings}}', '')
|
|
183
|
+
.replace('{{/if}}', '');
|
|
184
|
+
const eachMatch = section.match(/\{\{#each highFindings\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
185
|
+
if (eachMatch) {
|
|
186
|
+
const rendered = renderFindings(data.highFindings, eachMatch[1]);
|
|
187
|
+
section = section.replace(eachMatch[0], rendered);
|
|
188
|
+
}
|
|
189
|
+
html = html.replace(highSection[0], section);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
html = html.replace(highSection[0], '');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Medium findings
|
|
196
|
+
const mediumSection = html.match(/\{\{#if mediumFindings\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
197
|
+
if (mediumSection) {
|
|
198
|
+
if (data.mediumFindings.length > 0) {
|
|
199
|
+
let section = mediumSection[0]
|
|
200
|
+
.replace('{{#if mediumFindings}}', '')
|
|
201
|
+
.replace('{{/if}}', '');
|
|
202
|
+
const eachMatch = section.match(/\{\{#each mediumFindings\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
203
|
+
if (eachMatch) {
|
|
204
|
+
const rendered = renderFindings(data.mediumFindings, eachMatch[1]);
|
|
205
|
+
section = section.replace(eachMatch[0], rendered);
|
|
206
|
+
}
|
|
207
|
+
html = html.replace(mediumSection[0], section);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
html = html.replace(mediumSection[0], '');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Low findings
|
|
214
|
+
const lowSection = html.match(/\{\{#if lowFindings\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
215
|
+
if (lowSection) {
|
|
216
|
+
if (data.lowFindings.length > 0) {
|
|
217
|
+
let section = lowSection[0]
|
|
218
|
+
.replace('{{#if lowFindings}}', '')
|
|
219
|
+
.replace('{{/if}}', '');
|
|
220
|
+
const eachMatch = section.match(/\{\{#each lowFindings\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
221
|
+
if (eachMatch) {
|
|
222
|
+
const rendered = renderFindings(data.lowFindings, eachMatch[1]);
|
|
223
|
+
section = section.replace(eachMatch[0], rendered);
|
|
224
|
+
}
|
|
225
|
+
html = html.replace(lowSection[0], section);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
html = html.replace(lowSection[0], '');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// False positives
|
|
232
|
+
const fpSection = html.match(/\{\{#if falsePositives\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
233
|
+
if (fpSection) {
|
|
234
|
+
if (data.falsePositives.length > 0) {
|
|
235
|
+
let section = fpSection[0]
|
|
236
|
+
.replace('{{#if falsePositives}}', '')
|
|
237
|
+
.replace('{{/if}}', '');
|
|
238
|
+
const eachMatch = section.match(/\{\{#each falsePositives\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
239
|
+
if (eachMatch) {
|
|
240
|
+
const rendered = data.falsePositives.map(fp => {
|
|
241
|
+
let itemHtml = eachMatch[1];
|
|
242
|
+
itemHtml = itemHtml.replace(/\{\{id\}\}/g, escapeHtml(fp.id));
|
|
243
|
+
itemHtml = itemHtml.replace(/\{\{title\}\}/g, escapeHtml(fp.title));
|
|
244
|
+
itemHtml = itemHtml.replace(/\{\{file\}\}/g, escapeHtml(fp.file || ''));
|
|
245
|
+
itemHtml = itemHtml.replace(/\{\{rejectionReason\}\}/g, escapeHtml(fp.rejectionReason));
|
|
246
|
+
return itemHtml;
|
|
247
|
+
}).join('\n');
|
|
248
|
+
section = section.replace(eachMatch[0], rendered);
|
|
249
|
+
}
|
|
250
|
+
html = html.replace(fpSection[0], section);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
html = html.replace(fpSection[0], '');
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// Positive observations
|
|
257
|
+
const posSection = html.match(/\{\{#if positiveObservations\}\}[\s\S]*?\{\{\/if\}\}/);
|
|
258
|
+
if (posSection) {
|
|
259
|
+
if (data.positiveObservations.length > 0) {
|
|
260
|
+
let section = posSection[0]
|
|
261
|
+
.replace('{{#if positiveObservations}}', '')
|
|
262
|
+
.replace('{{/if}}', '');
|
|
263
|
+
const eachMatch = section.match(/\{\{#each positiveObservations\}\}([\s\S]*?)\{\{\/each\}\}/);
|
|
264
|
+
if (eachMatch) {
|
|
265
|
+
const rendered = data.positiveObservations.map(obs => {
|
|
266
|
+
return eachMatch[1].replace(/\{\{this\}\}/g, escapeHtml(obs));
|
|
267
|
+
}).join('\n');
|
|
268
|
+
section = section.replace(eachMatch[0], rendered);
|
|
269
|
+
}
|
|
270
|
+
html = html.replace(posSection[0], section);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
html = html.replace(posSection[0], '');
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return html;
|
|
277
|
+
}
|
|
278
|
+
async function generatePdfReport(result, outputPath, falsePositives = []) {
|
|
279
|
+
const templatePath = path.join(__dirname, '..', 'templates', 'report.html');
|
|
280
|
+
const templateHtml = fs.readFileSync(templatePath, 'utf-8');
|
|
281
|
+
const { grade, value } = calculateScore(result);
|
|
282
|
+
const criticalFindings = result.findings.filter(f => f.severity === 'critical');
|
|
283
|
+
const highFindings = result.findings.filter(f => f.severity === 'high');
|
|
284
|
+
const mediumFindings = result.findings.filter(f => f.severity === 'medium');
|
|
285
|
+
const lowFindings = result.findings.filter(f => f.severity === 'low' || f.severity === 'info');
|
|
286
|
+
const data = {
|
|
287
|
+
projectName: result.projectName,
|
|
288
|
+
scanDate: new Date(result.scanDate).toLocaleDateString('en-US', {
|
|
289
|
+
year: 'numeric',
|
|
290
|
+
month: 'long',
|
|
291
|
+
day: 'numeric'
|
|
292
|
+
}),
|
|
293
|
+
scoreGrade: grade,
|
|
294
|
+
scoreValue: value,
|
|
295
|
+
criticalCount: result.summary.critical,
|
|
296
|
+
highCount: result.summary.high,
|
|
297
|
+
mediumCount: result.summary.medium,
|
|
298
|
+
lowCount: result.summary.low,
|
|
299
|
+
infoCount: result.summary.info,
|
|
300
|
+
executiveSummary: generateExecutiveSummary(result),
|
|
301
|
+
criticalFindings,
|
|
302
|
+
highFindings,
|
|
303
|
+
mediumFindings,
|
|
304
|
+
lowFindings,
|
|
305
|
+
falsePositives,
|
|
306
|
+
falsePositiveCount: falsePositives.length,
|
|
307
|
+
lowInfoCount: result.summary.low + result.summary.info,
|
|
308
|
+
positiveObservations: result.positiveObservations,
|
|
309
|
+
scanDuration: `${Math.round(result.scanDuration / 1000)}s`,
|
|
310
|
+
agentCount: result.agentsUsed.length
|
|
311
|
+
};
|
|
312
|
+
const renderedHtml = renderTemplate(templateHtml, data);
|
|
313
|
+
// Generate PDF using Puppeteer
|
|
314
|
+
const browser = await puppeteer_1.default.launch({
|
|
315
|
+
headless: true,
|
|
316
|
+
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
|
317
|
+
});
|
|
318
|
+
const page = await browser.newPage();
|
|
319
|
+
await page.setContent(renderedHtml, { waitUntil: 'networkidle0' });
|
|
320
|
+
await page.pdf({
|
|
321
|
+
path: outputPath,
|
|
322
|
+
format: 'A4',
|
|
323
|
+
margin: { top: '20mm', right: '20mm', bottom: '20mm', left: '20mm' },
|
|
324
|
+
printBackground: true,
|
|
325
|
+
preferCSSPageSize: true
|
|
326
|
+
});
|
|
327
|
+
await browser.close();
|
|
328
|
+
console.log(`PDF report generated: ${outputPath}`);
|
|
329
|
+
}
|
|
330
|
+
async function generateHtmlReport(result, outputPath, falsePositives = []) {
|
|
331
|
+
const templatePath = path.join(__dirname, '..', 'templates', 'report.html');
|
|
332
|
+
const templateHtml = fs.readFileSync(templatePath, 'utf-8');
|
|
333
|
+
const { grade, value } = calculateScore(result);
|
|
334
|
+
const criticalFindings = result.findings.filter(f => f.severity === 'critical');
|
|
335
|
+
const highFindings = result.findings.filter(f => f.severity === 'high');
|
|
336
|
+
const mediumFindings = result.findings.filter(f => f.severity === 'medium');
|
|
337
|
+
const lowFindings = result.findings.filter(f => f.severity === 'low' || f.severity === 'info');
|
|
338
|
+
const data = {
|
|
339
|
+
projectName: result.projectName,
|
|
340
|
+
scanDate: new Date(result.scanDate).toLocaleDateString('en-US', {
|
|
341
|
+
year: 'numeric',
|
|
342
|
+
month: 'long',
|
|
343
|
+
day: 'numeric'
|
|
344
|
+
}),
|
|
345
|
+
scoreGrade: grade,
|
|
346
|
+
scoreValue: value,
|
|
347
|
+
criticalCount: result.summary.critical,
|
|
348
|
+
highCount: result.summary.high,
|
|
349
|
+
mediumCount: result.summary.medium,
|
|
350
|
+
lowCount: result.summary.low,
|
|
351
|
+
infoCount: result.summary.info,
|
|
352
|
+
executiveSummary: generateExecutiveSummary(result),
|
|
353
|
+
criticalFindings,
|
|
354
|
+
highFindings,
|
|
355
|
+
mediumFindings,
|
|
356
|
+
lowFindings,
|
|
357
|
+
falsePositives,
|
|
358
|
+
falsePositiveCount: falsePositives.length,
|
|
359
|
+
lowInfoCount: result.summary.low + result.summary.info,
|
|
360
|
+
positiveObservations: result.positiveObservations,
|
|
361
|
+
scanDuration: `${Math.round(result.scanDuration / 1000)}s`,
|
|
362
|
+
agentCount: result.agentsUsed.length
|
|
363
|
+
};
|
|
364
|
+
const renderedHtml = renderTemplate(templateHtml, data);
|
|
365
|
+
fs.writeFileSync(outputPath, renderedHtml);
|
|
366
|
+
console.log(`HTML report generated: ${outputPath}`);
|
|
367
|
+
}
|
|
368
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/report/generator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;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|
5
|
+
category: string;
|
|
6
|
+
file?: string;
|
|
7
|
+
line?: number;
|
|
8
|
+
description: string;
|
|
9
|
+
code?: string;
|
|
10
|
+
recommendation: string;
|
|
11
|
+
confidence?: number;
|
|
12
|
+
cwe?: string;
|
|
13
|
+
why?: string;
|
|
14
|
+
context?: string;
|
|
15
|
+
checkBefore?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FalsePositive {
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
file?: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ScanReport {
|
|
24
|
+
projectName: string;
|
|
25
|
+
scanDate: string;
|
|
26
|
+
findings: Finding[];
|
|
27
|
+
falsePositives: FalsePositive[];
|
|
28
|
+
positiveObservations: string[];
|
|
29
|
+
scanDuration?: number;
|
|
30
|
+
agentCount?: number;
|
|
31
|
+
}
|
|
32
|
+
export declare function generateHtml(report: ScanReport): string;
|
|
33
|
+
export declare function generatePdf(report: ScanReport, outputPath: string): Promise<void>;
|
|
34
|
+
export declare function generateReport(jsonPath: string, outputPath?: string, format?: 'pdf' | 'html'): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/report/index.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,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