Skip to main content

probejs

probejs is a static analysis tool for JavaScript and TypeScript that detects taint-style vulnerabilities via Object Property Graph (OPG) construction and flow-based trace rules. Its canonical machine-readable output is report.json.

Overview

probejs is a JavaScript static analysis framework that:

  • Generates Object Property Graphs (OPG) from JavaScript source code
  • Statically tracks object property flows by simulating assignments, property accesses, and function calls
  • Detects taint-style vulnerabilities including:
    • OS command injection
    • Cross-site scripting (XSS)
    • Code execution vulnerabilities
    • Prototype pollution
    • Internal property tampering
    • Path traversal
    • NoSQL injection
  • Emits structured JSON bug reports with source snippets, path diagnostics, and trace rule evaluations
  • Exports analysis results to CSV/TSV format for further processing
  • Supports npm package analysis

Architecture

See docs/ARCHITECTURE.md for detailed architecture information.

Installation

System Requirements

  • Node.js and npm: Required for JavaScript/TypeScript AST parsing (automated setup)
  • Python 3.8+: Required for the core analysis engine
pip install probejs

On first run, the tool will automatically install its JavaScript dependencies into ~/.cache/probejs/parser/ via npm install. You can also trigger this step manually ahead of time:

probejs-setup                # or: python -m probejs setup

From Source (Development)

git clone <repository-url>
cd probejs

# Install Python package in editable mode
pip install -e .

# Install JavaScript parser dependencies
cd probejs/_parser && npm install && cd ../..

# Verify
python -m probejs input.js

Or use the provided installation script:

./install.sh

Python Dependencies

  • networkx (~=2.4): Graph data structure library
  • z3-solver (~=4.8.8.0): Heuristic path feasibility check (used only with -X flag)
  • sty (~=1.0.0rc0): Terminal styling and formatting
  • func_timeout (~=4.3.5): Function timeout handling
  • tqdm (~=4.48.2): Progress bars for long-running operations

JavaScript Dependencies

The JavaScript parser scripts are bundled with the Python package and installed lazily via npm on first use (or via probejs-setup). They include:

  • esprima (^4.0.1): JavaScript parser for AST generation
  • typescript (^5.9): TypeScript/TSX lowering and project configuration support
  • source-map (^0.6.1): Original TypeScript source location mapping
  • commander (^3.0.2): Command-line interface utilities
  • ansicolor (^1.1.84): Terminal color formatting

Quick Start

# Analyze a JavaScript or TypeScript file
python -m probejs input.js
python -m probejs input.ts

# Analyze a TypeScript project directory
python -m probejs ./src

# Parse TypeScript supplied on stdin
printf 'const value: string = process.argv[2];' | python -m probejs --typescript -

# Analyze with specific vulnerability type
python -m probejs -t os_command input.js

# Emit a canonical JSON report
python -m probejs --json -t os_command input.js

# Check for prototype pollution
python -m probejs -P input.js

# Disable JS-modeled stubs in builtin_packages/
python -m probejs --no-builtin-packages input.js

When --json is passed, the JSON report is written to the run log directory as:

  • report.json: structured bug report with source snippets, path diagnostics, and trace rule evaluations
  • report.schema.json: schema for the report format

See docs/USAGE.md for detailed usage instructions, examples, and advanced configuration.

TypeScript support

TypeScript files (.ts, .tsx, .mts, and .cts) and ArkTS .ets files are automatically lowered to CommonJS before the existing JavaScript AST pipeline runs. The frontend:

  • removes type-only syntax while preserving runtime behavior
  • converts ES module imports/exports to the existing module-analysis representation
  • follows transitive TypeScript imports
  • compiles the nearest tsconfig.json as a project, including project references
  • resolves baseUrl/paths, package exports/imports, and workspace packages
  • maps AST locations and reports back to the original TypeScript source
  • lowers TSX and modern JavaScript syntax to parser-compatible JavaScript
  • models tslib interop/decorator helpers and uses declaration signatures to identify callback arguments
  • normalizes common ArkTS component syntax (struct, state/component decorators, and declarative UI blocks) and treats @Entry build bodies as analysis entrypoints
  • prefers the project's installed TypeScript compiler and records compiler diagnostics/version information in report.json
  • recognizes callback properties in typed options objects and common Fastify, NestJS, EventEmitter, Commander, Yargs, worker, and serverless entrypoints
  • reads HarmonyOS build-profile.json5, module.json5, and oh-package.json5 project metadata
  • consumes existing external or inline JavaScript source maps when analyzing generated CommonJS

Declaration files (.d.ts, .d.mts, and .d.cts) are not emitted as runtime files, but their signatures inform callback and promise metadata. Common generated/dependency directories are skipped during directory analysis. Type errors do not prevent emission because probejs analyzes runtime flows.

Experimental: PoC generation utilities. The directories pocgen/ and skills/probejs-poc-generation/ contain experimental utilities that consume report.json to assist with proof-of-concept generation. These are separate from the core analysis pipeline and currently rely on LLM-based coding agents (e.g., Codex, Claude) rather than automated symbolic reasoning.

Documentation

  • Architecture: Detailed architecture, how it works, and output format
  • Usage Guide: Command-line options, canonical JSON reporting, programmatic usage, and examples
  • Vulnerability Types: Detailed information about each vulnerability type with examples
  • Troubleshooting: Limitations, common issues, debugging tips, and references
  • PoC Generation Workflows: Difference between the interactive skill and automated runner approaches
  • PoC Skill: Agent skill for turning report.json findings into runnable PoCs

Metadata

Release files for probejs 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for probejs 1.0.1
File Size Uploaded Provenance
probejs-1.0.1.tar.gz 212.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for probejs 1.0.1
File Interpreter ABI Platform
probejs-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 450.6 kB

Release files / probejs-1.0.1.tar.gz

Download URL probejs-1.0.1.tar.gz
Size 212.2 kB
Tags Source
SHA-256 checksum
How to use checksums
127a5d3f3c29df577071814193227cb33a7a4efc08484c4863e7d1f6c842c2a0
BLAKE2b-256 checksum
How to use checksums
3b2eded53192c14ada5a26b713dcef77d77391795e24c45f7061ae497d144a7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / probejs-1.0.1-py3-none-any.whl

Download URL probejs-1.0.1-py3-none-any.whl
Size 238.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
846215b1f79725fb2e53fc2721ce78d6199570367c972a1308d772507f286313
BLAKE2b-256 checksum
How to use checksums
ef53495e688deefef6900a7de3478a2c87875a458a772b30faf72ed2a8978b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for probejs 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page