Skip to content
ashlraiPublic

About

Supply-chain security for npm and PyPI: scans install scripts and native binaries (Ghidra decompilation, YARA, AI classification), checks OSV malware advisories, and gates PRs with a GitHub Action.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

126 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BinShield

Catch malicious install scripts and native binaries in your dependencies β€” before they reach production.

CI License: MIT Node

BinShield is a supply-chain security platform for the npm and PyPI ecosystems. It analyzes the two things attackers actually weaponize β€” install scripts and native binaries β€” classifies their behavior with AI, cross-references known-malware feeds, and warns you the moment a package you depend on turns malicious.

🌐 binshield.dev Β· πŸ”Œ GitHub Action Β· πŸ“– Docs

The problem

A wave of supply-chain worms β€” Shai-Hulud and its kin β€” has shown how fast a single compromised npm/PyPI package spreads. Two attack surfaces matter:

  • Install scripts. A malicious postinstall hook (or a PyPI setup.py) runs arbitrary code on every machine that installs the package β€” stealing NPM_TOKEN/cloud credentials, opening reverse shells, dropping wipers. Most SCA tools never read the scripts field.
  • Native binaries. Compiled .node/.so/.dylib/.wasm addons hide payloads that no source-level scanner decompiles.

BinShield covers both.

What BinShield does

Capability Detail
Install-script analysis Scans npm lifecycle hooks (preinstall/install/postinstall/prepare) and PyPI setup.py/pyproject.toml for curl|bash, eval of remote code, credential exfiltration, wipers, reverse shells, and obfuscated payloads.
Native binary analysis Ghidra-powered decompilation (with a heuristic fallback) plus YARA pattern matching on .node/.so/.dylib/.wasm.
AI classification xAI Grok classifies decompiled binaries and install scripts into a supply-chain threat taxonomy; a deterministic heuristic floor runs when AI is unavailable.
Known-malware feed Cross-references every scan against OSV malicious-package advisories (MAL-*); a confirmed match forces a critical verdict.
Proactive alerts When a malicious package is discovered, BinShield matches it against your watchlists and scanned lockfiles and alerts you via email / Slack / webhook.
CI gating A GitHub Action scans every PR's dependencies and blocks merges on risky packages.
Reports CycloneDX SBOM export and SOC 2 / ISO 27001 / EU CRA compliance reports.

Architecture

flowchart LR
  subgraph Sources
    A[API / Dashboard scan] --> Q
    F[npm registry feed] --> Q
    C[Crawler / discovery] --> Q
  end
  Q[analysis_jobs queue] --> W
  subgraph W[Analysis worker]
    direction TB
    AC[Acquire package] --> EX[Extract binaries]
    AC --> MS[Install-script analysis]
    EX --> DC[Decompile + YARA]
    DC --> CL[AI classify]
    MS --> CL
    CL --> RS[Risk score + malware feed]
  end
  RS --> DB[(Supabase)]
  RS --> AL[Alert loop]
  DB --> WEB[Web app]
  DB --> ACT[GitHub Action]
  AL --> N[Email / Slack / Webhook]
Loading

Quickstart

1. Scan your repo in CI (GitHub Action)

Add the Action to block risky dependencies on every PR. No account is needed; an API key from binshield.dev adds higher rate limits and proactive alerting.

# .github/workflows/binshield.yml
name: BinShield
on: [pull_request]
jobs:
  binshield:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ashlrai/binshield/apps/github-action@v1
        with:
          fail-on: high
          github-token: ${{ secrets.GITHUB_TOKEN }}
          # api-key: ${{ secrets.BINSHIELD_API_KEY }}   # optional

See apps/github-action/README.md for inputs, scan modes, SARIF and SBOM export.

2. Check a single package on the web

binshield.dev/scan takes any npm package name and version and returns a risk verdict with the top findings. binshield.dev/search searches packages that have already been analyzed.

3. CLI (coming soon)

@binshield/cli lives in packages/cli but is not published to npm yet, so npx @binshield/cli won't work today. You can build it from source (see below).

Develop locally

corepack enable          # provides pnpm 10
pnpm install
pnpm dev                 # web app at http://localhost:3000

BinShield ships a demo fallback β€” the web app, API, and worker all run without live credentials (seeded corpus, in-memory store, bundled fixtures), so you can explore the product before wiring up Supabase / xAI / Stripe.

pnpm --filter @binshield/api dev                     # API server
BINSHIELD_WORKER_MODE=daemon pnpm --filter @binshield/worker dev   # worker
pnpm --filter @binshield/cli build && node packages/cli/dist/index.js audit   # CLI from source
pnpm typecheck && pnpm test && pnpm build            # the validation gate

Monorepo layout

Path Description
apps/web Next.js 15 frontend β€” public package database and dashboard
apps/api Hono API β€” search, scans, orgs, advisories, billing
apps/worker Analysis worker β€” binary + install-script pipeline, feed, crawler
apps/github-action CI scanner that gates PRs on dependency risk
apps/video Remotion project for the demo video
packages/analysis-types Shared domain types and sample data
packages/risk-engine Deterministic risk scoring
packages/config Environment parsing and product constants
packages/ui Shared UI components
packages/cli Command-line entry points

Documentation

License

MIT β€” see LICENSE.

About

Supply-chain security for npm and PyPI: scans install scripts and native binaries (Ghidra decompilation, YARA, AI classification), checks OSV malware advisories, and gates PRs with a GitHub Action.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages