๐Ÿš€ Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more โ†’
Sign In

scan-compromised

Package Overview
Dependencies
Maintainers
1
Versions
245
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scan-compromised

A simple npm CLI tool (starter template)

latest
Source
npmnpm
Version
1.1.230
Version published
Weekly downloads
1.2K
-17.73%
Maintainers
1
Weekly downloads
ย 
Created
Source

scan-compromised

๐Ÿ” A CLI tool to detect known compromised npm packages in your project.

No third-party dependencies: This tool is fully self-contained and does not rely on any external npm packages or libraries. You can use it with confidence in sensitive or locked-down environments.

This scanner checks your package.json, package-lock.json, yarn.lock, and pnpm-lock.yaml files for any packages that were compromised in recent supply chain attacks โ€” including the September 2025 Shai-Hulud incident.

It flags:

  • โŒ Known malicious versions (fails the scan)
  • โš ๏ธ Safe versions of previously compromised packages (warns but does not fail)

๐Ÿš€ Installation

npx scan-compromised

Or install globally

npm install -g scan-compromised
scan-compromised

๐Ÿ“ฆ Usage

Basic scan

scan-compromised

Hard gate: block installs with known advisories

Add this to your project's preinstall script in package.json:

"scripts": {
  "preinstall": "npx scan-compromised"
}

This will prevent installation of any dependencies with known advisories, acting as a hard gate in your supply chain.

JSON output (for CI integration)

scan-compromised --json

๐Ÿ“ Threat List & Data Updates

The tool uses a local threats.json file located in the root of the CLI package. This file contains a list of known compromised packages and their malicious versions.

Data Source:

  • The list of known vulnerabilities is automatically pulled from GitHub Security Advisories every day.
  • This ensures the scan is always up to date with the latest reported threats in the npm ecosystem.

Example threats.json

{
  "@ctrl/tinycolor": ["4.1.1", "4.1.2"],
  "ngx-toastr": ["19.0.1", "19.0.2"]
}

You can update this file manually as new threats are discovered. Trusted sources include:

StepSecurity

GitHub Security Advisories

Snyk Vulnerability Database

๐Ÿงช GitHub Actions Integration

You can run this tool automatically on every push or pull request using GitHub Actions.

.github/workflows/scan.yml

name: Scan for Compromised Packages

on:
  push:
    branches: [main]
  pull_request:

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '18'
      - name: Install scanner
        run: npm install scan-compromised
      - name: Run scan
        run: npx scan-compromised

๐Ÿ›ก๏ธ License

MIT ยฉ Jonathan Blades

FAQs

Package last updated on 21 Jun 2026

Did you know?

Socket

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.

Install

Related posts