A static analysis framework for JavaScript vulnerability detection
Project description
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
From PyPI (Recommended)
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 libraryz3-solver(~=4.8.8.0): Heuristic path feasibility check (used only with-Xflag)sty(~=1.0.0rc0): Terminal styling and formattingfunc_timeout(~=4.3.5): Function timeout handlingtqdm(~=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 generationtypescript(^5.9): TypeScript/TSX lowering and project configuration supportsource-map(^0.6.1): Original TypeScript source location mappingcommander(^3.0.2): Command-line interface utilitiesansicolor(^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 evaluationsreport.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.jsonas a project, including project references - resolves
baseUrl/paths, packageexports/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
tslibinterop/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@Entrybuild 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, andoh-package.json5project 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/andskills/probejs-poc-generation/contain experimental utilities that consumereport.jsonto 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.jsonfindings into runnable PoCs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file probejs-1.0.1.tar.gz.
File metadata
- Download URL: probejs-1.0.1.tar.gz
- Upload date:
- Size: 212.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
127a5d3f3c29df577071814193227cb33a7a4efc08484c4863e7d1f6c842c2a0
|
|
| MD5 |
927e5809795b5aa021eaa1935c030c0d
|
|
| BLAKE2b-256 |
3b2eded53192c14ada5a26b713dcef77d77391795e24c45f7061ae497d144a7d
|
File details
Details for the file probejs-1.0.1-py3-none-any.whl.
File metadata
- Download URL: probejs-1.0.1-py3-none-any.whl
- Upload date:
- Size: 238.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
846215b1f79725fb2e53fc2721ce78d6199570367c972a1308d772507f286313
|
|
| MD5 |
725aaa11fb096ef4b2547ad26886aa05
|
|
| BLAKE2b-256 |
ef53495e688deefef6900a7de3478a2c87875a458a772b30faf72ed2a8978b65
|