@vibecheckai/cli 3.5.0 → 3.5.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/bin/registry.js +214 -237
- package/bin/runners/cli-utils.js +33 -2
- package/bin/runners/context/analyzer.js +52 -1
- package/bin/runners/context/generators/cursor.js +2 -49
- package/bin/runners/context/git-context.js +3 -1
- package/bin/runners/context/team-conventions.js +33 -7
- package/bin/runners/lib/analysis-core.js +25 -5
- package/bin/runners/lib/analyzers.js +431 -481
- package/bin/runners/lib/default-config.js +127 -0
- package/bin/runners/lib/doctor/modules/security.js +3 -1
- package/bin/runners/lib/engine/ast-cache.js +210 -0
- package/bin/runners/lib/engine/auth-extractor.js +211 -0
- package/bin/runners/lib/engine/billing-extractor.js +112 -0
- package/bin/runners/lib/engine/enforcement-extractor.js +100 -0
- package/bin/runners/lib/engine/env-extractor.js +207 -0
- package/bin/runners/lib/engine/express-extractor.js +208 -0
- package/bin/runners/lib/engine/extractors.js +849 -0
- package/bin/runners/lib/engine/index.js +207 -0
- package/bin/runners/lib/engine/repo-index.js +514 -0
- package/bin/runners/lib/engine/types.js +124 -0
- package/bin/runners/lib/engines/accessibility-engine.js +18 -218
- package/bin/runners/lib/engines/api-consistency-engine.js +30 -335
- package/bin/runners/lib/engines/cross-file-analysis-engine.js +27 -292
- package/bin/runners/lib/engines/empty-catch-engine.js +17 -127
- package/bin/runners/lib/engines/mock-data-engine.js +10 -53
- package/bin/runners/lib/engines/performance-issues-engine.js +36 -176
- package/bin/runners/lib/engines/security-vulnerabilities-engine.js +54 -382
- package/bin/runners/lib/engines/type-aware-engine.js +39 -263
- package/bin/runners/lib/engines/vibecheck-engines/index.js +13 -122
- package/bin/runners/lib/engines/vibecheck-engines/lib/ast-cache.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/code-quality-engine.js +291 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/console-logs-engine.js +83 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/dead-code-engine.js +198 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/deprecated-api-engine.js +275 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/empty-catch-engine.js +167 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/file-filter.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/hardcoded-secrets-engine.js +73 -373
- package/bin/runners/lib/engines/vibecheck-engines/lib/mock-data-engine.js +140 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/parallel-processor.js +164 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/performance-issues-engine.js +234 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/type-aware-engine.js +217 -0
- package/bin/runners/lib/engines/vibecheck-engines/lib/unsafe-regex-engine.js +78 -0
- package/bin/runners/lib/entitlements-v2.js +73 -97
- package/bin/runners/lib/error-handler.js +44 -3
- package/bin/runners/lib/error-messages.js +289 -0
- package/bin/runners/lib/evidence-pack.js +7 -1
- package/bin/runners/lib/finding-id.js +69 -0
- package/bin/runners/lib/finding-sorter.js +89 -0
- package/bin/runners/lib/html-proof-report.js +700 -350
- package/bin/runners/lib/missions/plan.js +6 -46
- package/bin/runners/lib/missions/templates.js +0 -232
- package/bin/runners/lib/next-action.js +560 -0
- package/bin/runners/lib/prerequisites.js +149 -0
- package/bin/runners/lib/route-detection.js +137 -68
- package/bin/runners/lib/scan-output.js +91 -76
- package/bin/runners/lib/scan-runner.js +135 -0
- package/bin/runners/lib/schemas/ajv-validator.js +464 -0
- package/bin/runners/lib/schemas/error-envelope.schema.json +105 -0
- package/bin/runners/lib/schemas/finding-v3.schema.json +151 -0
- package/bin/runners/lib/schemas/report-artifact.schema.json +120 -0
- package/bin/runners/lib/schemas/run-request.schema.json +108 -0
- package/bin/runners/lib/schemas/validator.js +27 -0
- package/bin/runners/lib/schemas/verdict.schema.json +140 -0
- package/bin/runners/lib/ship-output-enterprise.js +23 -23
- package/bin/runners/lib/ship-output.js +75 -31
- package/bin/runners/lib/terminal-ui.js +6 -113
- package/bin/runners/lib/truth.js +351 -10
- package/bin/runners/lib/unified-cli-output.js +430 -603
- package/bin/runners/lib/unified-output.js +13 -9
- package/bin/runners/runAIAgent.js +10 -5
- package/bin/runners/runAgent.js +0 -3
- package/bin/runners/runAllowlist.js +389 -0
- package/bin/runners/runApprove.js +0 -33
- package/bin/runners/runAuth.js +73 -45
- package/bin/runners/runCheckpoint.js +51 -11
- package/bin/runners/runClassify.js +85 -21
- package/bin/runners/runContext.js +0 -3
- package/bin/runners/runDoctor.js +41 -28
- package/bin/runners/runEvidencePack.js +362 -0
- package/bin/runners/runFirewall.js +0 -3
- package/bin/runners/runFirewallHook.js +0 -3
- package/bin/runners/runFix.js +66 -76
- package/bin/runners/runGuard.js +18 -411
- package/bin/runners/runInit.js +113 -30
- package/bin/runners/runLabs.js +424 -0
- package/bin/runners/runMcp.js +19 -25
- package/bin/runners/runPolish.js +64 -240
- package/bin/runners/runPromptFirewall.js +12 -5
- package/bin/runners/runProve.js +57 -22
- package/bin/runners/runQuickstart.js +531 -0
- package/bin/runners/runReality.js +59 -68
- package/bin/runners/runReport.js +38 -33
- package/bin/runners/runRuntime.js +8 -5
- package/bin/runners/runScan.js +1413 -190
- package/bin/runners/runShip.js +113 -719
- package/bin/runners/runTruth.js +0 -3
- package/bin/runners/runValidate.js +13 -9
- package/bin/runners/runWatch.js +23 -14
- package/bin/scan.js +6 -1
- package/bin/vibecheck.js +204 -185
- package/mcp-server/deprecation-middleware.js +282 -0
- package/mcp-server/handlers/index.ts +15 -0
- package/mcp-server/handlers/tool-handler.ts +554 -0
- package/mcp-server/index-v1.js +698 -0
- package/mcp-server/index.js +210 -238
- package/mcp-server/lib/cache-wrapper.cjs +383 -0
- package/mcp-server/lib/error-envelope.js +138 -0
- package/mcp-server/lib/executor.ts +499 -0
- package/mcp-server/lib/index.ts +19 -0
- package/mcp-server/lib/rate-limiter.js +166 -0
- package/mcp-server/lib/sandbox.test.ts +519 -0
- package/mcp-server/lib/sandbox.ts +395 -0
- package/mcp-server/lib/types.ts +267 -0
- package/mcp-server/package.json +12 -3
- package/mcp-server/registry/tool-registry.js +794 -0
- package/mcp-server/registry/tools.json +605 -0
- package/mcp-server/registry.test.ts +334 -0
- package/mcp-server/tests/tier-gating.test.js +297 -0
- package/mcp-server/tier-auth.js +378 -45
- package/mcp-server/tools-v3.js +353 -442
- package/mcp-server/tsconfig.json +37 -0
- package/mcp-server/vibecheck-2.0-tools.js +14 -1
- package/package.json +1 -1
- package/bin/runners/lib/agent-firewall/learning/learning-engine.js +0 -849
- package/bin/runners/lib/audit-logger.js +0 -532
- package/bin/runners/lib/authority/authorities/architecture.js +0 -364
- package/bin/runners/lib/authority/authorities/compliance.js +0 -341
- package/bin/runners/lib/authority/authorities/human.js +0 -343
- package/bin/runners/lib/authority/authorities/quality.js +0 -420
- package/bin/runners/lib/authority/authorities/security.js +0 -228
- package/bin/runners/lib/authority/index.js +0 -293
- package/bin/runners/lib/bundle/bundle-intelligence.js +0 -846
- package/bin/runners/lib/cli-charts.js +0 -368
- package/bin/runners/lib/cli-config-display.js +0 -405
- package/bin/runners/lib/cli-demo.js +0 -275
- package/bin/runners/lib/cli-errors.js +0 -438
- package/bin/runners/lib/cli-help-formatter.js +0 -439
- package/bin/runners/lib/cli-interactive-menu.js +0 -509
- package/bin/runners/lib/cli-prompts.js +0 -441
- package/bin/runners/lib/cli-scan-cards.js +0 -362
- package/bin/runners/lib/compliance-reporter.js +0 -710
- package/bin/runners/lib/conductor/index.js +0 -671
- package/bin/runners/lib/easy/README.md +0 -123
- package/bin/runners/lib/easy/index.js +0 -140
- package/bin/runners/lib/easy/interactive-wizard.js +0 -788
- package/bin/runners/lib/easy/one-click-firewall.js +0 -564
- package/bin/runners/lib/easy/zero-config-reality.js +0 -714
- package/bin/runners/lib/engines/async-patterns-engine.js +0 -444
- package/bin/runners/lib/engines/bundle-size-engine.js +0 -433
- package/bin/runners/lib/engines/confidence-scoring.js +0 -276
- package/bin/runners/lib/engines/context-detection.js +0 -264
- package/bin/runners/lib/engines/database-patterns-engine.js +0 -429
- package/bin/runners/lib/engines/duplicate-code-engine.js +0 -354
- package/bin/runners/lib/engines/env-variables-engine.js +0 -458
- package/bin/runners/lib/engines/error-handling-engine.js +0 -437
- package/bin/runners/lib/engines/false-positive-prevention.js +0 -630
- package/bin/runners/lib/engines/framework-adapters/index.js +0 -607
- package/bin/runners/lib/engines/framework-detection.js +0 -508
- package/bin/runners/lib/engines/import-order-engine.js +0 -429
- package/bin/runners/lib/engines/naming-conventions-engine.js +0 -544
- package/bin/runners/lib/engines/noise-reduction-engine.js +0 -452
- package/bin/runners/lib/engines/orchestrator.js +0 -334
- package/bin/runners/lib/engines/react-patterns-engine.js +0 -457
- package/bin/runners/lib/engines/vibecheck-engines/lib/ai-hallucination-engine.js +0 -806
- package/bin/runners/lib/engines/vibecheck-engines/lib/smart-fix-engine.js +0 -577
- package/bin/runners/lib/engines/vibecheck-engines/lib/vibe-score-engine.js +0 -543
- package/bin/runners/lib/engines/vibecheck-engines.js +0 -514
- package/bin/runners/lib/enhanced-features/index.js +0 -305
- package/bin/runners/lib/enhanced-output.js +0 -631
- package/bin/runners/lib/enterprise.js +0 -300
- package/bin/runners/lib/firewall/command-validator.js +0 -351
- package/bin/runners/lib/firewall/config.js +0 -341
- package/bin/runners/lib/firewall/content-validator.js +0 -519
- package/bin/runners/lib/firewall/index.js +0 -101
- package/bin/runners/lib/firewall/path-validator.js +0 -256
- package/bin/runners/lib/intelligence/cross-repo-intelligence.js +0 -817
- package/bin/runners/lib/mcp-utils.js +0 -425
- package/bin/runners/lib/output/index.js +0 -1022
- package/bin/runners/lib/policy-engine.js +0 -652
- package/bin/runners/lib/polish/autofix/accessibility-fixes.js +0 -333
- package/bin/runners/lib/polish/autofix/async-handlers.js +0 -273
- package/bin/runners/lib/polish/autofix/dead-code.js +0 -280
- package/bin/runners/lib/polish/autofix/imports-optimizer.js +0 -344
- package/bin/runners/lib/polish/autofix/index.js +0 -200
- package/bin/runners/lib/polish/autofix/remove-consoles.js +0 -209
- package/bin/runners/lib/polish/autofix/strengthen-types.js +0 -245
- package/bin/runners/lib/polish/backend-checks.js +0 -148
- package/bin/runners/lib/polish/documentation-checks.js +0 -111
- package/bin/runners/lib/polish/frontend-checks.js +0 -168
- package/bin/runners/lib/polish/index.js +0 -71
- package/bin/runners/lib/polish/infrastructure-checks.js +0 -131
- package/bin/runners/lib/polish/library-detection.js +0 -175
- package/bin/runners/lib/polish/performance-checks.js +0 -100
- package/bin/runners/lib/polish/security-checks.js +0 -148
- package/bin/runners/lib/polish/utils.js +0 -203
- package/bin/runners/lib/prompt-builder.js +0 -540
- package/bin/runners/lib/proof-certificate.js +0 -634
- package/bin/runners/lib/reality/accessibility-audit.js +0 -946
- package/bin/runners/lib/reality/api-contract-validator.js +0 -1012
- package/bin/runners/lib/reality/chaos-engineering.js +0 -1084
- package/bin/runners/lib/reality/performance-tracker.js +0 -1077
- package/bin/runners/lib/reality/scenario-generator.js +0 -1404
- package/bin/runners/lib/reality/visual-regression.js +0 -852
- package/bin/runners/lib/reality-profiler.js +0 -717
- package/bin/runners/lib/replay/flight-recorder-viewer.js +0 -1160
- package/bin/runners/lib/review/ai-code-review.js +0 -832
- package/bin/runners/lib/rules/custom-rule-engine.js +0 -985
- package/bin/runners/lib/sbom-generator.js +0 -641
- package/bin/runners/lib/scan-output-enhanced.js +0 -512
- package/bin/runners/lib/security/owasp-scanner.js +0 -939
- package/bin/runners/lib/validators/contract-validator.js +0 -283
- package/bin/runners/lib/validators/dead-export-detector.js +0 -279
- package/bin/runners/lib/validators/dep-audit.js +0 -245
- package/bin/runners/lib/validators/env-validator.js +0 -319
- package/bin/runners/lib/validators/index.js +0 -120
- package/bin/runners/lib/validators/license-checker.js +0 -252
- package/bin/runners/lib/validators/route-validator.js +0 -290
- package/bin/runners/runAuthority.js +0 -528
- package/bin/runners/runConductor.js +0 -772
- package/bin/runners/runContainer.js +0 -366
- package/bin/runners/runEasy.js +0 -410
- package/bin/runners/runIaC.js +0 -372
- package/bin/runners/runVibe.js +0 -791
- package/mcp-server/tools.js +0 -495
|
@@ -1,710 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enterprise Compliance Reporter
|
|
3
|
-
*
|
|
4
|
-
* Generates compliance reports for:
|
|
5
|
-
* - SOC 2 Type II
|
|
6
|
-
* - HIPAA
|
|
7
|
-
* - PCI-DSS
|
|
8
|
-
* - GDPR
|
|
9
|
-
* - ISO 27001
|
|
10
|
-
* - NIST CSF
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
"use strict";
|
|
14
|
-
|
|
15
|
-
const crypto = require("crypto");
|
|
16
|
-
const path = require("path");
|
|
17
|
-
const fs = require("fs");
|
|
18
|
-
|
|
19
|
-
// Terminal UI
|
|
20
|
-
let terminalUI;
|
|
21
|
-
try {
|
|
22
|
-
terminalUI = require("./terminal-ui");
|
|
23
|
-
} catch {
|
|
24
|
-
terminalUI = {
|
|
25
|
-
c: { reset: "", bold: "", dim: "", red: "", yellow: "", green: "", cyan: "" },
|
|
26
|
-
rgb: () => "",
|
|
27
|
-
icons: { check: "✓", cross: "✗", warning: "⚠", info: "ℹ" },
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const { c, rgb, icons } = terminalUI;
|
|
32
|
-
|
|
33
|
-
// Colors
|
|
34
|
-
const colors = {
|
|
35
|
-
critical: rgb(255, 80, 80),
|
|
36
|
-
high: rgb(255, 150, 50),
|
|
37
|
-
medium: rgb(255, 200, 0),
|
|
38
|
-
low: rgb(100, 200, 255),
|
|
39
|
-
info: rgb(150, 150, 150),
|
|
40
|
-
success: rgb(0, 255, 150),
|
|
41
|
-
accent: rgb(0, 200, 255),
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* SOC 2 Trust Service Criteria mapping
|
|
46
|
-
*/
|
|
47
|
-
const SOC2_CRITERIA = {
|
|
48
|
-
"CC1": {
|
|
49
|
-
name: "Control Environment",
|
|
50
|
-
description: "COSO Principle 1-5: Control environment components",
|
|
51
|
-
controls: [
|
|
52
|
-
{ id: "CC1.1", name: "Integrity and ethical values", checks: ["no-hardcoded-secrets", "audit-logging"] },
|
|
53
|
-
{ id: "CC1.2", name: "Board independence", checks: ["access-control"] },
|
|
54
|
-
{ id: "CC1.3", name: "Management structure", checks: ["role-separation"] },
|
|
55
|
-
{ id: "CC1.4", name: "Commitment to competence", checks: ["code-review"] },
|
|
56
|
-
{ id: "CC1.5", name: "Accountability", checks: ["audit-trail"] },
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
"CC2": {
|
|
60
|
-
name: "Communication and Information",
|
|
61
|
-
description: "COSO Principle 13-15: Information and communication",
|
|
62
|
-
controls: [
|
|
63
|
-
{ id: "CC2.1", name: "Information quality", checks: ["data-validation", "input-sanitization"] },
|
|
64
|
-
{ id: "CC2.2", name: "Internal communication", checks: ["error-handling", "logging"] },
|
|
65
|
-
{ id: "CC2.3", name: "External communication", checks: ["api-documentation"] },
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
"CC3": {
|
|
69
|
-
name: "Risk Assessment",
|
|
70
|
-
description: "COSO Principle 6-9: Risk assessment",
|
|
71
|
-
controls: [
|
|
72
|
-
{ id: "CC3.1", name: "Risk identification", checks: ["vulnerability-scanning", "dependency-audit"] },
|
|
73
|
-
{ id: "CC3.2", name: "Fraud risk", checks: ["authentication", "authorization"] },
|
|
74
|
-
{ id: "CC3.3", name: "Change management", checks: ["version-control", "deployment-gates"] },
|
|
75
|
-
{ id: "CC3.4", name: "Risk response", checks: ["incident-response", "error-handling"] },
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
"CC4": {
|
|
79
|
-
name: "Monitoring Activities",
|
|
80
|
-
description: "COSO Principle 16-17: Monitoring",
|
|
81
|
-
controls: [
|
|
82
|
-
{ id: "CC4.1", name: "Ongoing monitoring", checks: ["logging", "metrics", "alerting"] },
|
|
83
|
-
{ id: "CC4.2", name: "Deficiency evaluation", checks: ["issue-tracking", "remediation"] },
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
|
-
"CC5": {
|
|
87
|
-
name: "Control Activities",
|
|
88
|
-
description: "COSO Principle 10-12: Control activities",
|
|
89
|
-
controls: [
|
|
90
|
-
{ id: "CC5.1", name: "Control selection", checks: ["security-controls", "access-control"] },
|
|
91
|
-
{ id: "CC5.2", name: "Technology controls", checks: ["encryption", "secure-communication"] },
|
|
92
|
-
{ id: "CC5.3", name: "Policy deployment", checks: ["policy-enforcement", "configuration-management"] },
|
|
93
|
-
],
|
|
94
|
-
},
|
|
95
|
-
"CC6": {
|
|
96
|
-
name: "Logical and Physical Access Controls",
|
|
97
|
-
description: "Access control requirements",
|
|
98
|
-
controls: [
|
|
99
|
-
{ id: "CC6.1", name: "Logical access security", checks: ["authentication", "mfa", "session-management"] },
|
|
100
|
-
{ id: "CC6.2", name: "Access provisioning", checks: ["role-based-access", "least-privilege"] },
|
|
101
|
-
{ id: "CC6.3", name: "Access removal", checks: ["session-invalidation", "token-expiry"] },
|
|
102
|
-
{ id: "CC6.6", name: "Transmission protection", checks: ["tls", "encryption-in-transit"] },
|
|
103
|
-
{ id: "CC6.7", name: "Data disposal", checks: ["secure-delete", "data-retention"] },
|
|
104
|
-
],
|
|
105
|
-
},
|
|
106
|
-
"CC7": {
|
|
107
|
-
name: "System Operations",
|
|
108
|
-
description: "System operations requirements",
|
|
109
|
-
controls: [
|
|
110
|
-
{ id: "CC7.1", name: "Vulnerability management", checks: ["vulnerability-scanning", "patching"] },
|
|
111
|
-
{ id: "CC7.2", name: "Security monitoring", checks: ["intrusion-detection", "anomaly-detection"] },
|
|
112
|
-
{ id: "CC7.3", name: "Incident response", checks: ["incident-response", "breach-notification"] },
|
|
113
|
-
{ id: "CC7.4", name: "Recovery", checks: ["backup", "disaster-recovery"] },
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
"CC8": {
|
|
117
|
-
name: "Change Management",
|
|
118
|
-
description: "Change management requirements",
|
|
119
|
-
controls: [
|
|
120
|
-
{ id: "CC8.1", name: "Change authorization", checks: ["code-review", "approval-workflow"] },
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
"CC9": {
|
|
124
|
-
name: "Risk Mitigation",
|
|
125
|
-
description: "Risk mitigation requirements",
|
|
126
|
-
controls: [
|
|
127
|
-
{ id: "CC9.1", name: "Risk identification", checks: ["risk-assessment", "threat-modeling"] },
|
|
128
|
-
{ id: "CC9.2", name: "Vendor management", checks: ["dependency-audit", "sbom"] },
|
|
129
|
-
],
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* HIPAA Security Rule mapping
|
|
135
|
-
*/
|
|
136
|
-
const HIPAA_CONTROLS = {
|
|
137
|
-
"Administrative Safeguards": {
|
|
138
|
-
"164.308(a)(1)": {
|
|
139
|
-
name: "Security Management Process",
|
|
140
|
-
checks: ["risk-analysis", "risk-management", "sanction-policy", "information-review"],
|
|
141
|
-
},
|
|
142
|
-
"164.308(a)(3)": {
|
|
143
|
-
name: "Workforce Security",
|
|
144
|
-
checks: ["authorization-supervision", "workforce-clearance", "termination-procedures"],
|
|
145
|
-
},
|
|
146
|
-
"164.308(a)(4)": {
|
|
147
|
-
name: "Information Access Management",
|
|
148
|
-
checks: ["access-authorization", "access-establishment", "access-modification"],
|
|
149
|
-
},
|
|
150
|
-
"164.308(a)(5)": {
|
|
151
|
-
name: "Security Awareness and Training",
|
|
152
|
-
checks: ["security-reminders", "malware-protection", "login-monitoring", "password-management"],
|
|
153
|
-
},
|
|
154
|
-
"164.308(a)(6)": {
|
|
155
|
-
name: "Security Incident Procedures",
|
|
156
|
-
checks: ["incident-response", "incident-reporting"],
|
|
157
|
-
},
|
|
158
|
-
"164.308(a)(7)": {
|
|
159
|
-
name: "Contingency Plan",
|
|
160
|
-
checks: ["data-backup", "disaster-recovery", "emergency-mode", "testing-revision"],
|
|
161
|
-
},
|
|
162
|
-
"164.308(a)(8)": {
|
|
163
|
-
name: "Evaluation",
|
|
164
|
-
checks: ["security-evaluation"],
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
"Physical Safeguards": {
|
|
168
|
-
"164.310(a)": {
|
|
169
|
-
name: "Facility Access Controls",
|
|
170
|
-
checks: ["facility-security", "access-control", "access-logs"],
|
|
171
|
-
},
|
|
172
|
-
"164.310(b)": {
|
|
173
|
-
name: "Workstation Use",
|
|
174
|
-
checks: ["workstation-policy"],
|
|
175
|
-
},
|
|
176
|
-
"164.310(c)": {
|
|
177
|
-
name: "Workstation Security",
|
|
178
|
-
checks: ["workstation-security"],
|
|
179
|
-
},
|
|
180
|
-
"164.310(d)": {
|
|
181
|
-
name: "Device and Media Controls",
|
|
182
|
-
checks: ["disposal", "media-reuse", "accountability", "data-backup"],
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
"Technical Safeguards": {
|
|
186
|
-
"164.312(a)": {
|
|
187
|
-
name: "Access Control",
|
|
188
|
-
checks: ["unique-user-id", "emergency-access", "automatic-logoff", "encryption-decryption"],
|
|
189
|
-
},
|
|
190
|
-
"164.312(b)": {
|
|
191
|
-
name: "Audit Controls",
|
|
192
|
-
checks: ["audit-logging", "audit-trail"],
|
|
193
|
-
},
|
|
194
|
-
"164.312(c)": {
|
|
195
|
-
name: "Integrity",
|
|
196
|
-
checks: ["data-integrity", "authentication-mechanism"],
|
|
197
|
-
},
|
|
198
|
-
"164.312(d)": {
|
|
199
|
-
name: "Person or Entity Authentication",
|
|
200
|
-
checks: ["authentication"],
|
|
201
|
-
},
|
|
202
|
-
"164.312(e)": {
|
|
203
|
-
name: "Transmission Security",
|
|
204
|
-
checks: ["integrity-controls", "encryption-in-transit"],
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* PCI-DSS Requirements mapping
|
|
211
|
-
*/
|
|
212
|
-
const PCI_DSS_REQUIREMENTS = {
|
|
213
|
-
"Requirement 1": {
|
|
214
|
-
name: "Install and maintain network security controls",
|
|
215
|
-
controls: [
|
|
216
|
-
{ id: "1.1", name: "Network security policies", checks: ["firewall-config", "network-segmentation"] },
|
|
217
|
-
{ id: "1.2", name: "Network security controls", checks: ["ingress-egress", "traffic-filtering"] },
|
|
218
|
-
{ id: "1.3", name: "Network access restriction", checks: ["dmz", "private-networks"] },
|
|
219
|
-
],
|
|
220
|
-
},
|
|
221
|
-
"Requirement 2": {
|
|
222
|
-
name: "Apply secure configurations",
|
|
223
|
-
controls: [
|
|
224
|
-
{ id: "2.1", name: "Change vendor defaults", checks: ["no-default-credentials", "secure-config"] },
|
|
225
|
-
{ id: "2.2", name: "System hardening", checks: ["system-hardening", "service-minimization"] },
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
"Requirement 3": {
|
|
229
|
-
name: "Protect stored account data",
|
|
230
|
-
controls: [
|
|
231
|
-
{ id: "3.1", name: "Data retention policy", checks: ["data-retention", "secure-delete"] },
|
|
232
|
-
{ id: "3.2", name: "Sensitive authentication data", checks: ["no-pan-storage", "no-cvv-storage"] },
|
|
233
|
-
{ id: "3.4", name: "PAN rendering unreadable", checks: ["encryption-at-rest", "tokenization", "hashing"] },
|
|
234
|
-
{ id: "3.5", name: "Key management", checks: ["key-management", "key-rotation"] },
|
|
235
|
-
],
|
|
236
|
-
},
|
|
237
|
-
"Requirement 4": {
|
|
238
|
-
name: "Protect cardholder data with strong cryptography",
|
|
239
|
-
controls: [
|
|
240
|
-
{ id: "4.1", name: "Strong cryptography for transmission", checks: ["tls", "encryption-in-transit"] },
|
|
241
|
-
{ id: "4.2", name: "No PAN via end-user messaging", checks: ["no-pan-messaging"] },
|
|
242
|
-
],
|
|
243
|
-
},
|
|
244
|
-
"Requirement 5": {
|
|
245
|
-
name: "Protect systems with anti-malware",
|
|
246
|
-
controls: [
|
|
247
|
-
{ id: "5.1", name: "Anti-malware solutions", checks: ["malware-protection"] },
|
|
248
|
-
{ id: "5.2", name: "Anti-malware updates", checks: ["security-updates"] },
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
"Requirement 6": {
|
|
252
|
-
name: "Develop and maintain secure systems",
|
|
253
|
-
controls: [
|
|
254
|
-
{ id: "6.1", name: "Security vulnerability identification", checks: ["vulnerability-scanning", "cve-monitoring"] },
|
|
255
|
-
{ id: "6.2", name: "Secure development", checks: ["secure-coding", "code-review"] },
|
|
256
|
-
{ id: "6.3", name: "Security in software development", checks: ["sdlc-security", "security-testing"] },
|
|
257
|
-
{ id: "6.4", name: "Change management", checks: ["change-control", "deployment-gates"] },
|
|
258
|
-
{ id: "6.5", name: "Common vulnerabilities", checks: ["injection-prevention", "xss-prevention", "csrf-prevention"] },
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
"Requirement 7": {
|
|
262
|
-
name: "Restrict access by business need-to-know",
|
|
263
|
-
controls: [
|
|
264
|
-
{ id: "7.1", name: "Need-to-know access", checks: ["least-privilege", "role-based-access"] },
|
|
265
|
-
{ id: "7.2", name: "Access control systems", checks: ["access-control", "authorization"] },
|
|
266
|
-
],
|
|
267
|
-
},
|
|
268
|
-
"Requirement 8": {
|
|
269
|
-
name: "Identify users and authenticate access",
|
|
270
|
-
controls: [
|
|
271
|
-
{ id: "8.1", name: "User identification", checks: ["unique-user-id", "user-lifecycle"] },
|
|
272
|
-
{ id: "8.2", name: "User authentication", checks: ["strong-authentication", "mfa"] },
|
|
273
|
-
{ id: "8.3", name: "Strong authentication", checks: ["password-policy", "password-complexity"] },
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
"Requirement 9": {
|
|
277
|
-
name: "Restrict physical access",
|
|
278
|
-
controls: [
|
|
279
|
-
{ id: "9.1", name: "Physical access controls", checks: ["physical-access"] },
|
|
280
|
-
],
|
|
281
|
-
},
|
|
282
|
-
"Requirement 10": {
|
|
283
|
-
name: "Log and monitor access",
|
|
284
|
-
controls: [
|
|
285
|
-
{ id: "10.1", name: "Audit trails", checks: ["audit-logging", "audit-trail"] },
|
|
286
|
-
{ id: "10.2", name: "Audit events", checks: ["security-events", "access-logging"] },
|
|
287
|
-
{ id: "10.3", name: "Audit record content", checks: ["log-content", "timestamps"] },
|
|
288
|
-
{ id: "10.4", name: "Time synchronization", checks: ["ntp", "time-sync"] },
|
|
289
|
-
{ id: "10.5", name: "Audit log protection", checks: ["log-integrity", "log-retention"] },
|
|
290
|
-
{ id: "10.6", name: "Audit log review", checks: ["log-review", "anomaly-detection"] },
|
|
291
|
-
],
|
|
292
|
-
},
|
|
293
|
-
"Requirement 11": {
|
|
294
|
-
name: "Test security regularly",
|
|
295
|
-
controls: [
|
|
296
|
-
{ id: "11.1", name: "Wireless access point detection", checks: ["wireless-scanning"] },
|
|
297
|
-
{ id: "11.2", name: "Vulnerability scanning", checks: ["vulnerability-scanning", "external-scanning"] },
|
|
298
|
-
{ id: "11.3", name: "Penetration testing", checks: ["penetration-testing"] },
|
|
299
|
-
{ id: "11.4", name: "Intrusion detection", checks: ["ids", "ips"] },
|
|
300
|
-
{ id: "11.5", name: "Change detection", checks: ["file-integrity-monitoring"] },
|
|
301
|
-
],
|
|
302
|
-
},
|
|
303
|
-
"Requirement 12": {
|
|
304
|
-
name: "Support information security with policies",
|
|
305
|
-
controls: [
|
|
306
|
-
{ id: "12.1", name: "Information security policy", checks: ["security-policy"] },
|
|
307
|
-
{ id: "12.3", name: "Usage policies", checks: ["acceptable-use"] },
|
|
308
|
-
{ id: "12.6", name: "Security awareness", checks: ["security-training"] },
|
|
309
|
-
{ id: "12.8", name: "Service provider management", checks: ["vendor-management", "sbom"] },
|
|
310
|
-
{ id: "12.10", name: "Incident response plan", checks: ["incident-response"] },
|
|
311
|
-
],
|
|
312
|
-
},
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Map findings to compliance controls
|
|
317
|
-
*/
|
|
318
|
-
function mapFindingsToControls(findings, framework) {
|
|
319
|
-
const mapping = {
|
|
320
|
-
"no-hardcoded-secrets": ["hardcoded", "secret", "credential", "password", "api-key"],
|
|
321
|
-
"audit-logging": ["audit", "logging", "trail"],
|
|
322
|
-
"authentication": ["auth", "login", "session"],
|
|
323
|
-
"authorization": ["permission", "access", "role"],
|
|
324
|
-
"encryption": ["encrypt", "cipher", "tls", "ssl"],
|
|
325
|
-
"input-sanitization": ["inject", "xss", "sanitize", "validate"],
|
|
326
|
-
"error-handling": ["error", "catch", "exception"],
|
|
327
|
-
"vulnerability-scanning": ["vulnerab", "cve", "security"],
|
|
328
|
-
"dependency-audit": ["dependency", "package", "npm", "supply-chain"],
|
|
329
|
-
"code-review": ["review", "approve"],
|
|
330
|
-
"data-validation": ["validat", "schema"],
|
|
331
|
-
"access-control": ["access", "control", "rbac"],
|
|
332
|
-
"logging": ["log", "console"],
|
|
333
|
-
"secure-communication": ["tls", "https", "encrypt"],
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
const controlResults = {};
|
|
337
|
-
|
|
338
|
-
for (const [control, patterns] of Object.entries(mapping)) {
|
|
339
|
-
const related = findings.filter(f => {
|
|
340
|
-
const category = (f.category || "").toLowerCase();
|
|
341
|
-
const type = (f.type || "").toLowerCase();
|
|
342
|
-
return patterns.some(p => category.includes(p) || type.includes(p));
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
controlResults[control] = {
|
|
346
|
-
issues: related.length,
|
|
347
|
-
critical: related.filter(f => f.severity === "critical" || f.type === "critical").length,
|
|
348
|
-
findings: related,
|
|
349
|
-
status: related.length === 0 ? "pass" :
|
|
350
|
-
related.some(f => f.severity === "critical") ? "fail" : "warning",
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return controlResults;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Generate SOC 2 compliance report
|
|
359
|
-
*/
|
|
360
|
-
function generateSOC2Report(findings, options = {}) {
|
|
361
|
-
const controlResults = mapFindingsToControls(findings, "soc2");
|
|
362
|
-
const report = {
|
|
363
|
-
framework: "SOC 2 Type II",
|
|
364
|
-
generatedAt: new Date().toISOString(),
|
|
365
|
-
projectName: options.projectName || "Unknown Project",
|
|
366
|
-
auditPeriod: options.auditPeriod || "Point-in-time",
|
|
367
|
-
criteria: {},
|
|
368
|
-
summary: {
|
|
369
|
-
totalControls: 0,
|
|
370
|
-
passed: 0,
|
|
371
|
-
warnings: 0,
|
|
372
|
-
failed: 0,
|
|
373
|
-
notApplicable: 0,
|
|
374
|
-
},
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
for (const [criteriaId, criteria] of Object.entries(SOC2_CRITERIA)) {
|
|
378
|
-
report.criteria[criteriaId] = {
|
|
379
|
-
name: criteria.name,
|
|
380
|
-
description: criteria.description,
|
|
381
|
-
controls: [],
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
for (const control of criteria.controls) {
|
|
385
|
-
const controlStatus = {
|
|
386
|
-
id: control.id,
|
|
387
|
-
name: control.name,
|
|
388
|
-
checks: [],
|
|
389
|
-
status: "pass",
|
|
390
|
-
};
|
|
391
|
-
|
|
392
|
-
for (const check of control.checks) {
|
|
393
|
-
const result = controlResults[check] || { status: "not-implemented", issues: 0 };
|
|
394
|
-
controlStatus.checks.push({
|
|
395
|
-
name: check,
|
|
396
|
-
status: result.status,
|
|
397
|
-
issues: result.issues,
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
if (result.status === "fail") controlStatus.status = "fail";
|
|
401
|
-
else if (result.status === "warning" && controlStatus.status !== "fail") {
|
|
402
|
-
controlStatus.status = "warning";
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
report.criteria[criteriaId].controls.push(controlStatus);
|
|
407
|
-
report.summary.totalControls++;
|
|
408
|
-
|
|
409
|
-
if (controlStatus.status === "pass") report.summary.passed++;
|
|
410
|
-
else if (controlStatus.status === "warning") report.summary.warnings++;
|
|
411
|
-
else if (controlStatus.status === "fail") report.summary.failed++;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
report.summary.complianceScore = Math.round(
|
|
416
|
-
((report.summary.passed + report.summary.warnings * 0.5) / report.summary.totalControls) * 100
|
|
417
|
-
);
|
|
418
|
-
|
|
419
|
-
return report;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Generate HIPAA compliance report
|
|
424
|
-
*/
|
|
425
|
-
function generateHIPAAReport(findings, options = {}) {
|
|
426
|
-
const controlResults = mapFindingsToControls(findings, "hipaa");
|
|
427
|
-
const report = {
|
|
428
|
-
framework: "HIPAA Security Rule",
|
|
429
|
-
generatedAt: new Date().toISOString(),
|
|
430
|
-
projectName: options.projectName || "Unknown Project",
|
|
431
|
-
safeguards: {},
|
|
432
|
-
summary: {
|
|
433
|
-
totalControls: 0,
|
|
434
|
-
passed: 0,
|
|
435
|
-
warnings: 0,
|
|
436
|
-
failed: 0,
|
|
437
|
-
addressable: 0,
|
|
438
|
-
required: 0,
|
|
439
|
-
},
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
for (const [safeguardType, requirements] of Object.entries(HIPAA_CONTROLS)) {
|
|
443
|
-
report.safeguards[safeguardType] = [];
|
|
444
|
-
|
|
445
|
-
for (const [reqId, requirement] of Object.entries(requirements)) {
|
|
446
|
-
const reqStatus = {
|
|
447
|
-
id: reqId,
|
|
448
|
-
name: requirement.name,
|
|
449
|
-
checks: [],
|
|
450
|
-
status: "pass",
|
|
451
|
-
};
|
|
452
|
-
|
|
453
|
-
for (const check of requirement.checks) {
|
|
454
|
-
const result = controlResults[check] || { status: "not-implemented", issues: 0 };
|
|
455
|
-
reqStatus.checks.push({
|
|
456
|
-
name: check,
|
|
457
|
-
status: result.status,
|
|
458
|
-
issues: result.issues,
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
if (result.status === "fail") reqStatus.status = "fail";
|
|
462
|
-
else if (result.status === "warning" && reqStatus.status !== "fail") {
|
|
463
|
-
reqStatus.status = "warning";
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
report.safeguards[safeguardType].push(reqStatus);
|
|
468
|
-
report.summary.totalControls++;
|
|
469
|
-
|
|
470
|
-
if (reqStatus.status === "pass") report.summary.passed++;
|
|
471
|
-
else if (reqStatus.status === "warning") report.summary.warnings++;
|
|
472
|
-
else if (reqStatus.status === "fail") report.summary.failed++;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
report.summary.complianceScore = Math.round(
|
|
477
|
-
((report.summary.passed + report.summary.warnings * 0.5) / report.summary.totalControls) * 100
|
|
478
|
-
);
|
|
479
|
-
|
|
480
|
-
return report;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Generate PCI-DSS compliance report
|
|
485
|
-
*/
|
|
486
|
-
function generatePCIDSSReport(findings, options = {}) {
|
|
487
|
-
const controlResults = mapFindingsToControls(findings, "pci-dss");
|
|
488
|
-
const report = {
|
|
489
|
-
framework: "PCI-DSS v4.0",
|
|
490
|
-
generatedAt: new Date().toISOString(),
|
|
491
|
-
projectName: options.projectName || "Unknown Project",
|
|
492
|
-
requirements: {},
|
|
493
|
-
summary: {
|
|
494
|
-
totalControls: 0,
|
|
495
|
-
passed: 0,
|
|
496
|
-
warnings: 0,
|
|
497
|
-
failed: 0,
|
|
498
|
-
compensating: 0,
|
|
499
|
-
},
|
|
500
|
-
};
|
|
501
|
-
|
|
502
|
-
for (const [reqId, requirement] of Object.entries(PCI_DSS_REQUIREMENTS)) {
|
|
503
|
-
report.requirements[reqId] = {
|
|
504
|
-
name: requirement.name,
|
|
505
|
-
controls: [],
|
|
506
|
-
status: "pass",
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
for (const control of requirement.controls) {
|
|
510
|
-
const controlStatus = {
|
|
511
|
-
id: control.id,
|
|
512
|
-
name: control.name,
|
|
513
|
-
checks: [],
|
|
514
|
-
status: "pass",
|
|
515
|
-
};
|
|
516
|
-
|
|
517
|
-
for (const check of control.checks) {
|
|
518
|
-
const result = controlResults[check] || { status: "not-implemented", issues: 0 };
|
|
519
|
-
controlStatus.checks.push({
|
|
520
|
-
name: check,
|
|
521
|
-
status: result.status,
|
|
522
|
-
issues: result.issues,
|
|
523
|
-
});
|
|
524
|
-
|
|
525
|
-
if (result.status === "fail") controlStatus.status = "fail";
|
|
526
|
-
else if (result.status === "warning" && controlStatus.status !== "fail") {
|
|
527
|
-
controlStatus.status = "warning";
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
report.requirements[reqId].controls.push(controlStatus);
|
|
532
|
-
report.summary.totalControls++;
|
|
533
|
-
|
|
534
|
-
if (controlStatus.status === "pass") report.summary.passed++;
|
|
535
|
-
else if (controlStatus.status === "warning") report.summary.warnings++;
|
|
536
|
-
else if (controlStatus.status === "fail") report.summary.failed++;
|
|
537
|
-
|
|
538
|
-
if (controlStatus.status === "fail") {
|
|
539
|
-
report.requirements[reqId].status = "fail";
|
|
540
|
-
} else if (controlStatus.status === "warning" && report.requirements[reqId].status !== "fail") {
|
|
541
|
-
report.requirements[reqId].status = "warning";
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
report.summary.complianceScore = Math.round(
|
|
547
|
-
((report.summary.passed + report.summary.warnings * 0.5) / report.summary.totalControls) * 100
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
return report;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Render compliance summary for terminal
|
|
555
|
-
*/
|
|
556
|
-
function renderComplianceSummary(report) {
|
|
557
|
-
const lines = [];
|
|
558
|
-
|
|
559
|
-
lines.push(` ${c.dim}╭${"─".repeat(60)}╮${c.reset}`);
|
|
560
|
-
lines.push(` ${c.dim}│${c.reset} ${colors.accent}${c.bold}📋 ${report.framework} COMPLIANCE REPORT${c.reset}`.padEnd(73) + `${c.dim}│${c.reset}`);
|
|
561
|
-
lines.push(` ${c.dim}├${"─".repeat(60)}┤${c.reset}`);
|
|
562
|
-
|
|
563
|
-
const { summary } = report;
|
|
564
|
-
const scoreColor = summary.complianceScore >= 80 ? colors.success :
|
|
565
|
-
summary.complianceScore >= 60 ? colors.medium : colors.critical;
|
|
566
|
-
|
|
567
|
-
lines.push(` ${c.dim}│${c.reset} Compliance Score: ${scoreColor}${c.bold}${summary.complianceScore}%${c.reset} ${c.dim}│${c.reset}`);
|
|
568
|
-
lines.push(` ${c.dim}├${"─".repeat(60)}┤${c.reset}`);
|
|
569
|
-
|
|
570
|
-
lines.push(` ${c.dim}│${c.reset} ${colors.success}✓${c.reset} Passed: ${String(summary.passed).padStart(3)} ${c.dim}│${c.reset}`);
|
|
571
|
-
lines.push(` ${c.dim}│${c.reset} ${colors.medium}⚠${c.reset} Warnings: ${String(summary.warnings).padStart(3)} ${c.dim}│${c.reset}`);
|
|
572
|
-
lines.push(` ${c.dim}│${c.reset} ${colors.critical}✗${c.reset} Failed: ${String(summary.failed).padStart(3)} ${c.dim}│${c.reset}`);
|
|
573
|
-
lines.push(` ${c.dim}│${c.reset} Total Controls: ${summary.totalControls} ${c.dim}│${c.reset}`);
|
|
574
|
-
lines.push(` ${c.dim}╰${"─".repeat(60)}╯${c.reset}`);
|
|
575
|
-
|
|
576
|
-
return lines.join("\n");
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
/**
|
|
580
|
-
* Export compliance report as PDF-ready HTML
|
|
581
|
-
*/
|
|
582
|
-
function exportComplianceHTML(report) {
|
|
583
|
-
const { framework, summary, generatedAt, projectName } = report;
|
|
584
|
-
const scoreColor = summary.complianceScore >= 80 ? "#22c55e" :
|
|
585
|
-
summary.complianceScore >= 60 ? "#f59e0b" : "#ef4444";
|
|
586
|
-
|
|
587
|
-
let criteriaHTML = "";
|
|
588
|
-
|
|
589
|
-
if (report.criteria) {
|
|
590
|
-
// SOC 2 format
|
|
591
|
-
for (const [id, criteria] of Object.entries(report.criteria)) {
|
|
592
|
-
criteriaHTML += `
|
|
593
|
-
<div class="criteria">
|
|
594
|
-
<h3>${id}: ${criteria.name}</h3>
|
|
595
|
-
<p class="description">${criteria.description}</p>
|
|
596
|
-
<table>
|
|
597
|
-
<thead>
|
|
598
|
-
<tr><th>Control</th><th>Status</th><th>Issues</th></tr>
|
|
599
|
-
</thead>
|
|
600
|
-
<tbody>
|
|
601
|
-
${criteria.controls.map(c => `
|
|
602
|
-
<tr class="${c.status}">
|
|
603
|
-
<td>${c.id}: ${c.name}</td>
|
|
604
|
-
<td class="status">${c.status.toUpperCase()}</td>
|
|
605
|
-
<td>${c.checks.reduce((sum, ch) => sum + ch.issues, 0)}</td>
|
|
606
|
-
</tr>
|
|
607
|
-
`).join("")}
|
|
608
|
-
</tbody>
|
|
609
|
-
</table>
|
|
610
|
-
</div>
|
|
611
|
-
`;
|
|
612
|
-
}
|
|
613
|
-
} else if (report.requirements) {
|
|
614
|
-
// PCI-DSS format
|
|
615
|
-
for (const [id, req] of Object.entries(report.requirements)) {
|
|
616
|
-
criteriaHTML += `
|
|
617
|
-
<div class="criteria">
|
|
618
|
-
<h3>${id}: ${req.name}</h3>
|
|
619
|
-
<table>
|
|
620
|
-
<thead>
|
|
621
|
-
<tr><th>Control</th><th>Status</th><th>Issues</th></tr>
|
|
622
|
-
</thead>
|
|
623
|
-
<tbody>
|
|
624
|
-
${req.controls.map(c => `
|
|
625
|
-
<tr class="${c.status}">
|
|
626
|
-
<td>${c.id}: ${c.name}</td>
|
|
627
|
-
<td class="status">${c.status.toUpperCase()}</td>
|
|
628
|
-
<td>${c.checks.reduce((sum, ch) => sum + ch.issues, 0)}</td>
|
|
629
|
-
</tr>
|
|
630
|
-
`).join("")}
|
|
631
|
-
</tbody>
|
|
632
|
-
</table>
|
|
633
|
-
</div>
|
|
634
|
-
`;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
return `<!DOCTYPE html>
|
|
639
|
-
<html>
|
|
640
|
-
<head>
|
|
641
|
-
<meta charset="utf-8">
|
|
642
|
-
<title>${framework} Compliance Report - ${projectName}</title>
|
|
643
|
-
<style>
|
|
644
|
-
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 1200px; margin: 0 auto; padding: 20px; }
|
|
645
|
-
.header { text-align: center; padding: 40px; background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%); color: white; border-radius: 12px; margin-bottom: 30px; }
|
|
646
|
-
.score { font-size: 72px; font-weight: bold; color: ${scoreColor}; }
|
|
647
|
-
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 30px; }
|
|
648
|
-
.summary-card { padding: 20px; background: #f8fafc; border-radius: 8px; text-align: center; }
|
|
649
|
-
.summary-card.pass { border-left: 4px solid #22c55e; }
|
|
650
|
-
.summary-card.warning { border-left: 4px solid #f59e0b; }
|
|
651
|
-
.summary-card.fail { border-left: 4px solid #ef4444; }
|
|
652
|
-
.criteria { margin-bottom: 30px; }
|
|
653
|
-
.criteria h3 { background: #1e3a5f; color: white; padding: 10px 15px; border-radius: 4px; }
|
|
654
|
-
table { width: 100%; border-collapse: collapse; }
|
|
655
|
-
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
|
|
656
|
-
th { background: #f1f5f9; }
|
|
657
|
-
tr.pass .status { color: #22c55e; }
|
|
658
|
-
tr.warning .status { color: #f59e0b; }
|
|
659
|
-
tr.fail .status { color: #ef4444; font-weight: bold; }
|
|
660
|
-
.footer { text-align: center; padding: 20px; color: #64748b; font-size: 12px; }
|
|
661
|
-
</style>
|
|
662
|
-
</head>
|
|
663
|
-
<body>
|
|
664
|
-
<div class="header">
|
|
665
|
-
<h1>${framework}</h1>
|
|
666
|
-
<h2>Compliance Report</h2>
|
|
667
|
-
<div class="score">${summary.complianceScore}%</div>
|
|
668
|
-
<p>Project: ${projectName} | Generated: ${new Date(generatedAt).toLocaleDateString()}</p>
|
|
669
|
-
</div>
|
|
670
|
-
|
|
671
|
-
<div class="summary">
|
|
672
|
-
<div class="summary-card pass">
|
|
673
|
-
<h3>${summary.passed}</h3>
|
|
674
|
-
<p>Passed</p>
|
|
675
|
-
</div>
|
|
676
|
-
<div class="summary-card warning">
|
|
677
|
-
<h3>${summary.warnings}</h3>
|
|
678
|
-
<p>Warnings</p>
|
|
679
|
-
</div>
|
|
680
|
-
<div class="summary-card fail">
|
|
681
|
-
<h3>${summary.failed}</h3>
|
|
682
|
-
<p>Failed</p>
|
|
683
|
-
</div>
|
|
684
|
-
<div class="summary-card">
|
|
685
|
-
<h3>${summary.totalControls}</h3>
|
|
686
|
-
<p>Total Controls</p>
|
|
687
|
-
</div>
|
|
688
|
-
</div>
|
|
689
|
-
|
|
690
|
-
${criteriaHTML}
|
|
691
|
-
|
|
692
|
-
<div class="footer">
|
|
693
|
-
<p>Generated by VibeCheck Enterprise Compliance Engine</p>
|
|
694
|
-
<p>This report is provided for informational purposes and does not constitute legal or compliance advice.</p>
|
|
695
|
-
</div>
|
|
696
|
-
</body>
|
|
697
|
-
</html>`;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
module.exports = {
|
|
701
|
-
generateSOC2Report,
|
|
702
|
-
generateHIPAAReport,
|
|
703
|
-
generatePCIDSSReport,
|
|
704
|
-
renderComplianceSummary,
|
|
705
|
-
exportComplianceHTML,
|
|
706
|
-
mapFindingsToControls,
|
|
707
|
-
SOC2_CRITERIA,
|
|
708
|
-
HIPAA_CONTROLS,
|
|
709
|
-
PCI_DSS_REQUIREMENTS,
|
|
710
|
-
};
|