Skip to content

Repository files navigation

CapScan

CapScan

Deterministic capability analysis for Node.js dependencies.

MIT Experimental Node.js Deterministic


CapScan helps you understand what your dependencies are capable of doing.

Unlike traditional security scanners, CapScan doesn't classify risk or assign scores.

Instead, it answers a simple question:

What can this dependency do?

Every result is backed by file-level evidence.


Why?

Most tools answer:

"Is this dependency vulnerable?"

CapScan answers:

"Can this dependency access the filesystem?"
"Can it execute shell commands?"
"Can it make outbound HTTP requests?"
"Can it load native binaries?"

Capabilities are facts.

Risk is context.


Quick Start

npx capscan scan .

Output:

📁 Filesystem
  fs:write ............ 3 packages
  fs:read ............. 2 packages

🌐 Network
  net:outbound_http ... 2 packages
  net:outbound_https .. 1 package

⚙️ Process
  proc:execute_shell .. 1 package

🔑 Environment
  env:read ............ 5 packages

Features

  • 🔍 Deterministic capability analysis
  • 📄 Evidence for every finding
  • ⚡ Fast (~2.8ms/package)
  • 📦 Works with npm, pnpm and Yarn lockfiles
  • 📊 JSON, Markdown and Terminal output
  • 📸 Snapshot & diff support
  • 🔎 Explain why a capability exists

Commands

# Scan a project
capscan scan .

# Why does axios have capabilities?
capscan why axios

# Which packages can write files?
capscan why fs:write

# Save current dependency baseline
capscan snapshot .

# Compare against previous snapshot
capscan diff .

# Compare two packages
capscan compare express@4 koa@2

Pre-install Hook

CapScan can check capabilities before each npm install:

# Setup (creates .npmrc with preinstall hook)
capscan init

# Now every npm install checks capabilities
npm install axios
# → CapScan: axios can make HTTP requests, read env, use crypto

# To disable
# Remove the "preinstall" line from .npmrc

Custom Allow List

# Only allow specific capabilities
capscan check . --allow=fs:read,env:read

# Quiet mode (only output if blocked)
capscan check . --quiet

How it works

CapScan performs deterministic static analysis.

  1. Resolve dependencies from your lockfile.
  2. Parse source files with oxc-parser.
  3. Detect runtime API usage.
  4. Map APIs to capabilities.
  5. Generate explainable reports.

No telemetry.

No cloud.

No code execution.


Output Formats

capscan scan . --format terminal
capscan scan . --format json
capscan scan . --format markdown

Example Findings

Capability Evidence
fs:write fs.writeFile()
fs:read fs.readFileSync()
net:outbound_http http.request()
proc:execute_shell child_process.exec()
env:read process.env
native:dlopen process.dlopen()

Architecture

packages/

├── engine/     # Deterministic analysis engine
└── cli/        # Terminal interface

The engine is designed to be reusable by:

  • CLI
  • GitHub Actions
  • VS Code extensions
  • Future integrations

Performance

Metric Value
Average scan time 2.8 ms/package
Throughput ~360 packages/sec
Determinism 100%

Development

pnpm install

pnpm build

pnpm golden-test
pnpm determinism-test
pnpm performance-budget

Philosophy

CapScan intentionally avoids making security decisions.

It reports observable capabilities with deterministic evidence.

You decide what those capabilities mean for your project.


Contributing

Contributions are welcome.

Please read CONTRIBUTING.md before opening a pull request.


License

MIT


Built with ❤️ by Maximiliano Moldenhauer.

Releases

Packages

Contributors

Languages