coverme-security-scanner 3.0.0 → 3.1.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 +55 -65
- package/bin/coverme.js +44 -0
- package/bin/install-command.js +36 -0
- package/commands/coverme.md +326 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -124
- package/dist/pdf/generator.d.ts +48 -0
- package/dist/pdf/generator.js +1235 -0
- package/dist/pdf/styles.d.ts +84 -0
- package/dist/pdf/styles.js +89 -0
- package/dist/pdf/types.d.ts +203 -0
- package/dist/pdf/types.js +1 -0
- package/package.json +24 -23
- package/.claude/commands/coverme.md +0 -349
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pdf-generator.d.ts +0 -32
- package/dist/pdf-generator.d.ts.map +0 -1
- package/dist/pdf-generator.js +0 -564
- package/dist/pdf-generator.js.map +0 -1
- package/dist/types.d.ts +0 -141
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/src/index.ts +0 -137
- package/src/pdf-generator.ts +0 -684
- package/src/types.ts +0 -204
- package/tsconfig.json +0 -20
package/dist/index.js
CHANGED
|
@@ -1,124 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* CoverMe Scanner v3 - CLI Entry Point
|
|
4
|
-
* Simple CLI: coverme report <json-file>
|
|
5
|
-
*/
|
|
6
|
-
import { Command } from 'commander';
|
|
7
|
-
import { readFileSync, existsSync } from 'fs';
|
|
8
|
-
import { resolve, dirname, basename, extname } from 'path';
|
|
9
|
-
import { PDFGenerator } from './pdf-generator.js';
|
|
10
|
-
const program = new Command();
|
|
11
|
-
program
|
|
12
|
-
.name('coverme')
|
|
13
|
-
.description('CoverMe Security Scanner v3 - Generate PDF reports from scan results')
|
|
14
|
-
.version('3.0.0');
|
|
15
|
-
program
|
|
16
|
-
.command('report <json-file>')
|
|
17
|
-
.description('Generate a PDF report from a JSON scan result')
|
|
18
|
-
.option('-o, --output <path>', 'Output PDF path')
|
|
19
|
-
.option('--open', 'Open PDF after generation')
|
|
20
|
-
.action(async (jsonFile, options) => {
|
|
21
|
-
try {
|
|
22
|
-
const inputPath = resolve(jsonFile);
|
|
23
|
-
if (!existsSync(inputPath)) {
|
|
24
|
-
console.error(`Error: File not found: ${inputPath}`);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
27
|
-
const rawData = readFileSync(inputPath, 'utf-8');
|
|
28
|
-
let data;
|
|
29
|
-
try {
|
|
30
|
-
data = JSON.parse(rawData);
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
console.error('Error: Invalid JSON file');
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
// Validate required fields
|
|
37
|
-
if (!data.projectName || !data.findings) {
|
|
38
|
-
console.error('Error: JSON must contain projectName and findings array');
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
// Determine output path
|
|
42
|
-
const outputPath = options.output
|
|
43
|
-
? resolve(options.output)
|
|
44
|
-
: resolve(dirname(inputPath), `${basename(inputPath, extname(inputPath))}.pdf`);
|
|
45
|
-
console.log(`Generating PDF report for: ${data.projectName}`);
|
|
46
|
-
console.log(`Findings: ${data.findings.length}`);
|
|
47
|
-
const generator = new PDFGenerator();
|
|
48
|
-
await generator.generate(data, outputPath);
|
|
49
|
-
console.log(`Report saved to: ${outputPath}`);
|
|
50
|
-
// Open PDF if requested
|
|
51
|
-
if (options.open) {
|
|
52
|
-
const { exec } = await import('child_process');
|
|
53
|
-
const openCmd = process.platform === 'darwin' ? 'open' :
|
|
54
|
-
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
55
|
-
exec(`${openCmd} "${outputPath}"`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
console.error('Error generating report:', error instanceof Error ? error.message : error);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
program
|
|
64
|
-
.command('validate <json-file>')
|
|
65
|
-
.description('Validate a JSON scan result without generating PDF')
|
|
66
|
-
.action((jsonFile) => {
|
|
67
|
-
try {
|
|
68
|
-
const inputPath = resolve(jsonFile);
|
|
69
|
-
if (!existsSync(inputPath)) {
|
|
70
|
-
console.error(`Error: File not found: ${inputPath}`);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
const rawData = readFileSync(inputPath, 'utf-8');
|
|
74
|
-
const data = JSON.parse(rawData);
|
|
75
|
-
// Validation checks
|
|
76
|
-
const errors = [];
|
|
77
|
-
const warnings = [];
|
|
78
|
-
if (!data.projectName)
|
|
79
|
-
errors.push('Missing projectName');
|
|
80
|
-
if (!data.findings || !Array.isArray(data.findings))
|
|
81
|
-
errors.push('Missing or invalid findings array');
|
|
82
|
-
if (!data.executiveSummary)
|
|
83
|
-
warnings.push('Missing executiveSummary');
|
|
84
|
-
if (!data.threatModel)
|
|
85
|
-
warnings.push('Missing threatModel');
|
|
86
|
-
// Validate findings
|
|
87
|
-
if (data.findings) {
|
|
88
|
-
data.findings.forEach((f, i) => {
|
|
89
|
-
if (!f.title)
|
|
90
|
-
errors.push(`Finding ${i + 1}: missing title`);
|
|
91
|
-
if (!f.severity)
|
|
92
|
-
errors.push(`Finding ${i + 1}: missing severity`);
|
|
93
|
-
if (!f.description)
|
|
94
|
-
warnings.push(`Finding ${i + 1}: missing description`);
|
|
95
|
-
if (!f.dpiPriority)
|
|
96
|
-
warnings.push(`Finding ${i + 1}: missing dpiPriority`);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (errors.length > 0) {
|
|
100
|
-
console.error('Validation FAILED:');
|
|
101
|
-
errors.forEach(e => console.error(` - ${e}`));
|
|
102
|
-
if (warnings.length > 0) {
|
|
103
|
-
console.warn('Warnings:');
|
|
104
|
-
warnings.forEach(w => console.warn(` - ${w}`));
|
|
105
|
-
}
|
|
106
|
-
process.exit(1);
|
|
107
|
-
}
|
|
108
|
-
console.log('Validation PASSED');
|
|
109
|
-
console.log(` Project: ${data.projectName}`);
|
|
110
|
-
console.log(` Findings: ${data.findings.length}`);
|
|
111
|
-
console.log(` Threat Model: ${data.threatModel ? 'Yes' : 'No'}`);
|
|
112
|
-
console.log(` Quality Review: ${data.qualityReview ? 'Yes' : 'No'}`);
|
|
113
|
-
if (warnings.length > 0) {
|
|
114
|
-
console.warn('Warnings:');
|
|
115
|
-
warnings.forEach(w => console.warn(` - ${w}`));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
console.error('Error:', error instanceof Error ? error.message : error);
|
|
120
|
-
process.exit(1);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
program.parse();
|
|
124
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { generatePDF, PDFGenerator } from './pdf/generator.js';
|
|
2
|
+
export { colors, fonts, spacing, layout } from './pdf/styles.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { SecurityReport } from './types.js';
|
|
2
|
+
export declare class PDFGenerator {
|
|
3
|
+
private doc;
|
|
4
|
+
private y;
|
|
5
|
+
private pageCount;
|
|
6
|
+
constructor();
|
|
7
|
+
private newPage;
|
|
8
|
+
generate(report: SecurityReport, outputPath: string): Promise<void>;
|
|
9
|
+
private renderCoverPage;
|
|
10
|
+
private renderSeverityBoxes;
|
|
11
|
+
private renderMetadata;
|
|
12
|
+
private renderTableOfContents;
|
|
13
|
+
private getFindingsSummary;
|
|
14
|
+
private getQualitySummary;
|
|
15
|
+
private getRemediationSummary;
|
|
16
|
+
private renderTocSummaryTable;
|
|
17
|
+
private renderExecutiveSummary;
|
|
18
|
+
private renderArchitecture;
|
|
19
|
+
private renderNetwork;
|
|
20
|
+
private renderAttackChains;
|
|
21
|
+
private renderAttackChain;
|
|
22
|
+
private renderAttackSteps;
|
|
23
|
+
private renderRiskMatrix;
|
|
24
|
+
private getTrendIndicator;
|
|
25
|
+
private renderFindings;
|
|
26
|
+
private renderFinding;
|
|
27
|
+
private renderStructuredFinding;
|
|
28
|
+
private estimateTextHeight;
|
|
29
|
+
private renderCodeEvidence;
|
|
30
|
+
private renderProofOfConcept;
|
|
31
|
+
private renderLegacyFinding;
|
|
32
|
+
private renderThreatModel;
|
|
33
|
+
private renderPositiveObservations;
|
|
34
|
+
private renderRemediation;
|
|
35
|
+
private renderComplianceMapping;
|
|
36
|
+
private renderQualityReview;
|
|
37
|
+
private renderQualityTable;
|
|
38
|
+
private renderResolvedIssues;
|
|
39
|
+
private renderPrivacyAnalysis;
|
|
40
|
+
private renderSummaryPage;
|
|
41
|
+
private getSeveritySummary;
|
|
42
|
+
private sectionTitle;
|
|
43
|
+
private subTitle;
|
|
44
|
+
private renderSimpleTable;
|
|
45
|
+
private checkPageBreak;
|
|
46
|
+
private addPageNumbersAndFooters;
|
|
47
|
+
}
|
|
48
|
+
export declare function generatePDF(report: SecurityReport, outputPath: string): Promise<void>;
|