avana-cli 2.11.0
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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +584 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +153 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/install.d.ts +6 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +101 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/scan.d.ts +19 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +383 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/uninstall.d.ts +6 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +80 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +475 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/additional-patterns.d.ts +12 -0
- package/dist/rules/additional-patterns.d.ts.map +1 -0
- package/dist/rules/additional-patterns.js +170 -0
- package/dist/rules/additional-patterns.js.map +1 -0
- package/dist/rules/code-patterns.d.ts +26 -0
- package/dist/rules/code-patterns.d.ts.map +1 -0
- package/dist/rules/code-patterns.js +220 -0
- package/dist/rules/code-patterns.js.map +1 -0
- package/dist/rules/secret-patterns.d.ts +28 -0
- package/dist/rules/secret-patterns.d.ts.map +1 -0
- package/dist/rules/secret-patterns.js +1729 -0
- package/dist/rules/secret-patterns.js.map +1 -0
- package/dist/scanners/secret-scanner.d.ts +34 -0
- package/dist/scanners/secret-scanner.d.ts.map +1 -0
- package/dist/scanners/secret-scanner.js +281 -0
- package/dist/scanners/secret-scanner.js.map +1 -0
- package/dist/types/index.d.ts +116 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/error-handler.d.ts +126 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +222 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/exit-codes.d.ts +52 -0
- package/dist/utils/exit-codes.d.ts.map +1 -0
- package/dist/utils/exit-codes.js +89 -0
- package/dist/utils/exit-codes.js.map +1 -0
- package/dist/utils/file-stream-scanner.d.ts +31 -0
- package/dist/utils/file-stream-scanner.d.ts.map +1 -0
- package/dist/utils/file-stream-scanner.js +159 -0
- package/dist/utils/file-stream-scanner.js.map +1 -0
- package/dist/utils/file-type-detector.d.ts +45 -0
- package/dist/utils/file-type-detector.d.ts.map +1 -0
- package/dist/utils/file-type-detector.js +237 -0
- package/dist/utils/file-type-detector.js.map +1 -0
- package/dist/utils/ignore-pattern-manager.d.ts +61 -0
- package/dist/utils/ignore-pattern-manager.d.ts.map +1 -0
- package/dist/utils/ignore-pattern-manager.js +204 -0
- package/dist/utils/ignore-pattern-manager.js.map +1 -0
- package/dist/utils/json-output-formatter.d.ts +232 -0
- package/dist/utils/json-output-formatter.d.ts.map +1 -0
- package/dist/utils/json-output-formatter.js +367 -0
- package/dist/utils/json-output-formatter.js.map +1 -0
- package/dist/utils/logger.d.ts +181 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +414 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown-output-formatter.d.ts +65 -0
- package/dist/utils/markdown-output-formatter.d.ts.map +1 -0
- package/dist/utils/markdown-output-formatter.js +316 -0
- package/dist/utils/markdown-output-formatter.js.map +1 -0
- package/dist/utils/memory-manager.d.ts +77 -0
- package/dist/utils/memory-manager.d.ts.map +1 -0
- package/dist/utils/memory-manager.js +157 -0
- package/dist/utils/memory-manager.js.map +1 -0
- package/dist/utils/parallel-scanner-worker.d.ts +19 -0
- package/dist/utils/parallel-scanner-worker.d.ts.map +1 -0
- package/dist/utils/parallel-scanner-worker.js +51 -0
- package/dist/utils/parallel-scanner-worker.js.map +1 -0
- package/dist/utils/parallel-scanner.d.ts +82 -0
- package/dist/utils/parallel-scanner.d.ts.map +1 -0
- package/dist/utils/parallel-scanner.js +229 -0
- package/dist/utils/parallel-scanner.js.map +1 -0
- package/dist/utils/pattern-validator.d.ts +108 -0
- package/dist/utils/pattern-validator.d.ts.map +1 -0
- package/dist/utils/pattern-validator.js +315 -0
- package/dist/utils/pattern-validator.js.map +1 -0
- package/dist/utils/progress-reporter.d.ts +68 -0
- package/dist/utils/progress-reporter.d.ts.map +1 -0
- package/dist/utils/progress-reporter.js +194 -0
- package/dist/utils/progress-reporter.js.map +1 -0
- package/dist/utils/result-cache.d.ts +99 -0
- package/dist/utils/result-cache.d.ts.map +1 -0
- package/dist/utils/result-cache.js +335 -0
- package/dist/utils/result-cache.js.map +1 -0
- package/package.json +80 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Avana - Core Engine
|
|
4
|
+
* Main entry point for security scanning functionality
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.Avana = void 0;
|
|
22
|
+
__exportStar(require("./types"), exports);
|
|
23
|
+
__exportStar(require("./scanners/secret-scanner"), exports);
|
|
24
|
+
__exportStar(require("./rules/secret-patterns"), exports);
|
|
25
|
+
__exportStar(require("./rules/additional-patterns"), exports);
|
|
26
|
+
const secret_scanner_1 = require("./scanners/secret-scanner");
|
|
27
|
+
const secret_patterns_1 = require("./rules/secret-patterns");
|
|
28
|
+
const additional_patterns_1 = require("./rules/additional-patterns");
|
|
29
|
+
// Import robust components
|
|
30
|
+
const file_type_detector_1 = require("./utils/file-type-detector");
|
|
31
|
+
const file_stream_scanner_1 = require("./utils/file-stream-scanner");
|
|
32
|
+
const error_handler_1 = require("./utils/error-handler");
|
|
33
|
+
const memory_manager_1 = require("./utils/memory-manager");
|
|
34
|
+
const progress_reporter_1 = require("./utils/progress-reporter");
|
|
35
|
+
const result_cache_1 = require("./utils/result-cache");
|
|
36
|
+
const parallel_scanner_1 = require("./utils/parallel-scanner");
|
|
37
|
+
const json_output_formatter_1 = require("./utils/json-output-formatter");
|
|
38
|
+
/**
|
|
39
|
+
* Main Avana Engine with robust file handling and performance optimization
|
|
40
|
+
*/
|
|
41
|
+
class Avana {
|
|
42
|
+
secretScanner;
|
|
43
|
+
fileTypeDetector;
|
|
44
|
+
fileStreamScanner;
|
|
45
|
+
errorHandler;
|
|
46
|
+
memoryManager;
|
|
47
|
+
resultCache;
|
|
48
|
+
parallelScanner;
|
|
49
|
+
jsonFormatter;
|
|
50
|
+
constructor(options) {
|
|
51
|
+
this.secretScanner = new secret_scanner_1.SecretScanner();
|
|
52
|
+
this.fileTypeDetector = new file_type_detector_1.FileTypeDetector();
|
|
53
|
+
this.fileStreamScanner = new file_stream_scanner_1.FileStreamScanner();
|
|
54
|
+
this.errorHandler = new error_handler_1.ErrorHandler(options?.debugMode || false);
|
|
55
|
+
this.memoryManager = new memory_manager_1.MemoryManager(options?.maxMemoryMB || 500);
|
|
56
|
+
this.resultCache = new result_cache_1.ResultCache(options?.cacheDir);
|
|
57
|
+
this.parallelScanner = new parallel_scanner_1.ParallelScanner({ workerCount: options?.workerCount });
|
|
58
|
+
this.jsonFormatter = new json_output_formatter_1.JSONOutputFormatter();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Perform a complete security scan with robust file handling
|
|
62
|
+
*/
|
|
63
|
+
async scan(options) {
|
|
64
|
+
const startTime = Date.now();
|
|
65
|
+
const allIssues = [];
|
|
66
|
+
let filesScanned = 0;
|
|
67
|
+
let filesSkipped = 0;
|
|
68
|
+
let progressReporter = null;
|
|
69
|
+
try {
|
|
70
|
+
// Initialize memory monitoring
|
|
71
|
+
const memoryCheckpoint = this.memoryManager.createCheckpoint('scan-start');
|
|
72
|
+
// Check .gitignore first (skip if scanning specific files)
|
|
73
|
+
if (!options.includeFiles) {
|
|
74
|
+
const gitignoreIssues = this.secretScanner.checkGitignore(options.path);
|
|
75
|
+
allIssues.push(...gitignoreIssues);
|
|
76
|
+
}
|
|
77
|
+
// Scan for secrets with robust file handling
|
|
78
|
+
if (options.config?.rules.secrets.enabled !== false) {
|
|
79
|
+
let secretIssues;
|
|
80
|
+
if (options.includeFiles && options.includeFiles.length > 0) {
|
|
81
|
+
// Scan only specific files (for --staged flag)
|
|
82
|
+
secretIssues = await this.scanSpecificFiles(options.includeFiles, options);
|
|
83
|
+
filesScanned = options.includeFiles.length;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// Scan entire directory with robust handling
|
|
87
|
+
const scanResult = await this.scanDirectoryRobust(options.path, options);
|
|
88
|
+
secretIssues = scanResult.issues;
|
|
89
|
+
filesScanned = scanResult.filesScanned;
|
|
90
|
+
filesSkipped = scanResult.filesSkipped;
|
|
91
|
+
}
|
|
92
|
+
allIssues.push(...secretIssues);
|
|
93
|
+
}
|
|
94
|
+
// Check memory usage after scanning
|
|
95
|
+
if (!this.memoryManager.checkLimit()) {
|
|
96
|
+
this.errorHandler.handleCriticalError(new Error(`Memory limit exceeded: ${this.memoryManager.formatMemorySize(this.memoryManager.getCurrentUsage())}`));
|
|
97
|
+
}
|
|
98
|
+
// Calculate summary
|
|
99
|
+
const summary = {
|
|
100
|
+
critical: allIssues.filter(i => i.severity === 'critical').length,
|
|
101
|
+
high: allIssues.filter(i => i.severity === 'high').length,
|
|
102
|
+
medium: allIssues.filter(i => i.severity === 'medium').length,
|
|
103
|
+
low: allIssues.filter(i => i.severity === 'low').length,
|
|
104
|
+
info: allIssues.filter(i => i.severity === 'info').length,
|
|
105
|
+
};
|
|
106
|
+
const duration = Date.now() - startTime;
|
|
107
|
+
const result = {
|
|
108
|
+
success: true,
|
|
109
|
+
timestamp: new Date().toISOString(),
|
|
110
|
+
duration,
|
|
111
|
+
filesScanned,
|
|
112
|
+
issues: allIssues,
|
|
113
|
+
summary,
|
|
114
|
+
};
|
|
115
|
+
// Calculate security score and add to result
|
|
116
|
+
const { score, breakdown } = this.calculateSecurityScore(result);
|
|
117
|
+
result.securityScore = score;
|
|
118
|
+
result.scoreBreakdown = breakdown;
|
|
119
|
+
// Save cache results
|
|
120
|
+
this.resultCache.save();
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
// Handle any unexpected errors during scanning
|
|
125
|
+
this.errorHandler.handleScanError(error);
|
|
126
|
+
// Return partial results if available
|
|
127
|
+
const duration = Date.now() - startTime;
|
|
128
|
+
return {
|
|
129
|
+
success: false,
|
|
130
|
+
timestamp: new Date().toISOString(),
|
|
131
|
+
duration,
|
|
132
|
+
filesScanned,
|
|
133
|
+
issues: allIssues,
|
|
134
|
+
summary: {
|
|
135
|
+
critical: allIssues.filter(i => i.severity === 'critical').length,
|
|
136
|
+
high: allIssues.filter(i => i.severity === 'high').length,
|
|
137
|
+
medium: allIssues.filter(i => i.severity === 'medium').length,
|
|
138
|
+
low: allIssues.filter(i => i.severity === 'low').length,
|
|
139
|
+
info: allIssues.filter(i => i.severity === 'info').length,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Scan specific files with robust handling
|
|
146
|
+
*/
|
|
147
|
+
async scanSpecificFiles(filePaths, options) {
|
|
148
|
+
const allIssues = [];
|
|
149
|
+
let processedFiles = 0;
|
|
150
|
+
// Initialize progress reporter if not in quiet mode
|
|
151
|
+
const progressReporter = new progress_reporter_1.ProgressReporter({
|
|
152
|
+
total: filePaths.length,
|
|
153
|
+
noProgress: options.verbose === false // Show progress unless explicitly quiet
|
|
154
|
+
});
|
|
155
|
+
progressReporter.start();
|
|
156
|
+
try {
|
|
157
|
+
for (const filePath of filePaths) {
|
|
158
|
+
try {
|
|
159
|
+
// Check cache first
|
|
160
|
+
const cachedResults = this.resultCache.get(filePath);
|
|
161
|
+
if (cachedResults) {
|
|
162
|
+
allIssues.push(...cachedResults);
|
|
163
|
+
progressReporter.increment();
|
|
164
|
+
processedFiles++;
|
|
165
|
+
continue;
|
|
166
|
+
}
|
|
167
|
+
// Check if file should be scanned
|
|
168
|
+
const fileInfo = this.fileTypeDetector.getFileInfo(filePath);
|
|
169
|
+
if (fileInfo.isBinary) {
|
|
170
|
+
if (options.verbose) {
|
|
171
|
+
console.log(`⏭️ Skipping binary file: ${filePath}`);
|
|
172
|
+
}
|
|
173
|
+
progressReporter.increment();
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
// Check memory before processing
|
|
177
|
+
if (!this.memoryManager.checkLimit()) {
|
|
178
|
+
this.errorHandler.handleCriticalError(new Error(`Memory limit exceeded while scanning: ${filePath}`));
|
|
179
|
+
}
|
|
180
|
+
let fileIssues;
|
|
181
|
+
// Use streaming for large files
|
|
182
|
+
if (fileInfo.shouldStream) {
|
|
183
|
+
if (options.verbose) {
|
|
184
|
+
console.log(`📄 Streaming large file: ${filePath} (${this.memoryManager.formatMemorySize(fileInfo.size)})`);
|
|
185
|
+
}
|
|
186
|
+
fileIssues = await this.fileStreamScanner.scanStream(filePath, fileInfo.encoding);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
// Use regular scanning for smaller files
|
|
190
|
+
fileIssues = this.secretScanner.scanFile(filePath);
|
|
191
|
+
}
|
|
192
|
+
// Cache the results
|
|
193
|
+
this.resultCache.set(filePath, fileIssues);
|
|
194
|
+
allIssues.push(...fileIssues);
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
// Handle file-specific errors gracefully
|
|
198
|
+
this.errorHandler.handleFileError(filePath, error);
|
|
199
|
+
}
|
|
200
|
+
progressReporter.increment();
|
|
201
|
+
processedFiles++;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
finally {
|
|
205
|
+
progressReporter.complete();
|
|
206
|
+
}
|
|
207
|
+
return allIssues;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Scan directory with robust handling and parallel processing
|
|
211
|
+
*/
|
|
212
|
+
async scanDirectoryRobust(dirPath, options) {
|
|
213
|
+
const allIssues = [];
|
|
214
|
+
let filesScanned = 0;
|
|
215
|
+
let filesSkipped = 0;
|
|
216
|
+
try {
|
|
217
|
+
// Get all files to scan (using existing directory traversal)
|
|
218
|
+
const tempIssues = this.secretScanner.scanDirectory(dirPath, options);
|
|
219
|
+
// Extract unique file paths from issues
|
|
220
|
+
const filePaths = [...new Set(tempIssues.map(issue => issue.file))];
|
|
221
|
+
if (filePaths.length === 0) {
|
|
222
|
+
return { issues: [], filesScanned: 0, filesSkipped: 0 };
|
|
223
|
+
}
|
|
224
|
+
// Initialize progress reporter
|
|
225
|
+
const progressReporter = new progress_reporter_1.ProgressReporter({
|
|
226
|
+
total: filePaths.length,
|
|
227
|
+
noProgress: options.verbose === false
|
|
228
|
+
});
|
|
229
|
+
progressReporter.start();
|
|
230
|
+
try {
|
|
231
|
+
// Check if parallel scanning is beneficial (>10 files)
|
|
232
|
+
if (filePaths.length > 10 && parallel_scanner_1.ParallelScanner.isSupported()) {
|
|
233
|
+
if (options.verbose) {
|
|
234
|
+
console.log(`🚀 Using parallel scanning with ${this.parallelScanner.getStats().workerCount} workers`);
|
|
235
|
+
}
|
|
236
|
+
// Use parallel scanning
|
|
237
|
+
const patterns = [
|
|
238
|
+
...(0, secret_patterns_1.getAllSecretPatterns)(),
|
|
239
|
+
...(0, additional_patterns_1.getAdditionalSecretPatterns)()
|
|
240
|
+
];
|
|
241
|
+
const results = await this.parallelScanner.scanFiles(filePaths, patterns, options.config?.ignore || []);
|
|
242
|
+
for (const result of results) {
|
|
243
|
+
if (result.error) {
|
|
244
|
+
this.errorHandler.handleFileError(result.file, new Error(result.error));
|
|
245
|
+
filesSkipped++;
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
// Cache the results
|
|
249
|
+
this.resultCache.set(result.file, result.issues);
|
|
250
|
+
allIssues.push(...result.issues);
|
|
251
|
+
filesScanned++;
|
|
252
|
+
}
|
|
253
|
+
progressReporter.increment();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
// Use sequential scanning with robust handling
|
|
258
|
+
for (const filePath of filePaths) {
|
|
259
|
+
try {
|
|
260
|
+
// Check cache first
|
|
261
|
+
const cachedResults = this.resultCache.get(filePath);
|
|
262
|
+
if (cachedResults) {
|
|
263
|
+
allIssues.push(...cachedResults);
|
|
264
|
+
filesScanned++;
|
|
265
|
+
progressReporter.increment();
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
// Check file type and handle appropriately
|
|
269
|
+
const fileInfo = this.fileTypeDetector.getFileInfo(filePath);
|
|
270
|
+
if (fileInfo.isBinary) {
|
|
271
|
+
if (options.verbose) {
|
|
272
|
+
console.log(`⏭️ Skipping binary file: ${filePath}`);
|
|
273
|
+
}
|
|
274
|
+
filesSkipped++;
|
|
275
|
+
progressReporter.increment();
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
// Check memory before processing
|
|
279
|
+
if (!this.memoryManager.checkLimit()) {
|
|
280
|
+
if (options.verbose) {
|
|
281
|
+
console.log(`⚠️ Memory limit approaching, triggering GC`);
|
|
282
|
+
}
|
|
283
|
+
this.memoryManager.triggerGC();
|
|
284
|
+
}
|
|
285
|
+
let fileIssues;
|
|
286
|
+
// Use streaming for large files
|
|
287
|
+
if (fileInfo.shouldStream) {
|
|
288
|
+
if (options.verbose) {
|
|
289
|
+
console.log(`📄 Streaming large file: ${filePath} (${this.memoryManager.formatMemorySize(fileInfo.size)})`);
|
|
290
|
+
}
|
|
291
|
+
fileIssues = await this.fileStreamScanner.scanStream(filePath, fileInfo.encoding);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
// Use regular scanning for smaller files
|
|
295
|
+
fileIssues = this.secretScanner.scanFile(filePath);
|
|
296
|
+
}
|
|
297
|
+
// Cache the results
|
|
298
|
+
this.resultCache.set(filePath, fileIssues);
|
|
299
|
+
allIssues.push(...fileIssues);
|
|
300
|
+
filesScanned++;
|
|
301
|
+
}
|
|
302
|
+
catch (error) {
|
|
303
|
+
// Handle file-specific errors gracefully
|
|
304
|
+
this.errorHandler.handleFileError(filePath, error);
|
|
305
|
+
filesSkipped++;
|
|
306
|
+
}
|
|
307
|
+
progressReporter.increment();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
progressReporter.complete();
|
|
313
|
+
}
|
|
314
|
+
return { issues: allIssues, filesScanned, filesSkipped };
|
|
315
|
+
}
|
|
316
|
+
catch (error) {
|
|
317
|
+
this.errorHandler.handleScanError(error);
|
|
318
|
+
return { issues: allIssues, filesScanned, filesSkipped };
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Calculate security score (0-100) with detailed breakdown
|
|
323
|
+
* - Start with base score of 100
|
|
324
|
+
* - Deduct points based on severity:
|
|
325
|
+
* - Critical: -20 points each
|
|
326
|
+
* - High: -10 points each
|
|
327
|
+
* - Medium: -5 points each
|
|
328
|
+
* - Low: -2 points each
|
|
329
|
+
* - Minimum score is 0
|
|
330
|
+
*
|
|
331
|
+
* This calculation is deterministic - same inputs always produce same output
|
|
332
|
+
*/
|
|
333
|
+
calculateSecurityScore(result) {
|
|
334
|
+
const { critical, high, medium, low } = result.summary;
|
|
335
|
+
// Base score (perfect security)
|
|
336
|
+
const baseScore = 100;
|
|
337
|
+
// Calculate deductions
|
|
338
|
+
const criticalDeduction = critical * 20;
|
|
339
|
+
const highDeduction = high * 10;
|
|
340
|
+
const mediumDeduction = medium * 5;
|
|
341
|
+
const lowDeduction = low * 2;
|
|
342
|
+
// Calculate final score
|
|
343
|
+
const totalDeduction = criticalDeduction + highDeduction + mediumDeduction + lowDeduction;
|
|
344
|
+
const finalScore = Math.max(0, baseScore - totalDeduction);
|
|
345
|
+
const breakdown = {
|
|
346
|
+
baseScore,
|
|
347
|
+
criticalDeduction,
|
|
348
|
+
highDeduction,
|
|
349
|
+
mediumDeduction,
|
|
350
|
+
lowDeduction,
|
|
351
|
+
finalScore
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
score: finalScore,
|
|
355
|
+
breakdown
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Get total pattern count
|
|
360
|
+
*/
|
|
361
|
+
getPatternCount() {
|
|
362
|
+
return (0, secret_patterns_1.getAllSecretPatterns)().length + (0, additional_patterns_1.getAdditionalSecretPatterns)().length;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Get memory statistics
|
|
366
|
+
*/
|
|
367
|
+
getMemoryStats() {
|
|
368
|
+
return this.memoryManager.getStats();
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Get cache statistics
|
|
372
|
+
*/
|
|
373
|
+
getCacheStats() {
|
|
374
|
+
return this.resultCache.getStats();
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Get error statistics
|
|
378
|
+
*/
|
|
379
|
+
getErrorStats() {
|
|
380
|
+
return {
|
|
381
|
+
totalErrors: this.errorHandler.getErrorCount(),
|
|
382
|
+
errorsByType: this.errorHandler.getErrorSummary(),
|
|
383
|
+
hasErrors: this.errorHandler.hasErrors()
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Format scan result as JSON
|
|
388
|
+
*/
|
|
389
|
+
formatAsJSON(result, options) {
|
|
390
|
+
// Convert ScanResult to JSONOutputFormatter format
|
|
391
|
+
const formatterResult = this.convertToFormatterResult(result);
|
|
392
|
+
return this.jsonFormatter.format(formatterResult, options);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Clear all caches and reset state
|
|
396
|
+
*/
|
|
397
|
+
clearCache() {
|
|
398
|
+
this.resultCache.clear();
|
|
399
|
+
this.errorHandler.clearErrors();
|
|
400
|
+
this.memoryManager.reset();
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Cleanup resources
|
|
404
|
+
*/
|
|
405
|
+
async cleanup() {
|
|
406
|
+
// Save cache before cleanup
|
|
407
|
+
this.resultCache.save();
|
|
408
|
+
// Terminate parallel scanner workers
|
|
409
|
+
await this.parallelScanner.terminate();
|
|
410
|
+
// Clear errors
|
|
411
|
+
this.errorHandler.clearErrors();
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Convert ScanResult to JSONOutputFormatter format
|
|
415
|
+
*/
|
|
416
|
+
convertToFormatterResult(result) {
|
|
417
|
+
// This is a simplified conversion - in a real implementation,
|
|
418
|
+
// you'd need to properly map all fields
|
|
419
|
+
return {
|
|
420
|
+
success: result.success,
|
|
421
|
+
issues: result.issues.map(issue => ({
|
|
422
|
+
id: issue.id,
|
|
423
|
+
type: issue.type,
|
|
424
|
+
severity: issue.severity,
|
|
425
|
+
message: issue.description,
|
|
426
|
+
filePath: issue.file,
|
|
427
|
+
lineNumber: issue.line || 0,
|
|
428
|
+
columnNumber: issue.column,
|
|
429
|
+
match: issue.code || '',
|
|
430
|
+
context: issue.code,
|
|
431
|
+
confidence: 0.9, // Default confidence
|
|
432
|
+
ruleId: issue.id.split('-')[0],
|
|
433
|
+
ruleName: issue.title
|
|
434
|
+
})),
|
|
435
|
+
summary: {
|
|
436
|
+
total: result.issues.length,
|
|
437
|
+
critical: result.summary.critical,
|
|
438
|
+
high: result.summary.high,
|
|
439
|
+
medium: result.summary.medium,
|
|
440
|
+
low: result.summary.low,
|
|
441
|
+
byType: {},
|
|
442
|
+
byFile: {}
|
|
443
|
+
},
|
|
444
|
+
securityScore: result.securityScore || 0,
|
|
445
|
+
metadata: {
|
|
446
|
+
avanaVersion: '1.0.0',
|
|
447
|
+
scanId: `scan-${Date.now()}`,
|
|
448
|
+
startTime: result.timestamp,
|
|
449
|
+
endTime: result.timestamp,
|
|
450
|
+
duration: result.duration,
|
|
451
|
+
filesScanned: result.filesScanned,
|
|
452
|
+
filesSkipped: 0,
|
|
453
|
+
filesIgnored: 0,
|
|
454
|
+
totalFiles: result.filesScanned,
|
|
455
|
+
scanOptions: {
|
|
456
|
+
verbose: false,
|
|
457
|
+
debug: false,
|
|
458
|
+
quiet: false,
|
|
459
|
+
patterns: [],
|
|
460
|
+
ignorePatterns: [],
|
|
461
|
+
maxFileSize: 10 * 1024 * 1024,
|
|
462
|
+
parallel: true
|
|
463
|
+
},
|
|
464
|
+
environment: {
|
|
465
|
+
nodeVersion: process.version,
|
|
466
|
+
platform: process.platform,
|
|
467
|
+
arch: process.arch,
|
|
468
|
+
cwd: process.cwd()
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
exports.Avana = Avana;
|
|
475
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,0CAAwB;AACxB,4DAA0C;AAC1C,0DAAwC;AACxC,8DAA4C;AAE5C,8DAA0D;AAE1D,6D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E,IAAI;iBACf;gBACD,WAAW,EAAE;oBACX,WAAW,EAAE,OAAO,CAAC,OAAO;oBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;iBACnB;aACF;SACF,CAAC;IACJ,CAAC;CACF;AAxfD,sBAwfC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avana - Additional Secret Patterns
|
|
3
|
+
* Extended patterns for less common but still important services
|
|
4
|
+
*/
|
|
5
|
+
import type { SecretPattern } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Additional secret patterns for specialized services
|
|
8
|
+
* NOTE: Only includes high-confidence patterns with specific prefixes or context
|
|
9
|
+
*/
|
|
10
|
+
export declare const ADDITIONAL_SECRET_PATTERNS: SecretPattern[];
|
|
11
|
+
export declare function getAdditionalSecretPatterns(): SecretPattern[];
|
|
12
|
+
//# sourceMappingURL=additional-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"additional-patterns.d.ts","sourceRoot":"","sources":["../../src/rules/additional-patterns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,aAAa,EAgKrD,CAAC;AAEF,wBAAgB,2BAA2B,IAAI,aAAa,EAAE,CAE7D"}
|