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

sec-gate

v0.2.1

Published

Pre-commit security gate for OWASP Top 10 2021 — SAST, SCA and misconfig checks for Node/Express, Go and React codebases

Readme

npm version npm downloads License: MIT Node.js OWASP Top 10

A pre-commit security gate that automatically blocks vulnerable code before every git commit. Covers SAST · SCA · Misconfigurations · SQL Injection · Hardcoded Secrets and more.

  git commit  →  sec-gate scans  →  vulnerability?  →  BLOCKED ✗
                                 →  clean?          →  committed ✓

⚡ Quick Start

# Step 1 — Install globally (once per machine)
npm install -g sec-gate

# Step 2 — Hook into your repo (once per clone)
cd your-project
sec-gate install

# Step 3 — Commit as normal — scans run automatically
git commit -m "your changes"

That's it. No config needed. No extra tools to install. Everything is bundled.


🛡️ What gets scanned

| Layer | Tool | What it catches | |:---:|:---:|:---| | SAST | Semgrep + AST rules | SQL injection, XSS, command injection, hardcoded secrets | | SCA | OSV-Scanner | Known CVEs in npm/pnpm/yarn dependencies | | GO | govulncheck | Known CVEs in Go modules | | CUSTOM | acorn AST walker | Prototype pollution, insecure random, eval injection |


🔴 What blocked output looks like

sec-gate: scan started (staged files)
sec-gate: excluding 3 high-noise rule(s)
sec-gate: scanning src/services/payment.js (js) with owasp-top10 rules...

sec-gate: SECURITY FINDINGS (commit blocked):

- src/services/payment.js:40 [CRITICAL] [sql-injection-template-literal] (A03:2021 Injection)
  SQL query built with template literal interpolation.
  Use parameterized queries: sequelize.query(sql, { replacements: [...] })

- src/services/payment.js:82 [LOW] [insecure-object-assign] (A01:2021)
  Object.assign with potentially user-controlled data.

- package-lock.json [OSV:GHSA-r5fr-rjxr-66jc]
  lodash: vulnerable to Code Injection via _.template

🟢 What a clean commit looks like

sec-gate: scan started (staged files)
sec-gate: excluding 3 high-noise rule(s)
sec-gate: all checks passed — no vulnerabilities found by sec-gate
sec-gate: checks ran: SAST (3 files), SCA-node (package-lock.json)

🗂️ OWASP Top 10 (2021) Coverage

| # | Category | Status | |:---:|:---|:---:| | A01 | Broken Access Control | covered | | A02 | Cryptographic Failures | covered | | A03 | Injection (SQL · XSS · CMD) | covered | | A04 | Insecure Design | covered | | A05 | Security Misconfiguration | covered | | A06 | Vulnerable Components | covered | | A07 | Authentication Failures | covered | | A08 | Software Integrity Failures | covered | | A09 | Security Logging Failures | covered | | A10 | Server-Side Request Forgery | covered |


🔧 All Commands

sec-gate install        # Install/inject pre-commit hook (auto-detects husky, lefthook etc.)
sec-gate scan           # Scan all tracked files
sec-gate scan --staged  # Scan only staged files
sec-gate doctor         # Diagnose installation issues
sec-gate --version      # Print installed version
sec-gate --help         # Show help

🔕 Suppressing False Positives

Two formats supported — use whichever you prefer:

Short format (quick)

// sec-gate-disable: sql-injection-template-literal
const rawQuery = `SELECT * FROM payments WHERE status = '${status}'`;

Long format (recommended for PRs — shows reason)

// security-scan: disable rule-id: sql-injection-template-literal reason: status validated against enum
const rawQuery = `SELECT * FROM payments WHERE status = '${status}'`;

Suppress all rules on a line

// sec-gate-disable: *
dangerousLegacyFunction();

⚙️ Configuration (.sec-gate.yml)

Create this file in your project root to tune the scanner:

# .sec-gate.yml

# Block only on high/critical findings
severity_threshold: high

# Exclude specific rules globally
exclude_rules:
  - path-join-resolve-traversal
  - detect-non-literal-regexp

# Skip test and mock files
exclude_paths:
  - "**/__tests__/**"
  - "**/*.test.js"
  - "**/mocks/**"

# Toggle scanners
sca: true
custom_rules: true

| Value | Blocks on | |---|---| | all (default) | Every finding | | high | High + Critical only | | critical | Critical only | | medium | Medium + High + Critical | | low | Everything (same as all) |


🪝 Hook Manager Support

sec-gate install automatically detects your hook manager — no manual config needed:

| Tool | Detection | Auto-injected | |:---:|:---:|:---:| | Husky | .husky/ directory | ✅ .husky/pre-commit | | Husky | package.json hooks | ✅ prepended to command | | lefthook | lefthook.yml | ✅ priority 1 command | | simple-git-hooks | package.json | ✅ prepended to command | | pre-commit | .pre-commit-config.yaml | ✅ local hook entry | | bare git | no manager | ✅ .git/hooks/pre-commit |


🔒 Supported Package Managers

npm pnpm yarn go


🚨 Emergency Bypass

# Skip the scan for this commit only (emergency use only)
SEC_GATE_SKIP=1 git commit -m "emergency fix"

⚠️ This only skips the local pre-commit hook. CI will still catch it.


👥 Team Auto-Setup

Add to your project's package.json so every developer gets the hook automatically on npm install:

{
  "scripts": {
    "prepare": "sec-gate install"
  }
}

Then new developer onboarding is just:

npm install -g sec-gate   # once per machine
npm install               # installs hook automatically via prepare script

🏗️ How it works internally

git commit
    │
    ▼
pre-commit hook
    │
    ├── Load .sec-gate.yml config
    │
    ├── SAST ──► Semgrep (owasp-top10)
    │        ──► AST walker (acorn) — SQL injection, secrets, prototype pollution
    │
    ├── SCA  ──► osv-scanner (npm/pnpm/yarn lockfile)
    │        ──► govulncheck (go.mod)
    │
    ├── Apply inline suppressions (sec-gate-disable / security-scan: disable)
    │
    ├── Apply config filters (exclude_rules, exclude_paths, severity_threshold)
    │
    ├── Findings? → exit 1 → commit BLOCKED ✗
    └── Clean?   → exit 0 → commit proceeds ✓

Built with ❤️ to make security automatic, not optional.

npm GitHub