npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

node-protect

v1.1.0

Published

Security scanner for Node.js projects checking for OWASP Top 10 risks

Downloads

209

Readme

Node-Protect 🛡️

A lightweight, zero-config security scanner for Node.js applications.
Detects vulnerabilities from the OWASP Top 10 without blocking your workflow.

License: ISC Values: Warning Only

🚀 Key Features

  • Non-blocking: Runs in the background and warns you about issues. It never crashes your app.
  • Zero Config: Works out of the box. Just install and run.
  • Comprehensive Coverage: Checks for issues across the OWASP Top 10 (2021).

What it Checks

| Category | Description | | :--- | :--- | | A01 Broken Access Control | Permissive CORS, hardcoded role checks | | A02 Cryptographic Failures | Weak hashing (MD5/SHA1), hardcoded IVs | | A03 Injection | eval(), innerHTML, unsafe SQL interpolation | | A04 Insecure Design | Leaky headers (X-Powered-By) | | A05 Misconfiguration | Debug mode on, hardcoded ports | | A06 Vulnerable Components | Wraps npm audit to check dependencies | | A07 Authentication Failures | Hardcoded Secrets (AWS keys, API tokens, passwords) | | A08 Integrity Failures | Missing SRI, integrity checks | | A09 Logging Failures | console.log usage, empty catch blocks | | A10 SSRF | Unsafe data fetching in axios/fetch |


📦 Installation

Install as a development dependency:

npm install --save-dev node-protect

💻 Usage

1. As a CLI Tool

Great for CI/CD pipelines or local checks.

# Scan current directory
npx protect scan .

# Scan specific folder
npx protect scan ./src

# Scan only for secrets and code issues (skip dependencies)
npx protect scan . --type=secrets,code

2. As a Library (Programmatic)

Perfect for adding a security check to your server startup sequence. It runs asynchronously ("fire-and-forget").

Example: Express Server Integration

/* index.js */
const http = require('http');
const { protect } = require('node-protect');

console.log('--- Server Startup ---');

// 1. Run security scan in background
// It will log warnings if found, but won't stop the server
protect();

// 2. Start your server immediately
http.createServer((req, res) => {
    res.writeHead(200);
    res.end('Hello Secure World!');
}).listen(3000, () => {
    console.log('Server running on port 3000');
});

Custom Handling

If you want to wait for results or handle them manually:

const { protect, printReport } = require('node-protect');

// Await the results
protect(process.cwd(), { types: ['full'], log: false }).then(results => {
  if (results.length > 0) {
    console.error(`🚨 Found ${results.length} vulnerabilities!`);
    printReport(results); // Pretty print to console
    // process.exit(1); // Optional: Exit if you want to block
  } else {
    console.log('✅ App is secure.');
  }
});

🛠️ Configuration

The protect() function accepts an options object:

interface ScanOptions {
    log?: boolean;       // Default: true (Auto-print warnings to console)
    types?: string[];    // Default: ['full']. Options: 'secrets', 'code', 'dependencies'
}

📝 License

ISC