secure-scan 1.2.4 → 1.2.5
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 +85 -317
- package/aur/.SRCINFO +11 -0
- package/aur/PKGBUILD +28 -0
- package/debian/changelog +10 -0
- package/debian/compat +1 -0
- package/debian/control +16 -0
- package/debian/rules +17 -0
- package/docs/V1.2.1-IA_Performances.md +2 -2
- package/package.json +2 -2
- package/dist/core/engine/index.d.ts +0 -5
- package/dist/core/engine/index.d.ts.map +0 -1
- package/dist/core/engine/index.js +0 -21
- package/dist/core/engine/index.js.map +0 -1
- package/dist/core/engine/ruleEngine.d.ts +0 -46
- package/dist/core/engine/ruleEngine.d.ts.map +0 -1
- package/dist/core/engine/ruleEngine.js +0 -173
- package/dist/core/engine/ruleEngine.js.map +0 -1
- package/dist/core/index.d.ts +0 -8
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -24
- package/dist/core/index.js.map +0 -1
- package/dist/core/scanner/fileScanner.d.ts +0 -31
- package/dist/core/scanner/fileScanner.d.ts.map +0 -1
- package/dist/core/scanner/fileScanner.js +0 -199
- package/dist/core/scanner/fileScanner.js.map +0 -1
- package/dist/core/scanner/index.d.ts +0 -5
- package/dist/core/scanner/index.d.ts.map +0 -1
- package/dist/core/scanner/index.js +0 -21
- package/dist/core/scanner/index.js.map +0 -1
- package/dist/core/scoring/index.d.ts +0 -5
- package/dist/core/scoring/index.d.ts.map +0 -1
- package/dist/core/scoring/index.js +0 -21
- package/dist/core/scoring/index.js.map +0 -1
- package/dist/core/scoring/riskScoring.d.ts +0 -49
- package/dist/core/scoring/riskScoring.d.ts.map +0 -1
- package/dist/core/scoring/riskScoring.js +0 -180
- package/dist/core/scoring/riskScoring.js.map +0 -1
- package/dist/core/securityScanner.d.ts +0 -47
- package/dist/core/securityScanner.d.ts.map +0 -1
- package/dist/core/securityScanner.js +0 -298
- package/dist/core/securityScanner.js.map +0 -1
- package/src/analyzers/javascript/PROMPT_JS_ANALYZER.md +0 -267
- package/src/rules/malware/INFO.md +0 -287
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Risk Scoring Engine
|
|
3
|
-
* Calculates risk scores and severity levels for scan results
|
|
4
|
-
*/
|
|
5
|
-
import { Finding, Severity, FindingCategory } from '../../types';
|
|
6
|
-
/**
|
|
7
|
-
* Risk Scoring Engine Class
|
|
8
|
-
*/
|
|
9
|
-
export declare class RiskScoringEngine {
|
|
10
|
-
/**
|
|
11
|
-
* Calculate overall risk score for findings
|
|
12
|
-
*/
|
|
13
|
-
calculateRiskScore(findings: Finding[], totalFiles: number): number;
|
|
14
|
-
/**
|
|
15
|
-
* Determine risk level from score
|
|
16
|
-
*/
|
|
17
|
-
getRiskLevel(score: number): 'safe' | 'low' | 'medium' | 'high' | 'critical';
|
|
18
|
-
/**
|
|
19
|
-
* Get severity distribution
|
|
20
|
-
*/
|
|
21
|
-
getSeverityDistribution(findings: Finding[]): Record<Severity, number>;
|
|
22
|
-
/**
|
|
23
|
-
* Get category distribution
|
|
24
|
-
*/
|
|
25
|
-
getCategoryDistribution(findings: Finding[]): Record<FindingCategory, number>;
|
|
26
|
-
/**
|
|
27
|
-
* Get top affected files
|
|
28
|
-
*/
|
|
29
|
-
getTopAffectedFiles(findings: Finding[], limit?: number): Array<{
|
|
30
|
-
file: string;
|
|
31
|
-
count: number;
|
|
32
|
-
criticalCount: number;
|
|
33
|
-
}>;
|
|
34
|
-
/**
|
|
35
|
-
* Get threat type distribution
|
|
36
|
-
*/
|
|
37
|
-
getThreatTypeDistribution(findings: Finding[]): Record<string, number>;
|
|
38
|
-
/**
|
|
39
|
-
* Calculate security posture metrics
|
|
40
|
-
*/
|
|
41
|
-
calculateSecurityPosture(findings: Finding[], totalFiles: number, totalLines: number): {
|
|
42
|
-
score: number;
|
|
43
|
-
grade: string;
|
|
44
|
-
findingsPerKLOC: number;
|
|
45
|
-
criticalRatio: number;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export default RiskScoringEngine;
|
|
49
|
-
//# sourceMappingURL=riskScoring.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"riskScoring.d.ts","sourceRoot":"","sources":["../../../src/core/scoring/riskScoring.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAc,eAAe,EAAE,MAAM,aAAa,CAAC;AAkC7E;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAyBnE;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU;IAQ5E;;OAEG;IACH,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC;IAgBtE;;OAEG;IACH,uBAAuB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC;IAe7E;;OAEG;IACH,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,GAAE,MAAW,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAkB3H;;OAEG;IACH,yBAAyB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAUtE;;OAEG;IACH,wBAAwB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;QACrF,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB;CAkCF;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Risk Scoring Engine
|
|
4
|
-
* Calculates risk scores and severity levels for scan results
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.RiskScoringEngine = void 0;
|
|
8
|
-
const types_1 = require("../../types");
|
|
9
|
-
/**
|
|
10
|
-
* Risk weights for different factors
|
|
11
|
-
*/
|
|
12
|
-
const SEVERITY_WEIGHTS = {
|
|
13
|
-
[types_1.Severity.CRITICAL]: 100,
|
|
14
|
-
[types_1.Severity.HIGH]: 70,
|
|
15
|
-
[types_1.Severity.MEDIUM]: 40,
|
|
16
|
-
[types_1.Severity.LOW]: 15,
|
|
17
|
-
[types_1.Severity.INFO]: 5
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Category weights
|
|
21
|
-
*/
|
|
22
|
-
const CATEGORY_WEIGHTS = {
|
|
23
|
-
[types_1.FindingCategory.MALWARE]: 1.5,
|
|
24
|
-
[types_1.FindingCategory.VULNERABILITY]: 1.0,
|
|
25
|
-
[types_1.FindingCategory.CODE_SMELL]: 0.5,
|
|
26
|
-
[types_1.FindingCategory.BEST_PRACTICE]: 0.3
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Risk level thresholds
|
|
30
|
-
*/
|
|
31
|
-
const RISK_THRESHOLDS = {
|
|
32
|
-
safe: 10,
|
|
33
|
-
low: 30,
|
|
34
|
-
medium: 50,
|
|
35
|
-
high: 75
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Risk Scoring Engine Class
|
|
39
|
-
*/
|
|
40
|
-
class RiskScoringEngine {
|
|
41
|
-
/**
|
|
42
|
-
* Calculate overall risk score for findings
|
|
43
|
-
*/
|
|
44
|
-
calculateRiskScore(findings, totalFiles) {
|
|
45
|
-
if (findings.length === 0) {
|
|
46
|
-
return 0;
|
|
47
|
-
}
|
|
48
|
-
let totalScore = 0;
|
|
49
|
-
for (const finding of findings) {
|
|
50
|
-
const severityWeight = SEVERITY_WEIGHTS[finding.severity];
|
|
51
|
-
const categoryWeight = CATEGORY_WEIGHTS[finding.category];
|
|
52
|
-
const confidenceMultiplier = finding.confidence / 100;
|
|
53
|
-
totalScore += severityWeight * categoryWeight * confidenceMultiplier;
|
|
54
|
-
}
|
|
55
|
-
// Normalize score based on codebase size
|
|
56
|
-
// More files = slightly lower weight per finding
|
|
57
|
-
const sizeNormalizer = Math.log10(Math.max(totalFiles, 1)) + 1;
|
|
58
|
-
// Calculate normalized score (0-100)
|
|
59
|
-
const normalizedScore = Math.min(100, (totalScore / sizeNormalizer) / 2);
|
|
60
|
-
return Math.round(normalizedScore);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Determine risk level from score
|
|
64
|
-
*/
|
|
65
|
-
getRiskLevel(score) {
|
|
66
|
-
if (score >= RISK_THRESHOLDS.high)
|
|
67
|
-
return 'critical';
|
|
68
|
-
if (score >= RISK_THRESHOLDS.medium)
|
|
69
|
-
return 'high';
|
|
70
|
-
if (score >= RISK_THRESHOLDS.low)
|
|
71
|
-
return 'medium';
|
|
72
|
-
if (score >= RISK_THRESHOLDS.safe)
|
|
73
|
-
return 'low';
|
|
74
|
-
return 'safe';
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get severity distribution
|
|
78
|
-
*/
|
|
79
|
-
getSeverityDistribution(findings) {
|
|
80
|
-
const distribution = {
|
|
81
|
-
[types_1.Severity.CRITICAL]: 0,
|
|
82
|
-
[types_1.Severity.HIGH]: 0,
|
|
83
|
-
[types_1.Severity.MEDIUM]: 0,
|
|
84
|
-
[types_1.Severity.LOW]: 0,
|
|
85
|
-
[types_1.Severity.INFO]: 0
|
|
86
|
-
};
|
|
87
|
-
for (const finding of findings) {
|
|
88
|
-
distribution[finding.severity]++;
|
|
89
|
-
}
|
|
90
|
-
return distribution;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Get category distribution
|
|
94
|
-
*/
|
|
95
|
-
getCategoryDistribution(findings) {
|
|
96
|
-
const distribution = {
|
|
97
|
-
[types_1.FindingCategory.MALWARE]: 0,
|
|
98
|
-
[types_1.FindingCategory.VULNERABILITY]: 0,
|
|
99
|
-
[types_1.FindingCategory.CODE_SMELL]: 0,
|
|
100
|
-
[types_1.FindingCategory.BEST_PRACTICE]: 0
|
|
101
|
-
};
|
|
102
|
-
for (const finding of findings) {
|
|
103
|
-
distribution[finding.category]++;
|
|
104
|
-
}
|
|
105
|
-
return distribution;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Get top affected files
|
|
109
|
-
*/
|
|
110
|
-
getTopAffectedFiles(findings, limit = 10) {
|
|
111
|
-
const fileMap = new Map();
|
|
112
|
-
for (const finding of findings) {
|
|
113
|
-
const current = fileMap.get(finding.location.file) || { count: 0, criticalCount: 0 };
|
|
114
|
-
current.count++;
|
|
115
|
-
if (finding.severity === types_1.Severity.CRITICAL || finding.severity === types_1.Severity.HIGH) {
|
|
116
|
-
current.criticalCount++;
|
|
117
|
-
}
|
|
118
|
-
fileMap.set(finding.location.file, current);
|
|
119
|
-
}
|
|
120
|
-
return Array.from(fileMap.entries())
|
|
121
|
-
.map(([file, stats]) => ({ file, ...stats }))
|
|
122
|
-
.sort((a, b) => b.criticalCount - a.criticalCount || b.count - a.count)
|
|
123
|
-
.slice(0, limit);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Get threat type distribution
|
|
127
|
-
*/
|
|
128
|
-
getThreatTypeDistribution(findings) {
|
|
129
|
-
const distribution = {};
|
|
130
|
-
for (const finding of findings) {
|
|
131
|
-
distribution[finding.threatType] = (distribution[finding.threatType] || 0) + 1;
|
|
132
|
-
}
|
|
133
|
-
return distribution;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Calculate security posture metrics
|
|
137
|
-
*/
|
|
138
|
-
calculateSecurityPosture(findings, totalFiles, totalLines) {
|
|
139
|
-
const score = 100 - this.calculateRiskScore(findings, totalFiles);
|
|
140
|
-
// Calculate grade
|
|
141
|
-
let grade;
|
|
142
|
-
if (score >= 90)
|
|
143
|
-
grade = 'A+';
|
|
144
|
-
else if (score >= 85)
|
|
145
|
-
grade = 'A';
|
|
146
|
-
else if (score >= 80)
|
|
147
|
-
grade = 'A-';
|
|
148
|
-
else if (score >= 75)
|
|
149
|
-
grade = 'B+';
|
|
150
|
-
else if (score >= 70)
|
|
151
|
-
grade = 'B';
|
|
152
|
-
else if (score >= 65)
|
|
153
|
-
grade = 'B-';
|
|
154
|
-
else if (score >= 60)
|
|
155
|
-
grade = 'C+';
|
|
156
|
-
else if (score >= 55)
|
|
157
|
-
grade = 'C';
|
|
158
|
-
else if (score >= 50)
|
|
159
|
-
grade = 'C-';
|
|
160
|
-
else if (score >= 40)
|
|
161
|
-
grade = 'D';
|
|
162
|
-
else
|
|
163
|
-
grade = 'F';
|
|
164
|
-
// Findings per 1000 lines of code
|
|
165
|
-
const kloc = totalLines / 1000;
|
|
166
|
-
const findingsPerKLOC = kloc > 0 ? findings.length / kloc : 0;
|
|
167
|
-
// Ratio of critical/high findings
|
|
168
|
-
const criticalCount = findings.filter(f => f.severity === types_1.Severity.CRITICAL || f.severity === types_1.Severity.HIGH).length;
|
|
169
|
-
const criticalRatio = findings.length > 0 ? criticalCount / findings.length : 0;
|
|
170
|
-
return {
|
|
171
|
-
score: Math.round(score),
|
|
172
|
-
grade,
|
|
173
|
-
findingsPerKLOC: Math.round(findingsPerKLOC * 100) / 100,
|
|
174
|
-
criticalRatio: Math.round(criticalRatio * 100) / 100
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
exports.RiskScoringEngine = RiskScoringEngine;
|
|
179
|
-
exports.default = RiskScoringEngine;
|
|
180
|
-
//# sourceMappingURL=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-
/**
|
|
7
|
-
* Security Scanner Class
|
|
8
|
-
* Main orchestrator for the SAST tool
|
|
9
|
-
*/
|
|
10
|
-
export declare class SecurityScanner {
|
|
11
|
-
private config;
|
|
12
|
-
private fileScanner;
|
|
13
|
-
private ruleEngine;
|
|
14
|
-
private riskScoring;
|
|
15
|
-
private aiAnalyzer?;
|
|
16
|
-
constructor(config: ScanConfig);
|
|
17
|
-
/**
|
|
18
|
-
* Normalize and validate configuration
|
|
19
|
-
*/
|
|
20
|
-
private normalizeConfig;
|
|
21
|
-
/**
|
|
22
|
-
* Run the security scan
|
|
23
|
-
*/
|
|
24
|
-
scan(): Promise<ScanResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Analyze a single file
|
|
27
|
-
*/
|
|
28
|
-
private analyzeFile;
|
|
29
|
-
/**
|
|
30
|
-
* Filter findings by minimum severity
|
|
31
|
-
*/
|
|
32
|
-
private filterBySeverity;
|
|
33
|
-
/**
|
|
34
|
-
* Calculate scan statistics
|
|
35
|
-
*/
|
|
36
|
-
private calculateStats;
|
|
37
|
-
/**
|
|
38
|
-
* Create empty result when no files found
|
|
39
|
-
*/
|
|
40
|
-
private createEmptyResult;
|
|
41
|
-
/**
|
|
42
|
-
* Generate report
|
|
43
|
-
*/
|
|
44
|
-
private generateReport;
|
|
45
|
-
}
|
|
46
|
-
export default SecurityScanner;
|
|
47
|
-
//# sourceMappingURL=securityScanner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityScanner.d.ts","sourceRoot":"","sources":["../../src/core/securityScanner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EACL,UAAU,EACV,UAAU,EAMX,MAAM,UAAU,CAAC;AAWlB;;;GAGG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,UAAU,CAAC,CAAa;gBAEpB,MAAM,EAAE,UAAU;IAY9B;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC;IA4GjC;;OAEG;YACW,WAAW;IAoCzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,OAAO,CAAC,cAAc;IA6BtB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoCzB;;OAEG;YACW,cAAc;CAiB7B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Security Scanner Orchestrator
|
|
4
|
-
* Main scanner that coordinates all analyzers
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.SecurityScanner = void 0;
|
|
41
|
-
const path = __importStar(require("path"));
|
|
42
|
-
const fs = __importStar(require("fs"));
|
|
43
|
-
const types_1 = require("../types");
|
|
44
|
-
const scanner_1 = require("../core/scanner");
|
|
45
|
-
const engine_1 = require("../core/engine");
|
|
46
|
-
const scoring_1 = require("../core/scoring");
|
|
47
|
-
const rules_1 = require("../rules");
|
|
48
|
-
const analyzers_1 = require("../analyzers");
|
|
49
|
-
const ai_1 = require("../ai");
|
|
50
|
-
const reports_1 = require("../reports");
|
|
51
|
-
const utils_1 = require("../utils");
|
|
52
|
-
const logger_1 = require("../utils/logger");
|
|
53
|
-
/**
|
|
54
|
-
* Security Scanner Class
|
|
55
|
-
* Main orchestrator for the SAST tool
|
|
56
|
-
*/
|
|
57
|
-
class SecurityScanner {
|
|
58
|
-
config;
|
|
59
|
-
fileScanner;
|
|
60
|
-
ruleEngine;
|
|
61
|
-
riskScoring;
|
|
62
|
-
aiAnalyzer;
|
|
63
|
-
constructor(config) {
|
|
64
|
-
this.config = this.normalizeConfig(config);
|
|
65
|
-
this.fileScanner = new scanner_1.FileScanner(this.config);
|
|
66
|
-
this.ruleEngine = new engine_1.RuleEngine();
|
|
67
|
-
this.riskScoring = new scoring_1.RiskScoringEngine();
|
|
68
|
-
// Initialize AI analyzer if configured
|
|
69
|
-
if (this.config.useAI && this.config.aiConfig) {
|
|
70
|
-
this.aiAnalyzer = new ai_1.AIAnalyzer(this.config.aiConfig);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Normalize and validate configuration
|
|
75
|
-
*/
|
|
76
|
-
normalizeConfig(config) {
|
|
77
|
-
return {
|
|
78
|
-
...config,
|
|
79
|
-
projectPath: path.resolve(config.projectPath),
|
|
80
|
-
exclude: config.exclude || [],
|
|
81
|
-
minSeverity: config.minSeverity || types_1.Severity.INFO,
|
|
82
|
-
verbose: config.verbose || false,
|
|
83
|
-
maxFileSize: config.maxFileSize || 5 * 1024 * 1024,
|
|
84
|
-
fileTimeout: config.fileTimeout || 30000
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Run the security scan
|
|
89
|
-
*/
|
|
90
|
-
async scan() {
|
|
91
|
-
const startTime = Date.now();
|
|
92
|
-
const scanId = (0, utils_1.generateId)();
|
|
93
|
-
(0, logger_1.logScanStart)(this.config.projectPath);
|
|
94
|
-
try {
|
|
95
|
-
// Initialize analyzers
|
|
96
|
-
await (0, analyzers_1.initializeAnalyzers)();
|
|
97
|
-
// Log available analyzers and their versions
|
|
98
|
-
const allAnalyzers = (0, analyzers_1.getAllAnalyzers)();
|
|
99
|
-
logger_1.logger.info(`🔧 Loaded ${allAnalyzers.length} security analyzers:`);
|
|
100
|
-
for (const analyzer of allAnalyzers) {
|
|
101
|
-
logger_1.logger.info(` • ${analyzer.name} v${analyzer.version} (${analyzer.languages.join(', ')})`);
|
|
102
|
-
}
|
|
103
|
-
if (this.aiAnalyzer) {
|
|
104
|
-
await this.aiAnalyzer.initialize();
|
|
105
|
-
}
|
|
106
|
-
// Load rules
|
|
107
|
-
const rules = (0, rules_1.getEnabledRules)();
|
|
108
|
-
this.ruleEngine.loadRules(rules);
|
|
109
|
-
// Scan files
|
|
110
|
-
logger_1.logger.info('📂 Scanning project files...');
|
|
111
|
-
const files = await this.fileScanner.scan();
|
|
112
|
-
if (files.length === 0) {
|
|
113
|
-
logger_1.logger.warn('⚠️ No files found to analyze');
|
|
114
|
-
return this.createEmptyResult(scanId, startTime);
|
|
115
|
-
}
|
|
116
|
-
// Analyze files
|
|
117
|
-
logger_1.logger.info('🔍 Analyzing code for vulnerabilities and malware...');
|
|
118
|
-
const allFindings = [];
|
|
119
|
-
for (let i = 0; i < files.length; i++) {
|
|
120
|
-
const file = files[i];
|
|
121
|
-
if (this.config.verbose) {
|
|
122
|
-
logger_1.logger.debug(`Analyzing: ${file.relativePath}`);
|
|
123
|
-
}
|
|
124
|
-
try {
|
|
125
|
-
const fileFindings = await this.analyzeFile(file);
|
|
126
|
-
allFindings.push(...fileFindings);
|
|
127
|
-
// Log critical findings immediately
|
|
128
|
-
for (const finding of fileFindings) {
|
|
129
|
-
if (finding.severity === types_1.Severity.CRITICAL || finding.severity === types_1.Severity.HIGH || finding.category === types_1.FindingCategory.MALWARE) {
|
|
130
|
-
(0, logger_1.logFinding)(finding.severity, finding.title, finding.location.file, finding.location.startLine, finding.category);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch (error) {
|
|
135
|
-
logger_1.logger.debug(`Error analyzing ${file.relativePath}: ${error}`);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
// Deduplicate findings
|
|
139
|
-
const uniqueFindings = this.ruleEngine.deduplicateFindings(allFindings);
|
|
140
|
-
// Filter by minimum severity
|
|
141
|
-
const filteredFindings = this.filterBySeverity(uniqueFindings);
|
|
142
|
-
// Sort by severity
|
|
143
|
-
const sortedFindings = this.ruleEngine.sortBySeverity(filteredFindings);
|
|
144
|
-
// Calculate statistics
|
|
145
|
-
const endTime = Date.now();
|
|
146
|
-
const stats = this.calculateStats(files, sortedFindings, startTime, endTime);
|
|
147
|
-
// Calculate risk score
|
|
148
|
-
const riskScore = this.riskScoring.calculateRiskScore(sortedFindings, files.length);
|
|
149
|
-
const riskLevel = this.riskScoring.getRiskLevel(riskScore);
|
|
150
|
-
// Create result
|
|
151
|
-
const result = {
|
|
152
|
-
projectPath: this.config.projectPath,
|
|
153
|
-
projectName: path.basename(this.config.projectPath),
|
|
154
|
-
scanId,
|
|
155
|
-
findings: sortedFindings,
|
|
156
|
-
stats,
|
|
157
|
-
riskScore,
|
|
158
|
-
riskLevel,
|
|
159
|
-
scannedFiles: files,
|
|
160
|
-
config: this.config
|
|
161
|
-
};
|
|
162
|
-
(0, logger_1.logScanComplete)(stats.totalFiles, sortedFindings.length, stats.duration, riskScore);
|
|
163
|
-
// Generate report if output path specified
|
|
164
|
-
if (this.config.outputPath) {
|
|
165
|
-
await this.generateReport(result);
|
|
166
|
-
}
|
|
167
|
-
// Cleanup
|
|
168
|
-
await (0, analyzers_1.cleanupAnalyzers)();
|
|
169
|
-
return result;
|
|
170
|
-
}
|
|
171
|
-
catch (error) {
|
|
172
|
-
logger_1.logger.error(`Scan failed: ${error}`);
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Analyze a single file
|
|
178
|
-
*/
|
|
179
|
-
async analyzeFile(file) {
|
|
180
|
-
const findings = [];
|
|
181
|
-
// Skip if no language detected
|
|
182
|
-
if (!file.language) {
|
|
183
|
-
return findings;
|
|
184
|
-
}
|
|
185
|
-
// Get language-specific analyzer
|
|
186
|
-
const analyzer = (0, analyzers_1.getAnalyzerForLanguage)(file.language);
|
|
187
|
-
if (analyzer) {
|
|
188
|
-
// Log analyzer version being used
|
|
189
|
-
if (this.config.verbose) {
|
|
190
|
-
logger_1.logger.debug(`Using ${analyzer.name} v${analyzer.version} for ${file.relativePath}`);
|
|
191
|
-
}
|
|
192
|
-
const rules = (0, rules_1.getEnabledRules)().filter(r => r.languages.includes(file.language));
|
|
193
|
-
const analyzerFindings = await analyzer.analyze(file, rules);
|
|
194
|
-
findings.push(...analyzerFindings);
|
|
195
|
-
}
|
|
196
|
-
// Run rule engine for generic patterns
|
|
197
|
-
const ruleFindings = await this.ruleEngine.analyzeFile(file);
|
|
198
|
-
findings.push(...ruleFindings);
|
|
199
|
-
// AI analysis if enabled
|
|
200
|
-
if (this.aiAnalyzer && this.config.useAI) {
|
|
201
|
-
const aiResult = await this.aiAnalyzer.analyze(file);
|
|
202
|
-
findings.push(...aiResult.findings);
|
|
203
|
-
}
|
|
204
|
-
return findings;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Filter findings by minimum severity
|
|
208
|
-
*/
|
|
209
|
-
filterBySeverity(findings) {
|
|
210
|
-
if (!this.config.minSeverity) {
|
|
211
|
-
return findings;
|
|
212
|
-
}
|
|
213
|
-
return findings.filter(f => (0, utils_1.isHigherOrEqualSeverity)(f.severity, this.config.minSeverity));
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Calculate scan statistics
|
|
217
|
-
*/
|
|
218
|
-
calculateStats(files, findings, startTime, endTime) {
|
|
219
|
-
const totalLines = files.reduce((sum, f) => sum + f.lineCount, 0);
|
|
220
|
-
const filesByLanguage = {};
|
|
221
|
-
for (const file of files) {
|
|
222
|
-
const lang = file.language || 'unknown';
|
|
223
|
-
filesByLanguage[lang] = (filesByLanguage[lang] || 0) + 1;
|
|
224
|
-
}
|
|
225
|
-
const findingsBySeverity = this.riskScoring.getSeverityDistribution(findings);
|
|
226
|
-
const findingsByCategory = this.riskScoring.getCategoryDistribution(findings);
|
|
227
|
-
return {
|
|
228
|
-
totalFiles: files.length,
|
|
229
|
-
totalLines,
|
|
230
|
-
filesByLanguage,
|
|
231
|
-
findingsBySeverity,
|
|
232
|
-
findingsByCategory,
|
|
233
|
-
duration: endTime - startTime,
|
|
234
|
-
startTime: new Date(startTime),
|
|
235
|
-
endTime: new Date(endTime)
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Create empty result when no files found
|
|
240
|
-
*/
|
|
241
|
-
createEmptyResult(scanId, startTime) {
|
|
242
|
-
const endTime = Date.now();
|
|
243
|
-
return {
|
|
244
|
-
projectPath: this.config.projectPath,
|
|
245
|
-
projectName: path.basename(this.config.projectPath),
|
|
246
|
-
scanId,
|
|
247
|
-
findings: [],
|
|
248
|
-
stats: {
|
|
249
|
-
totalFiles: 0,
|
|
250
|
-
totalLines: 0,
|
|
251
|
-
filesByLanguage: {},
|
|
252
|
-
findingsBySeverity: {
|
|
253
|
-
[types_1.Severity.CRITICAL]: 0,
|
|
254
|
-
[types_1.Severity.HIGH]: 0,
|
|
255
|
-
[types_1.Severity.MEDIUM]: 0,
|
|
256
|
-
[types_1.Severity.LOW]: 0,
|
|
257
|
-
[types_1.Severity.INFO]: 0
|
|
258
|
-
},
|
|
259
|
-
findingsByCategory: {
|
|
260
|
-
[types_1.FindingCategory.MALWARE]: 0,
|
|
261
|
-
[types_1.FindingCategory.VULNERABILITY]: 0,
|
|
262
|
-
[types_1.FindingCategory.CODE_SMELL]: 0,
|
|
263
|
-
[types_1.FindingCategory.BEST_PRACTICE]: 0
|
|
264
|
-
},
|
|
265
|
-
duration: endTime - startTime,
|
|
266
|
-
startTime: new Date(startTime),
|
|
267
|
-
endTime: new Date(endTime)
|
|
268
|
-
},
|
|
269
|
-
riskScore: 0,
|
|
270
|
-
riskLevel: 'safe',
|
|
271
|
-
scannedFiles: [],
|
|
272
|
-
config: this.config
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Generate report
|
|
277
|
-
*/
|
|
278
|
-
async generateReport(result) {
|
|
279
|
-
if (!this.config.outputPath)
|
|
280
|
-
return;
|
|
281
|
-
const outputPath = path.resolve(this.config.outputPath);
|
|
282
|
-
const ext = path.extname(outputPath).toLowerCase();
|
|
283
|
-
if (ext === '.html' || ext === '') {
|
|
284
|
-
// Pass the language configuration to the report generator
|
|
285
|
-
const reportLanguage = this.config.language || 'es';
|
|
286
|
-
const reportGenerator = new reports_1.HtmlReportGenerator(reportLanguage);
|
|
287
|
-
const finalPath = ext === '' ? `${outputPath}.html` : outputPath;
|
|
288
|
-
await reportGenerator.saveReport(result, finalPath);
|
|
289
|
-
}
|
|
290
|
-
else if (ext === '.json') {
|
|
291
|
-
fs.writeFileSync(outputPath, JSON.stringify(result, null, 2), 'utf-8');
|
|
292
|
-
logger_1.logger.info(`📁 Reporte JSON guardado en: ${outputPath}`);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
exports.SecurityScanner = SecurityScanner;
|
|
297
|
-
exports.default = SecurityScanner;
|
|
298
|
-
//# sourceMappingURL=securityScanner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"securityScanner.js","sourceRoot":"","sources":["../../src/core/securityScanner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,uCAAyB;AACzB,oCAQkB;AAClB,6CAA8C;AAC9C,2CAA4C;AAC5C,6CAAoD;AACpD,oCAAwD;AACxD,4CAA8G;AAC9G,8BAAmC;AACnC,wCAAiD;AACjD,oCAA+D;AAC/D,4CAAoF;AAEpF;;;GAGG;AACH,MAAa,eAAe;IAClB,MAAM,CAAa;IACnB,WAAW,CAAc;IACzB,UAAU,CAAa;IACvB,WAAW,CAAoB;IAC/B,UAAU,CAAc;IAEhC,YAAY,MAAkB;QAC5B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,qBAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,IAAI,2BAAiB,EAAE,CAAC;QAE3C,uCAAuC;QACvC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC9C,IAAI,CAAC,UAAU,GAAG,IAAI,eAAU,CAAC,IAAI,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