/** * @fileoverview Security Dashboard - Integrated security reporting and visualization * @module @nahisaho/musubix-security/analyzers/dashboard/security-dashboard * @trace DES-SEC3-DASH-001, REQ-SEC3-DASH-001 */ import type { Vulnerability, Severity } from '../../types/vulnerability.js'; /** * Dashboard-specific scan result (simplified for dashboard reporting) */ export interface DashboardScanResult { scannedAt: Date; filesScanned: number; vulnerabilities: Vulnerability[]; summary: { critical: number; high: number; medium: number; low: number; info: number; total: number; }; } /** * Dashboard configuration */ export interface DashboardConfig { /** Project name */ projectName: string; /** Report format */ format?: 'json' | 'html' | 'markdown'; /** Include trend data */ includeTrends?: boolean; /** Include recommendations */ includeRecommendations?: boolean; /** Custom branding */ branding?: DashboardBranding; } /** * Custom branding options */ export interface DashboardBranding { logo?: string; title?: string; colors?: { critical?: string; high?: string; medium?: string; low?: string; info?: string; }; } /** * Security metrics */ export interface SecurityMetrics { /** Total vulnerabilities found */ totalVulnerabilities: number; /** Breakdown by severity */ bySeverity: Record; /** Breakdown by type */ byType: Record; /** Breakdown by file/component */ byComponent: Record; /** OWASP Top 10 coverage */ owaspCoverage: OWASPCoverage[]; /** CWE distribution */ cweDistribution: CWEDistribution[]; /** Overall security score (0-100) */ securityScore: number; /** Risk level */ riskLevel: 'critical' | 'high' | 'medium' | 'low' | 'minimal'; } /** * OWASP Top 10 coverage */ export interface OWASPCoverage { id: string; name: string; count: number; percentage: number; } /** * CWE distribution */ export interface CWEDistribution { cwe: string; name: string; count: number; percentage: number; } /** * Trend data point */ export interface TrendDataPoint { timestamp: Date; totalVulnerabilities: number; critical: number; high: number; medium: number; low: number; securityScore: number; } /** * Security trend */ export interface SecurityTrend { period: 'day' | 'week' | 'month'; dataPoints: TrendDataPoint[]; improvement: number; direction: 'improving' | 'degrading' | 'stable'; } /** * Top vulnerability */ export interface TopVulnerability { type: string; count: number; severity: Severity; cwes: string[]; recommendation: string; } /** * Component risk */ export interface ComponentRisk { component: string; vulnerabilityCount: number; criticalCount: number; highCount: number; riskScore: number; } /** * Security recommendation */ export interface SecurityRecommendation { priority: 'critical' | 'high' | 'medium' | 'low'; category: string; title: string; description: string; impact: string; effort: 'low' | 'medium' | 'high'; affectedCount: number; } /** * Dashboard report */ export interface DashboardReport { /** Generation timestamp */ generatedAt: Date; /** Project name */ projectName: string; /** Report period */ period?: { start: Date; end: Date; }; /** Executive summary */ summary: ExecutiveSummary; /** Security metrics */ metrics: SecurityMetrics; /** Top vulnerabilities */ topVulnerabilities: TopVulnerability[]; /** Component risks */ componentRisks: ComponentRisk[]; /** Trends (if enabled) */ trends?: SecurityTrend; /** Recommendations (if enabled) */ recommendations?: SecurityRecommendation[]; /** Raw vulnerabilities */ vulnerabilities: Vulnerability[]; /** Scan results summary */ scanSummary: ScanSummary; } /** * Executive summary */ export interface ExecutiveSummary { status: 'critical' | 'warning' | 'attention' | 'good' | 'excellent'; statusMessage: string; highlights: string[]; keyFindings: string[]; immediateActions: string[]; } /** * Scan summary */ export interface ScanSummary { totalScans: number; filesScanned: number; lastScanDate: Date; scanDuration?: number; coverage: number; } /** * Security Dashboard * @trace DES-SEC3-DASH-001 */ export declare class SecurityDashboard { private config; private vulnerabilities; private scanResults; private trendHistory; constructor(config: DashboardConfig); /** * Add scan results to dashboard * @trace REQ-SEC3-DASH-001 */ addScanResult(result: DashboardScanResult): void; /** * Add vulnerabilities directly */ addVulnerabilities(vulnerabilities: Vulnerability[]): void; /** * Clear all data */ clear(): void; /** * Generate dashboard report */ generateReport(): DashboardReport; /** * Export report in specified format */ exportReport(format?: 'json' | 'html' | 'markdown'): string; /** * Calculate security metrics */ private calculateMetrics; /** * Calculate security score */ private calculateSecurityScore; /** * Determine risk level */ private determineRiskLevel; /** * Get top vulnerabilities */ private getTopVulnerabilities; /** * Calculate component risks */ private calculateComponentRisks; /** * Generate executive summary */ private generateExecutiveSummary; /** * Generate scan summary */ private generateScanSummary; /** * Calculate trends */ private calculateTrends; /** * Generate recommendations */ private generateRecommendations; /** * Convert severity to numeric value */ private severityValue; /** * Convert severity to priority */ private severityToPriority; /** * Export to HTML format */ private toHTML; /** * Export to Markdown format */ private toMarkdown; /** * Get status color */ private getStatusColor; } /** * Create security dashboard instance */ export declare function createSecurityDashboard(config: DashboardConfig): SecurityDashboard; //# sourceMappingURL=security-dashboard.d.ts.map