-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
296 lines (275 loc) · 6.88 KB
/
Copy pathtypes.ts
File metadata and controls
296 lines (275 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
import React from 'react';
export enum EngineType {
DEVDNA = 'DevDNA',
BUGPREDICTOR = 'BugPredictor',
ARCHGUARD = 'ArchGuard',
CLOUDCOST = 'CloudCost',
DATALINEAGE = 'DataLineage',
THREATHUNTER = 'ThreatHunter',
SECUREVAULT = 'SecureVault',
PENTEST = 'PenTest',
DASHBOARD = 'Dashboard',
ROCKETCHAT = "ROCKETCHAT"
}
export interface MetricCardProps {
title: string;
value: string | number;
change?: string;
isPositive?: boolean;
icon: React.ElementType;
engine: EngineType;
}
export interface ChatMessage {
id: string;
role: 'user' | 'model';
text: string;
timestamp: Date;
}
export interface BugAlert {
id: string;
file: string;
line: number;
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM';
message: string;
pattern: string;
confidence?: number; // 0-100 prediction confidence
fixSuggestion?: string; // AI-generated fix
similarBugs?: number; // Count of similar patterns
estimatedImpact?: 'High' | 'Medium' | 'Low';
}
export interface CostItem {
name: string;
current: number;
optimized: number;
category?: string; // Compute, Storage, Network, etc.
trend?: 'increasing' | 'stable' | 'decreasing';
optimizationTips?: string[];
}
export interface Decision {
id: string;
date: string;
title: string;
type: 'Performance' | 'Reliability' | 'Security';
author: string;
impact?: 'High' | 'Medium' | 'Low';
filesAffected?: number;
}
export interface HotSpot {
file: string;
changeFrequency: number;
contributors: number;
lastChanged: string;
riskLevel: 'High' | 'Medium' | 'Low';
}
export interface DeveloperMetric {
name: string;
commits: number;
linesAdded: number;
linesDeleted: number;
filesChanged: number;
expertise: string[]; // File types they work on most
}
export interface LineageNode {
id: string;
group: number; // 1: DB, 2: API, 3: Service, 4: UI
label: string;
}
export interface LineageLink {
source: string;
target: string;
value: number;
}
export interface ArchitectureViolation {
id: string;
file: string;
line: number;
rule: string;
message: string;
violation: string;
suggestion: string;
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM';
}
export interface SecurityThreat {
id: string;
title: string;
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
category: 'OWASP' | 'CWE' | 'CVE' | 'Custom';
owaspId?: string; // e.g., 'A01:2021'
cweId?: string; // e.g., 'CWE-79'
description: string;
affectedFiles: string[];
exploitability: number; // 1-10
impact: number; // 1-10
mitigation: string;
references: string[];
}
export interface SecretLeak {
id: string;
file: string;
line: number;
type: 'API_KEY' | 'PASSWORD' | 'TOKEN' | 'PRIVATE_KEY' | 'DATABASE_URL' | 'AWS_CREDENTIALS' | 'JWT_SECRET';
pattern: string;
severity: 'CRITICAL' | 'HIGH';
value: string; // Masked
recommendation: string;
}
export interface PenTestFinding {
id: string;
testType: 'SQL_INJECTION' | 'XSS' | 'CSRF' | 'AUTH_BYPASS' | 'PATH_TRAVERSAL' | 'XXE' | 'SSRF' | 'IDOR';
endpoint: string;
method: string;
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW';
vulnerable: boolean;
payload?: string;
proof: string;
remediation: string;
}
export interface ComplianceIssue {
standard: 'OWASP' | 'GDPR' | 'HIPAA' | 'PCI-DSS' | 'SOC2' | 'ISO27001';
requirement: string;
status: 'PASS' | 'FAIL' | 'WARNING';
description: string;
affectedAreas: string[];
remediation: string;
}
export interface AnalysisResult {
repoName: string;
healthScore: number;
bugs: BugAlert[];
costs: CostItem[];
decisions: Decision[];
lineageNodes: LineageNode[];
lineageLinks: LineageLink[];
architectureViolations: ArchitectureViolation[];
summary: string;
// Enhanced metrics
hotSpots?: HotSpot[];
developers?: DeveloperMetric[];
complexity?: {
average: number;
high: number; // Files with high complexity
maintainabilityIndex: number; // 0-100
};
security?: {
score: number; // 0-100
vulnerabilities: number;
criticalIssues: string[];
};
performance?: {
bottlenecks: string[];
optimizationOpportunities: number;
};
techDebt?: {
score: number; // 0-100, lower is better
estimatedHours: number;
topIssues: string[];
};
// Security-focused metrics
threats?: SecurityThreat[];
secrets?: SecretLeak[];
pentestFindings?: PenTestFinding[];
compliance?: ComplianceIssue[];
securityPosture?: {
overallScore: number; // 0-100
threatLevel: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
vulnerabilityCount: number;
criticalVulnerabilities: number;
encryptionScore: number; // 0-100
authenticationScore: number; // 0-100
dataProtectionScore: number; // 0-100
};
// Repository file structure
repositoryFiles?: string[];
categorizedFiles?: {
source: string[];
styles: string[];
markup: string[];
config: string[];
documentation: string[];
other: string[];
};
// === 7 CORE CYBER TECHNIQUES ===
// Technique 3: SCA (Software Composition Analysis)
scaFindings?: {
dependencies: Record<string, string>;
devDependencies: Record<string, string>;
vulnerablePackages: number;
totalPackages: number;
recommendation: string;
};
// Technique 4: OSINT & Reconnaissance
osintFindings?: {
repositoryProfile: {
stars: number;
forks: number;
openIssues: number;
age: number;
lastUpdate: string;
primaryLanguage: string;
reputationScore: number;
};
exposedInformation: Array<{
type: string;
location: string;
value: string;
severity: string;
}>;
technologyStack: string[];
contributorInsights: Array<{
username: string;
commits: number;
profileUrl: string;
trustScore: string;
}>;
};
// Technique 5: Dynamic Analysis & Behavioral Patterns
behavioralAnalysis?: {
suspiciousPatterns: any[];
networkActivity: Array<{
file: string;
pattern: string;
occurrences: number;
severity: string;
}>;
fileSystemAccess: Array<{
file: string;
operation: string;
count: number;
}>;
processManipulation: any[];
};
// Technique 6: Historical & Behavioral Analysis
historicalAnalysis?: {
suspiciousCommits: Array<{
commit: string;
reason: string;
author: string;
date: string;
}>;
rapidChanges: any[];
authorAnomalies: Array<{
author: string;
commits: number;
percentage: number;
risk: string;
}>;
commitPatterns: {
uniqueAuthors: number;
totalCommits: number;
avgCommitsPerAuthor: number;
recentActivity: number;
};
};
// Technique 7: Malware Analysis & Threat Detection
malwareIndicators?: Array<{
id: string;
file: string;
line: number;
type: string;
severity: 'CRITICAL' | 'HIGH' | 'MEDIUM';
description: string;
codeSnippet: string;
threatLevel: number;
recommendation: string;
}>;
}