secure-scan 1.2.3 → 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/dist/cli/index.js +109 -9
- package/dist/cli/index.js.map +1 -1
- package/docs/V1.2.1-IA_Performances.md +2 -2
- package/package.json +2 -2
- package/secure-scan.config.json +2 -16
- package/src/cli/index.ts +117 -9
- 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/reporte-test.html +0 -5036
- package/src/analyzers/javascript/PROMPT_JS_ANALYZER.md +0 -267
- package/src/rules/malware/INFO.md +0 -287
package/dist/core/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Core Module Exports
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./scanner"), exports);
|
|
21
|
-
__exportStar(require("./engine"), exports);
|
|
22
|
-
__exportStar(require("./scoring"), exports);
|
|
23
|
-
__exportStar(require("./securityScanner"), exports);
|
|
24
|
-
//# sourceMappingURL=index.js.map
|
package/dist/core/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,oDAAkC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File Scanner Module
|
|
3
|
-
* Scans directories and collects files for analysis
|
|
4
|
-
*/
|
|
5
|
-
import { ScannedFile, ScanConfig } from '../../types';
|
|
6
|
-
/**
|
|
7
|
-
* File Scanner Class
|
|
8
|
-
*/
|
|
9
|
-
export declare class FileScanner {
|
|
10
|
-
private config;
|
|
11
|
-
private extensions;
|
|
12
|
-
constructor(config: ScanConfig);
|
|
13
|
-
/**
|
|
14
|
-
* Scan project directory for files
|
|
15
|
-
*/
|
|
16
|
-
scan(): Promise<ScannedFile[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Process a single file
|
|
19
|
-
*/
|
|
20
|
-
private processFile;
|
|
21
|
-
/**
|
|
22
|
-
* Get ignore patterns for glob
|
|
23
|
-
*/
|
|
24
|
-
private getIgnorePatterns;
|
|
25
|
-
/**
|
|
26
|
-
* Get file statistics
|
|
27
|
-
*/
|
|
28
|
-
getFileStats(files: ScannedFile[]): Record<string, number>;
|
|
29
|
-
}
|
|
30
|
-
export default FileScanner;
|
|
31
|
-
//# sourceMappingURL=fileScanner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileScanner.d.ts","sourceRoot":"","sources":["../../../src/core/scanner/fileScanner.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,WAAW,EAAqB,UAAU,EAAE,MAAM,aAAa,CAAC;AA8BzE;;GAEG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,UAAU,CAAW;gBAEjB,MAAM,EAAE,UAAU;IAK9B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAqEpC;;OAEG;YACW,WAAW;IAgCzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA4BzB;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAU3D;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* File Scanner Module
|
|
4
|
-
* Scans directories and collects files for analysis
|
|
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.FileScanner = void 0;
|
|
41
|
-
const fs = __importStar(require("fs"));
|
|
42
|
-
const path = __importStar(require("path"));
|
|
43
|
-
const glob_1 = require("glob");
|
|
44
|
-
const utils_1 = require("../../utils");
|
|
45
|
-
const logger_1 = require("../../utils/logger");
|
|
46
|
-
/**
|
|
47
|
-
* Default file extensions to scan
|
|
48
|
-
*/
|
|
49
|
-
const DEFAULT_EXTENSIONS = [
|
|
50
|
-
'.js', '.jsx', '.mjs', '.cjs',
|
|
51
|
-
'.ts', '.tsx',
|
|
52
|
-
'.py', '.pyw',
|
|
53
|
-
'.php', '.phtml',
|
|
54
|
-
'.java',
|
|
55
|
-
'.c', '.h', '.cpp', '.cc', '.cxx', '.hpp',
|
|
56
|
-
'.cs',
|
|
57
|
-
'.yaml', '.yml',
|
|
58
|
-
'.tf', '.tfvars'
|
|
59
|
-
];
|
|
60
|
-
/**
|
|
61
|
-
* Default max file size (5MB)
|
|
62
|
-
*/
|
|
63
|
-
const DEFAULT_MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
64
|
-
/**
|
|
65
|
-
* File Scanner Class
|
|
66
|
-
*/
|
|
67
|
-
class FileScanner {
|
|
68
|
-
config;
|
|
69
|
-
extensions;
|
|
70
|
-
constructor(config) {
|
|
71
|
-
this.config = config;
|
|
72
|
-
this.extensions = DEFAULT_EXTENSIONS;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Scan project directory for files
|
|
76
|
-
*/
|
|
77
|
-
async scan() {
|
|
78
|
-
const projectPath = path.resolve(this.config.projectPath);
|
|
79
|
-
if (!fs.existsSync(projectPath)) {
|
|
80
|
-
throw new Error(`Project path does not exist: ${projectPath}`);
|
|
81
|
-
}
|
|
82
|
-
const stats = fs.statSync(projectPath);
|
|
83
|
-
if (!stats.isDirectory()) {
|
|
84
|
-
throw new Error(`Project path is not a directory: ${projectPath}`);
|
|
85
|
-
}
|
|
86
|
-
logger_1.logger.info(`🔍 Starting file scan in: ${projectPath}`);
|
|
87
|
-
// Build glob pattern
|
|
88
|
-
const patterns = this.extensions.map(ext => `**/*${ext}`);
|
|
89
|
-
patterns.push('**/Dockerfile');
|
|
90
|
-
patterns.push('**/.github/**/*.yml');
|
|
91
|
-
patterns.push('**/.github/**/*.yaml');
|
|
92
|
-
patterns.push('**/.gitlab-ci.yml');
|
|
93
|
-
const files = [];
|
|
94
|
-
for (const pattern of patterns) {
|
|
95
|
-
const matches = await (0, glob_1.glob)(pattern, {
|
|
96
|
-
cwd: projectPath,
|
|
97
|
-
nodir: true,
|
|
98
|
-
absolute: false,
|
|
99
|
-
ignore: this.getIgnorePatterns()
|
|
100
|
-
});
|
|
101
|
-
for (const match of matches) {
|
|
102
|
-
const absolutePath = path.join(projectPath, match);
|
|
103
|
-
// Skip if already processed
|
|
104
|
-
if (files.some(f => f.absolutePath === absolutePath)) {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
// Skip excluded paths
|
|
108
|
-
if ((0, utils_1.shouldExclude)(match, this.config.exclude || [])) {
|
|
109
|
-
logger_1.logger.debug(`Skipping excluded file: ${match}`);
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
try {
|
|
113
|
-
const scannedFile = await this.processFile(absolutePath, match, projectPath);
|
|
114
|
-
if (scannedFile) {
|
|
115
|
-
files.push(scannedFile);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
logger_1.logger.warn(`Failed to process file: ${match} - ${error}`);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Filter by language if specified
|
|
124
|
-
let filteredFiles = files;
|
|
125
|
-
if (this.config.languages && this.config.languages.length > 0) {
|
|
126
|
-
filteredFiles = files.filter(f => f.language && this.config.languages.includes(f.language));
|
|
127
|
-
}
|
|
128
|
-
logger_1.logger.info(`📂 Found ${filteredFiles.length} files to analyze`);
|
|
129
|
-
return filteredFiles;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Process a single file
|
|
133
|
-
*/
|
|
134
|
-
async processFile(absolutePath, relativePath, projectPath) {
|
|
135
|
-
const stats = fs.statSync(absolutePath);
|
|
136
|
-
const maxSize = this.config.maxFileSize || DEFAULT_MAX_FILE_SIZE;
|
|
137
|
-
// Skip files that are too large
|
|
138
|
-
if (stats.size > maxSize) {
|
|
139
|
-
logger_1.logger.debug(`Skipping large file: ${relativePath} (${stats.size} bytes)`);
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
// Read file content
|
|
143
|
-
const content = fs.readFileSync(absolutePath, 'utf-8');
|
|
144
|
-
// Detect language
|
|
145
|
-
const language = (0, utils_1.getLanguageFromExtension)(absolutePath);
|
|
146
|
-
return {
|
|
147
|
-
absolutePath,
|
|
148
|
-
relativePath,
|
|
149
|
-
extension: path.extname(absolutePath).toLowerCase(),
|
|
150
|
-
language,
|
|
151
|
-
size: stats.size,
|
|
152
|
-
content,
|
|
153
|
-
lineCount: (0, utils_1.countLines)(content),
|
|
154
|
-
hash: (0, utils_1.calculateHash)(content)
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Get ignore patterns for glob
|
|
159
|
-
*/
|
|
160
|
-
getIgnorePatterns() {
|
|
161
|
-
const defaultIgnore = [
|
|
162
|
-
'**/node_modules/**',
|
|
163
|
-
'**/vendor/**',
|
|
164
|
-
'**/.git/**',
|
|
165
|
-
'**/dist/**',
|
|
166
|
-
'**/build/**',
|
|
167
|
-
'**/out/**',
|
|
168
|
-
'**/__pycache__/**',
|
|
169
|
-
'**/.venv/**',
|
|
170
|
-
'**/venv/**',
|
|
171
|
-
'**/coverage/**',
|
|
172
|
-
'**/.nyc_output/**',
|
|
173
|
-
'**/.next/**',
|
|
174
|
-
'**/.nuxt/**',
|
|
175
|
-
'**/target/**',
|
|
176
|
-
'**/bin/**',
|
|
177
|
-
'**/obj/**',
|
|
178
|
-
'**/*.min.js',
|
|
179
|
-
'**/*.bundle.js',
|
|
180
|
-
'**/*.map'
|
|
181
|
-
];
|
|
182
|
-
const customIgnore = (this.config.exclude || []).map((p) => `**/${p}/**`);
|
|
183
|
-
return [...defaultIgnore, ...customIgnore];
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Get file statistics
|
|
187
|
-
*/
|
|
188
|
-
getFileStats(files) {
|
|
189
|
-
const stats = {};
|
|
190
|
-
for (const file of files) {
|
|
191
|
-
const lang = file.language || 'unknown';
|
|
192
|
-
stats[lang] = (stats[lang] || 0) + 1;
|
|
193
|
-
}
|
|
194
|
-
return stats;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
exports.FileScanner = FileScanner;
|
|
198
|
-
exports.default = FileScanner;
|
|
199
|
-
//# sourceMappingURL=fileScanner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fileScanner.js","sourceRoot":"","sources":["../../../src/core/scanner/fileScanner.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,+BAA4B;AAE5B,uCAMqB;AACrB,+CAA4C;AAE5C;;GAEG;AACH,MAAM,kBAAkB,GAAG;IACzB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAC7B,KAAK,EAAE,MAAM;IACb,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,QAAQ;IAChB,OAAO;IACP,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM;IACzC,KAAK;IACL,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;GAEG;AACH,MAAa,WAAW;IACd,MAAM,CAA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b,cAAc;YACd,WAAW;YACX,WAAW;YACX,aAAa;YACb,gBAAgB;YAChB,UAAU;SACX,CAAC;QAEF,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAElF,OAAO,CAAC,GAAG,aAAa,EAAE,GAAG,YAAY,CAAC,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,KAAoB;QAC/B,MAAM,KAAK,GAA2B,EAAE,CAAC;QAEzC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,IAAI,SAAS,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhKD,kCAgKC;AAED,kBAAe,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/scanner/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Scanner Module Exports
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./fileScanner"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/scanner/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,gDAA8B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/scoring/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,eAAe,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Scoring Module Exports
|
|
4
|
-
*/
|
|
5
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(o, k2, desc);
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
__exportStar(require("./riskScoring"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/scoring/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,gDAA8B"}
|
|
@@ -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=riskScoring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"riskScoring.js","sourceRoot":"","sources":["../../../src/core/scoring/riskScoring.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAA6E;AAG7E;;GAEG;AACH,MAAM,gBAAgB,GAA6B;IACjD,CAAC,gBAAQ,CAAC,QAAQ,CAAC,EAAE,GAAG;IACxB,CAAC,gBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;IACnB,CAAC,gBAAQ,CAAC,MAAM,CAAC,EAAE,EAAE;IACrB,CAAC,gBAAQ,CAAC,GAAG,CAAC,EAAE,EAAE;IAClB,CAAC,gBAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAoC;IACxD,CAAC,uBAAe,CAAC,OAAO,CAAC,EAAE,GAAG;IAC9B,CAAC,uBAAe,CAAC,aAAa,CAAC,EAAE,GAAG;IACpC,CAAC,uBAAe,CAAC,UAAU,CAAC,EAAE,GAAG;IACjC,CAAC,uBAAe,CAAC,aAAa,CAAC,EAAE,GAAG;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;GAEG;AACH,MAAa,iBAAiB;IAC5B;;OAEG;IACH,kBAAkB,CAAC,QAAmB,EAAE,UAAkB;QACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAA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;SACrD,CAAC;IACJ,CAAC;CACF;AAzJD,8CAyJC;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Scanner Orchestrator
|
|
3
|
-
* Main scanner that coordinates all analyzers
|
|
4
|
-
*/
|
|
5
|
-
import { ScanConfig, ScanResult } from '../types';
|
|
6
|
-
/**
|
|
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"}
|