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 CHANGED
@@ -1,96 +1,86 @@
1
- # CoverMe Scanner v3
1
+ # coverme-cli
2
2
 
3
- AI-powered security assessment tool for Claude Code.
4
-
5
- ## Overview
6
-
7
- CoverMe is a slash command for Claude Code that performs comprehensive security assessments and generates professional PDF reports. It uses Claude's intelligence to analyze code like a senior security consultant.
3
+ AI-powered security assessment reports with beautiful PDF output.
8
4
 
9
5
  ## Installation
10
6
 
11
7
  ```bash
12
- cd coverme-v3
13
- npm install
14
- npm run build
15
- npm link # Makes 'coverme' command available globally
8
+ npm install -g coverme-cli
16
9
  ```
17
10
 
18
11
  ## Usage
19
12
 
20
- ### 1. Run Security Scan (in Claude Code)
21
-
22
- Navigate to your project and run:
23
- ```
24
- /coverme
25
- ```
26
-
27
- Claude will:
28
- 1. Discover and read relevant source files
29
- 2. Analyze security patterns and vulnerabilities
30
- 3. Generate a threat model (STRIDE + DREAD)
31
- 4. Create quality recommendations
32
- 5. Save results to `coverme-report.json`
13
+ ### With Claude Code (Recommended)
33
14
 
34
- ### 2. Generate PDF Report
15
+ 1. Install the slash command:
35
16
 
36
17
  ```bash
37
- coverme report coverme-report.json
38
- coverme report coverme-report.json --output my-report.pdf
39
- coverme report coverme-report.json --open # Opens PDF after generation
18
+ coverme-install --global
40
19
  ```
41
20
 
42
- ### 3. Validate JSON
21
+ 2. Open Claude Code in your project:
43
22
 
44
23
  ```bash
45
- coverme validate coverme-report.json
24
+ cd your-project
25
+ claude
46
26
  ```
47
27
 
48
- ## Output Format
28
+ 3. Run the security assessment:
49
29
 
50
- The scan produces a JSON file with:
51
-
52
- - **projectName**: Project identifier
53
- - **scanDate**: ISO timestamp
54
- - **executiveSummary**: Architecture overview and security posture
55
- - **findings**: Array of security findings with DREAD scores
56
- - **threatModel**: STRIDE-based threat analysis
57
- - **qualityReview**: Delete/Merge/Simplify recommendations
58
- - **positiveObservations**: Good security practices found
59
- - **previouslyResolved**: Fixed issues from prior scans
30
+ ```
31
+ /coverme
32
+ ```
60
33
 
61
- ## Finding Quality Standard
34
+ Claude will:
35
+ - Launch 6 parallel security agents
36
+ - Analyze your entire codebase
37
+ - Generate a JSON report
38
+ - Create a professional PDF
62
39
 
63
- Each finding includes:
64
- - **Severity**: critical / high / medium / low / info
65
- - **DPI Priority**: "Today" / "This Sprint" / "Next Sprint" / "Backlog"
66
- - **DREAD Score**: Damage, Reproducibility, Exploitability, Affected Users, Discoverability
67
- - **Specific Location**: File path and line numbers
68
- - **Evidence**: Actual code snippets
69
- - **Remediation**: Concrete fix with code example
40
+ ### Manual Usage
70
41
 
71
- ## Project Structure
42
+ Generate PDF from a JSON report:
72
43
 
44
+ ```bash
45
+ coverme report.json output.pdf
73
46
  ```
74
- coverme-v3/
75
- ├── .claude/
76
- │ └── commands/
77
- │ └── coverme.md # The main prompt (~350 lines)
78
- ├── src/
79
- │ ├── index.ts # CLI entry (~120 lines)
80
- │ ├── types.ts # Type definitions (~200 lines)
81
- │ └── pdf-generator.ts # PDF generation (~700 lines)
82
- ├── package.json
83
- ├── tsconfig.json
84
- └── README.md
47
+
48
+ ## Report Schema
49
+
50
+ ```typescript
51
+ interface SecurityReport {
52
+ project: string;
53
+ date: string;
54
+ branch?: string;
55
+ scope?: string;
56
+
57
+ summary: {
58
+ critical: number;
59
+ high: number;
60
+ medium: number;
61
+ low: number;
62
+ total: number;
63
+ };
64
+
65
+ overallRiskLevel: 'critical' | 'high' | 'medium' | 'low';
66
+ executiveSummary: string;
67
+
68
+ findings: Finding[];
69
+ threatModel?: ThreatModelEntry[];
70
+ positiveObservations?: { title: string; description: string }[];
71
+ remediation?: { p0?: Item[]; p1?: Item[]; p2?: Item[]; p3?: Item[] };
72
+ }
85
73
  ```
86
74
 
87
- Total: ~1,350 lines (vs previous ~5,000 lines)
75
+ See `src/pdf/types.ts` for the complete schema.
88
76
 
89
- ## Requirements
77
+ ## Design
90
78
 
91
- - Node.js 20+
92
- - Claude Code CLI
93
- - PDFKit (installed via npm)
79
+ Minimal, elegant styling inspired by Stripe, Notion, and Airtable:
80
+ - Soft, muted severity colors
81
+ - Clean typography
82
+ - Professional table layouts
83
+ - Subtle borders and spacing
94
84
 
95
85
  ## License
96
86
 
package/bin/coverme.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { generatePDF } from '../dist/index.js';
4
+ import { readFileSync } from 'fs';
5
+ import { resolve } from 'path';
6
+
7
+ const args = process.argv.slice(2);
8
+
9
+ if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
10
+ console.log(`
11
+ coverme - Generate beautiful security assessment PDFs
12
+
13
+ Usage:
14
+ coverme <input.json> [output.pdf]
15
+
16
+ Options:
17
+ -h, --help Show this help message
18
+
19
+ Example:
20
+ coverme report.json security-assessment.pdf
21
+
22
+ The input JSON should follow the SecurityReport schema.
23
+ See https://github.com/your-org/coverme-cli for documentation.
24
+ `);
25
+ process.exit(0);
26
+ }
27
+
28
+ const inputPath = resolve(process.cwd(), args[0]);
29
+ const outputPath = args[1]
30
+ ? resolve(process.cwd(), args[1])
31
+ : inputPath.replace(/\.json$/, '.pdf');
32
+
33
+ try {
34
+ const data = JSON.parse(readFileSync(inputPath, 'utf-8'));
35
+
36
+ console.log(`Generating PDF from ${inputPath}...`);
37
+
38
+ await generatePDF(data, outputPath);
39
+
40
+ console.log(`PDF generated: ${outputPath}`);
41
+ } catch (error) {
42
+ console.error('Error:', error.message);
43
+ process.exit(1);
44
+ }
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { mkdirSync, copyFileSync, existsSync } from 'fs';
4
+ import { join, dirname } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { homedir } from 'os';
7
+
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+
10
+ // Determine target directory
11
+ const targetDir = process.argv[2] === '--global'
12
+ ? join(homedir(), '.claude', 'commands')
13
+ : join(process.cwd(), '.claude', 'commands');
14
+
15
+ // Source file
16
+ const sourceFile = join(__dirname, '..', 'commands', 'coverme.md');
17
+
18
+ // Create directory if needed
19
+ if (!existsSync(targetDir)) {
20
+ mkdirSync(targetDir, { recursive: true });
21
+ console.log(`Created directory: ${targetDir}`);
22
+ }
23
+
24
+ // Copy the command file
25
+ const targetFile = join(targetDir, 'coverme.md');
26
+ copyFileSync(sourceFile, targetFile);
27
+
28
+ console.log(`
29
+ Installed /coverme command to: ${targetFile}
30
+
31
+ Usage:
32
+ Open Claude Code in your project directory and run:
33
+ /coverme
34
+
35
+ This will run a comprehensive security assessment and generate a PDF report.
36
+ `);
@@ -0,0 +1,326 @@
1
+ # Security Assessment Generator v2
2
+
3
+ Run a comprehensive security assessment on this codebase and generate a professional PDF report with deep analysis.
4
+
5
+ ## Instructions
6
+
7
+ You are a senior security architect and penetration tester performing a pre-production security audit. Run 7 parallel security agents to analyze this codebase comprehensively.
8
+
9
+ ### Step 1: Launch Parallel Agents
10
+
11
+ Launch these 7 agents simultaneously using the Task tool:
12
+
13
+ 1. **Executive Summary Agent** (subagent_type: Explore)
14
+ - Understand what the system does
15
+ - Identify the tech stack and architecture
16
+ - Map trust boundaries and critical assets
17
+ - Determine overall risk level
18
+ - Identify the crown jewels (most valuable assets)
19
+
20
+ 2. **Attack Surface Agent** (subagent_type: Explore)
21
+ - Map all entry points (APIs, webhooks, file uploads, CLI args)
22
+ - Identify unauthenticated endpoints
23
+ - Find admin/debug interfaces
24
+ - Check for exposed internal services
25
+ - Document external dependencies and their trust level
26
+
27
+ 3. **Vulnerability Hunter Agent** (subagent_type: Explore)
28
+ - OWASP Top 10 deep dive with CODE EVIDENCE
29
+ - For each finding: extract the EXACT vulnerable code snippet
30
+ - Authentication/authorization bypass paths
31
+ - Injection vulnerabilities (SQL, command, XSS, SSTI)
32
+ - Secrets in code, hardcoded credentials (show exact lines)
33
+ - Insecure deserialization, SSRF, XXE
34
+ - Rate limiting gaps, brute force opportunities
35
+
36
+ 4. **Attack Chain Analyst Agent** (subagent_type: Explore)
37
+ - Identify how vulnerabilities COMBINE for greater impact
38
+ - Map realistic attack scenarios (entry -> pivot -> objective)
39
+ - Calculate blast radius for each chain
40
+ - Example: "Unauthenticated API + hardcoded secret = full DB access"
41
+ - Prioritize chains by likelihood and impact
42
+
43
+ 5. **Business Logic Agent** (subagent_type: Explore)
44
+ - Race conditions in critical flows (payments, credits, locks)
45
+ - Workflow bypass opportunities (skip steps, replay)
46
+ - Credit/billing manipulation vectors
47
+ - Data validation gaps at business boundaries
48
+ - PII handling and data residency violations
49
+ - Privilege escalation paths
50
+
51
+ 6. **Infrastructure Agent** (subagent_type: Explore)
52
+ - Docker/Kubernetes security (securityContext, network policies)
53
+ - CI/CD pipeline security gates (or lack thereof)
54
+ - Secrets management (env vars, mounted secrets, hardcoded)
55
+ - Cloud configuration (IAM, S3 buckets, security groups)
56
+ - Database security (encryption, access controls)
57
+ - Dependency vulnerabilities (npm audit, CVEs)
58
+
59
+ 7. **Compliance & Impact Agent** (subagent_type: Explore)
60
+ - Map findings to compliance frameworks (SOC2, PCI-DSS, GDPR, HIPAA)
61
+ - Calculate business impact for each critical finding
62
+ - Estimate financial exposure ranges
63
+ - Identify SLA/availability risks
64
+ - Determine data breach notification requirements
65
+
66
+ ### Step 2: Deep Dive on Findings
67
+
68
+ For EVERY critical and high finding, ensure you have:
69
+
70
+ 1. **Code Evidence** - The EXACT vulnerable code snippet:
71
+ ```
72
+ "codeEvidence": [{
73
+ "file": "src/auth/login.js",
74
+ "startLine": 45,
75
+ "endLine": 52,
76
+ "code": "const user = await db.query(`SELECT * FROM users WHERE id = ${req.params.id}`);",
77
+ "annotation": "User input directly interpolated into SQL query"
78
+ }]
79
+ ```
80
+
81
+ 2. **Exploitability Assessment**:
82
+ ```
83
+ "exploitability": {
84
+ "skillLevel": "novice", // novice/intermediate/expert
85
+ "accessRequired": "network", // network/adjacent/local/physical
86
+ "authRequired": "none", // none/low/high
87
+ "userInteraction": "none", // none/required
88
+ "hasPublicExploit": true, // Known PoC exists?
89
+ "exploitMaturity": "weaponized", // theoretical/poc/weaponized
90
+ "automatable": true // Can be mass-exploited?
91
+ }
92
+ ```
93
+
94
+ 3. **Blast Radius**:
95
+ ```
96
+ "blastRadius": {
97
+ "affectedUsers": "all", // none/single/subset/all
98
+ "affectedData": ["PII", "credentials", "financial"],
99
+ "affectedServices": ["auth", "payments"],
100
+ "cascadeRisk": true, // Leads to further compromise?
101
+ "containment": "system" // isolated/component/system/infrastructure
102
+ }
103
+ ```
104
+
105
+ 4. **Business Impact**:
106
+ ```
107
+ "businessImpact": {
108
+ "confidentiality": "high",
109
+ "integrity": "high",
110
+ "availability": "low",
111
+ "financialExposure": "$100k-$1M potential fraud",
112
+ "complianceViolations": ["PCI-DSS 6.5.1", "SOC2 CC6.1"],
113
+ "reputationalRisk": "high",
114
+ "slaImpact": "99.9% SLA at risk"
115
+ }
116
+ ```
117
+
118
+ 5. **Proof of Concept** (safe, non-destructive):
119
+ ```
120
+ "proofOfConcept": "curl -X POST /api/admin/users -H 'X-Admin: true' -d '{\"role\":\"admin\"}'"
121
+ ```
122
+
123
+ ### Step 3: Build Attack Chains
124
+
125
+ Identify 2-5 realistic attack chains that combine multiple vulnerabilities:
126
+
127
+ ```json
128
+ "attackChains": [
129
+ {
130
+ "id": "AC-01",
131
+ "name": "Credential Theft to Full Infrastructure Compromise",
132
+ "description": "Attacker chains unauthenticated endpoint access with hardcoded secrets to gain full system control",
133
+ "likelihood": "high",
134
+ "impact": "critical",
135
+ "steps": [
136
+ { "order": 1, "findingId": "HIGH-02", "action": "Access unauthenticated /enclave/register endpoint", "outcome": "Register malicious enclave with attacker-controlled keys" },
137
+ { "order": 2, "findingId": "HIGH-01", "action": "Use leaked tracker API key from Helm values", "outcome": "Gain access to usage analytics and user activity" },
138
+ { "order": 3, "findingId": "CRIT-01", "action": "Pivot using AWS credentials from .env", "outcome": "Full AWS account access, S3 data exfiltration" }
139
+ ],
140
+ "mitigationStrategy": "Breaking any link stops the chain. Priority: rotate AWS credentials immediately."
141
+ }
142
+ ]
143
+ ```
144
+
145
+ ### Step 4: Compile Results
146
+
147
+ After all agents complete, compile their findings into a JSON file with this enhanced schema:
148
+
149
+ ```json
150
+ {
151
+ "project": "Project Name",
152
+ "date": "YYYY-MM-DD",
153
+ "branch": "branch-name",
154
+ "scope": "X files, ~Y lines",
155
+ "methodology": "7 parallel security agents with attack chain analysis",
156
+
157
+ "summary": {
158
+ "critical": 0,
159
+ "high": 0,
160
+ "medium": 0,
161
+ "low": 0,
162
+ "total": 0
163
+ },
164
+
165
+ "overallRiskLevel": "critical|high|medium|low",
166
+ "executiveSummary": "2-3 paragraphs: what the system does, key findings, recommended actions...",
167
+
168
+ "topPriorities": [
169
+ { "finding": "Description", "severity": "critical", "action": "Immediate action required" }
170
+ ],
171
+
172
+ "attackChains": [
173
+ {
174
+ "id": "AC-01",
175
+ "name": "Chain name",
176
+ "description": "How vulnerabilities combine",
177
+ "likelihood": "high",
178
+ "impact": "critical",
179
+ "steps": [
180
+ { "order": 1, "findingId": "CRIT-01", "action": "What attacker does", "outcome": "What they achieve" }
181
+ ],
182
+ "mitigationStrategy": "How to break the chain"
183
+ }
184
+ ],
185
+
186
+ "riskMatrix": [
187
+ { "category": "Authentication", "currentRisk": "high", "residualRisk": "low", "trend": "stable" },
188
+ { "category": "Data Protection", "currentRisk": "medium", "residualRisk": "low", "trend": "improving" }
189
+ ],
190
+
191
+ "architecture": {
192
+ "overview": "System description...",
193
+ "components": [
194
+ { "name": "Component", "technology": "Tech", "description": "Purpose" }
195
+ ],
196
+ "trustBoundaries": [
197
+ { "id": "TB-01", "boundary": "Internet/DMZ", "trustLevel": "untrusted", "description": "Public API surface" }
198
+ ]
199
+ },
200
+
201
+ "network": {
202
+ "diagram": "ASCII diagram...",
203
+ "ports": [
204
+ { "port": 443, "protocol": "HTTPS", "component": "API", "binding": "0.0.0.0", "purpose": "Public API" }
205
+ ],
206
+ "externalDeps": [
207
+ { "service": "Stripe", "endpoint": "api.stripe.com", "auth": "API key", "risk": "PCI scope" }
208
+ ]
209
+ },
210
+
211
+ "findings": [
212
+ {
213
+ "id": "CRIT-01",
214
+ "title": "Finding title",
215
+ "severity": "critical",
216
+ "file": "path/to/file.js",
217
+ "line": 123,
218
+ "issue": "What we found...",
219
+ "why": "Why it matters...",
220
+ "fix": "How to fix...",
221
+ "status": "open",
222
+ "dreadScore": 8.5,
223
+ "cwe": "CWE-89",
224
+ "cvssScore": 9.1,
225
+ "cvssVector": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N",
226
+ "codeEvidence": [
227
+ {
228
+ "file": "src/db/query.js",
229
+ "startLine": 45,
230
+ "endLine": 48,
231
+ "code": "db.query(`SELECT * FROM users WHERE id = ${userId}`)",
232
+ "annotation": "Unsanitized user input in SQL query"
233
+ }
234
+ ],
235
+ "exploitability": {
236
+ "skillLevel": "novice",
237
+ "accessRequired": "network",
238
+ "authRequired": "none",
239
+ "userInteraction": "none",
240
+ "hasPublicExploit": true,
241
+ "exploitMaturity": "weaponized",
242
+ "automatable": true
243
+ },
244
+ "blastRadius": {
245
+ "affectedUsers": "all",
246
+ "affectedData": ["PII", "credentials"],
247
+ "affectedServices": ["database", "auth"],
248
+ "cascadeRisk": true,
249
+ "containment": "system"
250
+ },
251
+ "businessImpact": {
252
+ "confidentiality": "high",
253
+ "integrity": "high",
254
+ "availability": "none",
255
+ "financialExposure": "$500k-$5M breach costs",
256
+ "complianceViolations": ["GDPR Art 32", "SOC2 CC6.1"],
257
+ "reputationalRisk": "high"
258
+ },
259
+ "proofOfConcept": "curl '/api/users/1 OR 1=1--'",
260
+ "relatedFindings": ["HIGH-02", "HIGH-03"],
261
+ "attackChainPosition": "entry",
262
+ "references": ["https://owasp.org/Top10/A03_2021-Injection/"]
263
+ }
264
+ ],
265
+
266
+ "threatModel": [
267
+ {
268
+ "id": "T-01",
269
+ "severity": "high",
270
+ "dread": 6.5,
271
+ "status": "open",
272
+ "finding": "STRIDE threat description"
273
+ }
274
+ ],
275
+
276
+ "positiveObservations": [
277
+ { "title": "Good Practice", "description": "What they did right..." }
278
+ ],
279
+
280
+ "complianceMapping": [
281
+ {
282
+ "framework": "SOC2",
283
+ "controls": [
284
+ { "controlId": "CC6.1", "name": "Logical Access", "status": "partial", "relatedFindings": ["HIGH-02"] }
285
+ ]
286
+ }
287
+ ],
288
+
289
+ "remediation": {
290
+ "p0": [{ "action": "Do this NOW", "finding": "CRIT-01", "owner": "Security" }],
291
+ "p1": [{ "action": "Do this week", "finding": "HIGH-01", "owner": "Backend" }],
292
+ "p2": [],
293
+ "p3": []
294
+ }
295
+ }
296
+ ```
297
+
298
+ ### Step 5: Generate PDF
299
+
300
+ Save the JSON to `security-report.json` in the project root, then run:
301
+
302
+ ```bash
303
+ npx coverme-cli security-report.json security-assessment-$(date +%Y-%m-%d).pdf
304
+ ```
305
+
306
+ ### Quality Checklist
307
+
308
+ Before generating the PDF, verify:
309
+ - [ ] Every CRITICAL/HIGH finding has codeEvidence with actual code
310
+ - [ ] Every CRITICAL/HIGH finding has exploitability assessment
311
+ - [ ] Every CRITICAL/HIGH finding has blastRadius defined
312
+ - [ ] At least 2 attack chains are documented
313
+ - [ ] Top priorities match the most impactful attack chains
314
+ - [ ] Proof of concepts are safe and non-destructive
315
+ - [ ] CWE IDs are accurate for vulnerability types
316
+ - [ ] Compliance violations are specific (e.g., "PCI-DSS 6.5.1" not just "PCI-DSS")
317
+
318
+ ### Output
319
+
320
+ The final deliverable is:
321
+ 1. `security-report.json` - Enhanced findings data with attack chains
322
+ 2. `security-assessment-YYYY-MM-DD.pdf` - Professional PDF report
323
+
324
+ ---
325
+
326
+ Now begin the security assessment. Launch all 7 agents in parallel.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=index.d.ts.map
1
+ export { generatePDF, PDFGenerator } from './pdf/generator.js';
2
+ export type { SecurityReport, Finding, Severity } from './pdf/types.js';
3
+ export { colors, fonts, spacing, layout } from './pdf/styles.js';