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

securitywatch

v1.0.9

Published

Score-based runtime security middleware for Express. SQL injection, XSS, brute force, rate limiting, IP reputation.

Downloads

2,309

Readme

SecurityWatch

npm version npm downloads license NPM Version

Website: https://securitywatch.sandeepsharmadev.in/

Score-based runtime security middleware for Express. Detects SQL injection, XSS, brute force, rate limit abuse, and suspicious request patterns.

Install

npm install securitywatch
import express from "express";
import { securityWatch } from "securitywatch";

const app = express();
app.use(securityWatch());
app.listen(3000);

How it works

Each incoming request is scanned by multiple detection rules. Every rule returns a numeric score (not a binary yes/no). Scores are summed, multiplied by route sensitivity, and compared against thresholds:

  • 0-4 — allow
  • 5-9 — warn (request passes, threat info attached to req.securityWatch)
  • 10-14 — throttle (429 response)
  • 15+ — block (403 response)

This reduces false positives compared to binary blocking.

Configuration

app.use(securityWatch({
  sqlInjection: true,
  xss: true,
  bruteForce: {
    maxAttempts: 5,
    windowMs: 5 * 60_000,
    blockDurationMs: 15 * 60_000,
    authRoutes: ["/login", "/auth"],
  },
  rateLimit: {
    windowMs: 60_000,
    maxRequests: 100,
    routes: { "/login": 5, "/api": 60 },
  },
  suspiciousBehavior: true,
  payloadAnomaly: true,
  ipReputation: true,

  // low=0.5x, medium=1x (default), high=1.5x, critical=2x
  routeSensitivity: {
    "/admin": "critical",
    "/login": "high",
    "/search": "low",
  },

  thresholds: { warn: 5, throttle: 10, block: 15 },
  whitelist: ["127.0.0.1"],
  trustProxy: false, // set true only behind a trusted reverse proxy

  alerts: {
    console: true,
    slackWebhookUrl: "https://hooks.slack.com/services/...",
  },

  onBlock: (req, info) => console.log(`Blocked: ${info.ip}`),
  onWarn: (req, info) => console.log(`Warning: ${info.ip}`),
}));

Detection rules

Security notes

  • All regex uses bounded quantifiers. Input truncated to 20K chars before scanning.
  • X-Forwarded-For ignored by default. Set trustProxy: true only behind a trusted proxy.
  • Slack webhook URLs validated against hooks.slack.com (HTTPS only).
  • Internal errors are caught and logged. Requests proceed normally (fail-open).
  • Headers scanned: Referer, User-Agent, Cookie, Origin.
  • Memory bounded: IP tracking capped at 10K, route tracking at 100/IP, rate-limit keys normalized.

Requirements

  • Node.js >= 18
  • Express >= 5

License

MIT