ferret-scan 1.0.0 → 1.0.2
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/dist/scanner/Scanner.js +26 -2
- package/package.json +2 -2
package/dist/scanner/Scanner.js
CHANGED
|
@@ -11,6 +11,7 @@ import { analyzeCorrelations, shouldAnalyzeCorrelations } from '../analyzers/Cor
|
|
|
11
11
|
import { loadThreatDatabase } from '../intelligence/ThreatFeed.js';
|
|
12
12
|
import { matchIndicators, shouldMatchIndicators } from '../intelligence/IndicatorMatcher.js';
|
|
13
13
|
import logger from '../utils/logger.js';
|
|
14
|
+
import ora from 'ora';
|
|
14
15
|
/**
|
|
15
16
|
* Create an empty scan summary
|
|
16
17
|
*/
|
|
@@ -174,12 +175,20 @@ export async function scan(config) {
|
|
|
174
175
|
const startTime = new Date();
|
|
175
176
|
const allFindings = [];
|
|
176
177
|
const errors = [];
|
|
178
|
+
const showProgress = !config.ci && process.stdout.isTTY;
|
|
177
179
|
logger.info(`Starting scan of ${config.paths.length} path(s)`);
|
|
178
|
-
// Discover files
|
|
180
|
+
// Discover files with spinner
|
|
181
|
+
let spinner = null;
|
|
182
|
+
if (showProgress) {
|
|
183
|
+
spinner = ora('Discovering files...').start();
|
|
184
|
+
}
|
|
179
185
|
const discovery = discoverFiles(config.paths, {
|
|
180
186
|
maxFileSize: config.maxFileSize,
|
|
181
187
|
ignore: config.ignore,
|
|
182
188
|
});
|
|
189
|
+
if (spinner) {
|
|
190
|
+
spinner.succeed(`Discovered ${discovery.files.length} files to scan (${discovery.skipped} skipped)`);
|
|
191
|
+
}
|
|
183
192
|
// Add discovery errors
|
|
184
193
|
for (const error of discovery.errors) {
|
|
185
194
|
errors.push({
|
|
@@ -191,9 +200,19 @@ export async function scan(config) {
|
|
|
191
200
|
if (discovery.files.length === 0) {
|
|
192
201
|
logger.warn('No files found to scan');
|
|
193
202
|
}
|
|
194
|
-
// Scan each file
|
|
203
|
+
// Scan each file with progress
|
|
204
|
+
const totalFiles = discovery.files.length;
|
|
205
|
+
let scannedCount = 0;
|
|
206
|
+
let findingsCount = 0;
|
|
207
|
+
if (showProgress && totalFiles > 0) {
|
|
208
|
+
spinner = ora(`Scanning files... 0/${totalFiles}`).start();
|
|
209
|
+
}
|
|
195
210
|
for (const file of discovery.files) {
|
|
196
211
|
logger.debug(`Scanning: ${file.relativePath}`);
|
|
212
|
+
if (spinner && totalFiles > 10) {
|
|
213
|
+
// Only update spinner text for larger scans to avoid flicker
|
|
214
|
+
spinner.text = `Scanning ${scannedCount + 1}/${totalFiles}: ${file.relativePath.slice(-50)}${findingsCount > 0 ? ` (${findingsCount} findings)` : ''}`;
|
|
215
|
+
}
|
|
197
216
|
const result = scanFile(file, config);
|
|
198
217
|
if (result.error) {
|
|
199
218
|
errors.push({
|
|
@@ -203,6 +222,11 @@ export async function scan(config) {
|
|
|
203
222
|
});
|
|
204
223
|
}
|
|
205
224
|
allFindings.push(...result.findings);
|
|
225
|
+
scannedCount++;
|
|
226
|
+
findingsCount = allFindings.length;
|
|
227
|
+
}
|
|
228
|
+
if (spinner) {
|
|
229
|
+
spinner.succeed(`Scanned ${totalFiles} files${findingsCount > 0 ? ` - found ${findingsCount} issues` : ' - no issues found'}`);
|
|
206
230
|
}
|
|
207
231
|
// Cross-file correlation analysis if enabled
|
|
208
232
|
if (shouldAnalyzeCorrelations(discovery.files, config)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ferret-scan",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Security scanner for AI CLI configurations - detect prompt injections, credential leaks, and malicious patterns in AI agent configs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"ignore": "^5.3.1",
|
|
103
103
|
"ora": "^8.0.1",
|
|
104
104
|
"table": "^6.8.1",
|
|
105
|
+
"typescript": "^5.0.0",
|
|
105
106
|
"yaml": "^2.3.4"
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
@@ -113,7 +114,6 @@
|
|
|
113
114
|
"eslint": "^8.56.0",
|
|
114
115
|
"jest": "^29.7.0",
|
|
115
116
|
"ts-jest": "^29.1.1",
|
|
116
|
-
"typescript": "^5.9.3",
|
|
117
117
|
"typescript-eslint": "^8.54.0"
|
|
118
118
|
}
|
|
119
119
|
}
|