@mathiscode/codebase-scanner
Advanced tools
Comparing version
@@ -13,17 +13,8 @@ import { describe, it, expect } from '@jest/globals' | ||
// Ensure Signatures is an array | ||
expect(Array.isArray(Signatures)).toBe(true) | ||
// Get unique names of all defined signatures | ||
const allSignatureNames = new Set(Signatures.map(sig => sig.name)) | ||
expect(allSignatureNames.size).toBeGreaterThan(0) // Make sure signatures loaded | ||
expect(allSignatureNames.size).toBeGreaterThan(0) | ||
// Run the scan | ||
console.log(`Scanning directory: ${samplesDir}`) | ||
const rawResults = await iterateFiles(samplesDir, scanOptions) | ||
// Flatten results and filter out potential undefined/null values | ||
const flatResults = deepFlatten(rawResults).filter(r => r && typeof r === 'object') | ||
// Get unique names of triggered signatures from the results | ||
const triggeredSignatureNames = new Set( | ||
@@ -35,17 +26,11 @@ flatResults | ||
// Find which signatures defined in Signatures were NOT triggered | ||
const missingSignatures = [] | ||
for (const name of allSignatureNames) { | ||
if (!triggeredSignatureNames.has(name)) { | ||
missingSignatures.push(name) | ||
} | ||
if (!triggeredSignatureNames.has(name)) missingSignatures.push(name) | ||
} | ||
// Assert that the list of missing signatures is empty | ||
if (missingSignatures.length > 0) { | ||
console.error('Missing Signatures:', missingSignatures) | ||
} | ||
if (missingSignatures.length > 0) console.error('Missing Signatures:', missingSignatures) | ||
expect(missingSignatures).toEqual([]) | ||
}, 60000) // Set a longer timeout (e.g., 60 seconds) for file I/O | ||
}, 60000) | ||
}) |
{ | ||
"name": "@mathiscode/codebase-scanner", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Scan a codebase for malware signatures", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -87,2 +87,9 @@ # Codebase Scanner | ||
### Install as a CLI | ||
```bash | ||
npm install -g @mathiscode/codebase-scanner@latest | ||
codebase-scanner --help | ||
``` | ||
--- | ||
@@ -89,0 +96,0 @@ |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
40309
1.16%765
1.32%152
4.83%1
Infinity%