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

webshield-sdk

v1.2.5

Published

Enterprise-Grade Plug-and-Play Security SDK & WAF for Node.js/Express. Protects against DDoS, XSS, NoSQLi, SQLi, CSRF, and data leaks.

Readme

WebShield SDK 🛡️

Install → Add middleware → You're protected. No config. No API key. No bullshit.

npm version npm downloads license

An enterprise-grade, plug-and-play Security SDK, Web Application Firewall (WAF), and Threat Intelligence middleware designed to secure Node.js (Express) backends against malicious requests, brute-force exploits, automated scrapers, and sensitive credential leakage.

npm install webshield-sdk

🎁 What You Get (Features & Layout)

By installing WebShield, you get a comprehensive, unified security suite that integrates features traditionally requiring 10+ separate npm packages:

  • 🛡️ Core Threat Scoring Engine (src/core/threatScore.js): Real-time heuristics scanning (XSS tags, SQL Injection sequences, NoSQL operators) that maps request threat levels (0–100) and triggers automated responses.
  • 💻 Command Line Tool (CLI): Out-of-the-box npx webshield init to generate configurations and npx webshield dashboard to spin up a dynamic HTML logs monitor viewer.
  • 👤 Device Fingerprinting (Canvas + WebGL): Client-side tag (/webshield/fp.js) that renders a hidden canvas and queries WebGL GPU renderer variables to compile a unique hardware device signature, tracking malicious VPN/Proxy bots.
  • 📝 WAF Custom DSL Rules: Evaluate custom logical rules like if (path.includes("confidential")) block() dynamically at runtime.
  • 📡 Standalone Reverse Proxy Gateway (bin/proxy.js): Sit in front of any application server on a separate port and filters all request streams.
  • 🔄 Dynamic Signature Auto-Patching: Background auto-downloader (autoPatch) that periodically hot-patches WAF regex rules from threat feeds.
  • 🚦 Distributed Rate Limiting (src/middleware/rateLimiter.js): Sliding window rate limiting backed by Redis (using ioredis) for multi-server setups with automatic in-memory fallback.
  • 🪓 Decoy Honeypot Traps (src/middleware/honeypot.js): Instantly bans attackers attempting to scan directories like /.env or /wp-admin.
  • 🌎 Geo-Location & CIDR IP Intelligence (src/middleware/ipBlocker.js): Restricts access from specific countries (via geoip-lite) and blocks custom IP CIDR ranges (e.g., 203.0.113.0/24).
  • 🔐 Secret Leak Guard: Automatically scans, blocks, and redacts leaked API keys (AWS, Google APIs, Stripe Live Keys, JWT structures) inside query strings or body data.
  • 📊 Live Event Logs Visualizer: A real-time dashboard served directly at /webshield/dashboard on your local server.
  • 🧬 Dynamic CORS Engine (src/middleware/corsGuard.js): Safe dynamic origin evaluations using RegEx or IP checks to eliminate client integration errors.
  • 🔒 Zero-Trust System Isolation Mode: Emergency lockdown (isolated: true) that restricts your server only to IP allowlists during active incident responses.

🌟 Key Benefits of WebShield SDK

  1. Unified Middleware footprint: Replaces helmet, cors, express-rate-limit, express-mongo-sanitize, xss-clean, and hpp with a single, highly-optimized client stack.
  2. Adaptive Security Tiers: Instead of simple binary blocking, requests are graded into Low, Medium, and Critical risks. Medium risks can be configured to request CAPTCHAs or MFA challenge triggers, preserving customer experience.
  3. Distributed & Fault-Tolerant: Real-time rate limits sync across nodes using Redis. If Redis goes down, WebShield automatically reverts to in-memory mode, keeping your API online while sending alert emails to the admin.
  4. Zero-Trust Honeypots: Traps standard bot scanning paths to ban malicious scanner IPs before they hit your real business routes.
  5. Tamper-Resistant Runtime: Uses Object.freeze to lock active security configurations in memory, preventing prototype pollution or runtime memory exploits.

⚡ How to Use

Setting up WebShield in your Express application is simple and requires only a few lines of code.

1. Basic Integration

const express = require('express');
const { webShield } = require('webshield-sdk');

const app = express();
app.use(express.json());

// Enable Zero-Config WebShield Security SDK
app.use(webShield());

app.listen(3000, () => console.log('Secure server running on port 3000'));

2. Advanced Enterprise Configuration

const express = require('express');
const { webShield, plugins } = require('webshield-sdk');

const app = express();
app.use(express.json());

app.use(webShield({
  apiKey: "optional_saas_license_key", // Optional: Only required for remote cloud dashboard synchronization
  mode: "strict",
  isolated: false, // True to trigger emergency lockdown mode (allowlist only)

  // Whitelisted IPs that bypass WAF rules and Rate Limits
  allowlist: ['127.0.0.1', '192.168.1.50'],

  // Distributed Rate Limit Configuration
  redis: {
    enabled: true,
    host: '127.0.0.1',
    port: 6379,
    keyPrefix: 'webshield:'
  },

  // Core Security Settings
  protection: {
    xss: true,
    csrf: true,
    sqlInjection: true,
    nosqlInjection: true,
    secureCookies: true,
    headers: true
  },

  // Threat Limits
  rateLimit: {
    windowMs: 60000, // 1 minute
    max: 100,        // Max 100 requests per window
    burstMax: 10     // Max 10 requests per second (DDoS block)
  },

  // Traps for malicious crawler bots
  honeypot: {
    enabled: true,
    paths: ['/.env', '/admin', '/wp-admin', '/config.json']
  },

  // Custom CORS Controls
  cors: {
    mode: 'dynamic',
    allowedOrigins: ['https://my-app.com', /^https:\/\/.*\.vercel\.app$/]
  },

  // Active Plugins
  plugins: [
    plugins.botDetectionPlugin({ blockCrawlers: true }),
    plugins.ddosPlugin({ limit: 150 })
  ]
}));

📊 Feature Comparison Matrix

Instead of chaining separate, disjointed middleware packages, WebShield combines everything into one unified, low-overhead pipeline:

| Capability | WebShield SDK | Helmet | express-rate-limit | CORS | | :--- | :--- | :--- | :--- | :--- | | Security Headers | 🟢 Yes (Full) | 🟢 Yes (Full) | 🔴 No | 🔴 No | | Distributed Rate Limiting | 🟢 Yes (Redis + Local Fallback) | 🔴 No | 🟡 Partial (Basic Store) | 🔴 No | | Heuristics Payload Scan | 🟢 Yes (XSS, SQLi, NoSQLi) | 🔴 No | 🔴 No | 🔴 No | | Secret Leak Blocker | 🟢 Yes (Scrub & Redact) | 🔴 No | 🔴 No | 🔴 No | | Zero-Trust Honeypots | 🟢 Yes (Instant Ban) | 🔴 No | 🔴 No | 🔴 No | | Interactive challenged mode | 🟢 Yes (Low-Latency Scoring) | 🔴 No | 🔴 No | 🔴 No | | Telemetry Analytics Dashboard | 🟢 Yes (/webshield/dashboard) | 🔴 No | 🔴 No | 🔴 No |


⚡ Performance Benchmarks

WebShield is built on highly optimized, asynchronous in-memory data structures to ensure near-zero overhead:

  • Average Latency Overhead: < 0.45 ms (evaluated over 50,000 requests)
  • Max Request Throughput: 15,000+ req/sec per Node.js worker instance
  • Peak memory footprint: < 15 MB (excluding Redis socket cache buffer)
  • WAF Rule Evaluation: Compiled regular expressions are evaluated in O(1) runtime operations.

🔌 Plugin Marketplace & Extensibility

Developers can build or install custom plugin hooks to extend the WAF rules and threat calculations. Simply pass functions returning async (req, res, config) into the plugins configuration array:

app.use(webShield({
  plugins: [
    // Pre-bundled core plugins
    plugins.botDetectionPlugin({ blockCrawlers: true }),
    plugins.ddosPlugin({ limit: 120 }),

    // Custom organization security plugin
    async (req, res, config) => {
      if (req.headers['x-internal-token'] === 'malicious') {
        req.webShieldState.blocked = true;
        return res.status(403).send('Forbidden: Malicious token detected.');
      }
    }
  ]
}));

📖 Developer Documentation Website

A complete interactive documentation site is bundled in the SDK repository. You can open docs/index.html in your browser to view developer configuration templates, search reference variables, and check architectural workflows.


🛠️ Testing & Verification

To verify that your installation is working correctly, you can run the built-in demo server:

  1. Install dependencies:

    npm install
  2. Run the automated test suite:

    npm test

    (Executes the unit tests in test.js validating WAF heuristics and CORS behaviors)

  3. Run real-world performance benchmarks:

    npm run benchmark

    (Stress-tests the scoring engine over 100,000 requests, displaying microsecond latency metrics)

  4. Execute the command-line utility:

    # Generate defaultConfig webshield.config.js settings
    npx webshield init
    
    # Launch diagnostics dashboard listener on port 9999
    npx webshield dashboard
  5. Run the Standalone Reverse Proxy Gateway:

    BACKEND_URL=http://localhost:3000 PROXY_PORT=8080 node bin/proxy.js
  6. Simulate Attack Vectors: Ensure the test application is active (npm start), then execute the simulation suite:

    node bin/simulator.js

    (Sends mock XSS, SQLi, and honeypot requests to verify active protection blocks)

  7. Run Artillery Load Testing: Launch the target server (npm start), then fire simulated virtual user spikes:

    npx artillery run loadtest.yml

    (Ramps concurrent requests up to 100 users/sec to profile WAF thread performance)


🧵 Production Multi-Core Scaling

Node.js executes on a single CPU thread by default. To scale WebShield across all available CPU cores, start your application in Cluster Mode using PM2:

# Install PM2 globally
npm install -g pm2

# Spin up application instances mapped to all available CPU cores
pm2 start test_app.js -i max

This distributes incoming traffic requests evenly, maximizing throughput scalability.


🚀 CI/CD Pipeline

WebShield features a built-in CI/CD workflow located in .github/workflows/ci.yml. It automatically runs checks across Node.js v18, v20, and v22 on every pull request or push.


🔐 Privacy & Telemetry

WebShield runs completely locally within your server node infrastructure. Refer to the PRIVACY.md file for more information regarding IP scanning, log volume sampling, and cloud-sync settings.