
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
detect-secrets-js
Advanced tools
A JavaScript wrapper for Yelp's detect-secrets tool to scan codebases for secrets
A JavaScript wrapper for Yelp's detect-secrets tool to scan codebases for secrets.
You can install the package globally:
npm install -g detect-secrets-js
Or as a development dependency in your project:
npm install --save-dev detect-secrets-js
The installation process will automatically install the required Python dependencies.
After installing the package, you can use the detect-secrets-js
command:
detect-secrets-js [directory] [options]
If no directory is specified, the current directory will be scanned.
-r, --root
: Scan from project root-c, --check-missed
: Check for potentially missed secrets-v, --verbose
: Include additional information-o, --output <file>
: Output file path-ef, --exclude-files <patterns...>
: File patterns to exclude-ed, --exclude-dirs <patterns...>
: Directory patterns to exclude--version
: Show version number--help
: Show helpScan the current directory:
detect-secrets-js
Scan from project root and check for missed secrets:
detect-secrets-js -r -c
Exclude certain files and directories:
detect-secrets-js -ef "*.md" "*.txt" -ed ".git" "node_modules"
Save results to a file:
detect-secrets-js -o results.txt
You can also use the package programmatically in your Node.js code:
const { scanForSecrets } = require('detect-secrets-js');
async function findSecrets() {
try {
const results = await scanForSecrets({
directory: './src',
root: true,
checkMissed: true,
excludeDirs: ['node_modules', 'dist']
});
console.log(results);
} catch (error) {
console.error('Error scanning for secrets:', error);
}
}
findSecrets();
The scanner outputs results in a grouped format:
File: path/to/file.py
Line: 42
Types: Base64 High Entropy String, Secret Keyword
This format shows:
MIT
The repository includes test files in the test_files
directory that contain various types of secrets for testing purposes:
config.py
: Contains API keys, database connection strings, and other configuration valuesexample.json
: Contains AWS access keys and other JSON-formatted secretsFAQs
A JavaScript implementation of Yelp's detect-secrets tool - no Python required
The npm package detect-secrets-js receives a total of 16 weekly downloads. As such, detect-secrets-js popularity was classified as not popular.
We found that detect-secrets-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.