ForgeScan is a supply-chain security scanner designed to detect two common classes of risks in JavaScript/npm projects:
- Typo-squatting dependencies in
package.json - Suspiciously obfuscated source code using Shannon entropy analysis
ForgeScan is intentionally split into:
- A Rust-based scanning engine (fast, deterministic, CI-friendly)
- A TypeScript-based reporter (human-readable output)
The tool scans a target project before installation, making it suitable for pre-install, pre-commit, or CI use.
- Detects typo-squatting dependencies using edit-distance heuristics
- Flags anomalous JavaScript obfuscation via Shannon entropy
- Emits clean, structured JSON output
- Optional human-readable reporting via TypeScript
- Works on Windows without requiring Docker or WSL
- Does not execute or install scanned dependencies
Install the following before proceeding:
- Git
- Rust (stable)
https://www.rust-lang.org/tools/install - Node.js (LTS)
https://nodejs.org/
Verify installations:
rustc --version
cargo --version
node --version
npm --versionClone the repository:
git clone https://github.com/not-koushi/ForgeScan.git
cd ForgeScanThe reporter is optional but recommended for readable output.
cd reporter
npm install
cd ..ForgeScan scans other projects, not itself.
This repository includes a ready-to-use demo target in scan-target/.
npm install inside scan-target/
The scan target intentionally contains fake dependencies to demonstrate typo-squatting detection.
Step 1: Move into the Rust engine
cd engineStep 2: Run a full scan and emit JSON
cargo run -- ..\scan-target\src --deps --json |
Out-File -Encoding utf8 ..\report.jsonWhat this does:
- Scans JavaScript source files for obfuscation
- Scans
package.jsonfor typo-squatting - Emits pure JSON (no extra logs)
- Write results to
report.json
Step 3: Return to project root
cd ..Option A: Inspet Raw JSON
Get-Content report.jsonThe JSON output is suitable for CI pipelines and automation.
Option B: Run the TypeScript Reporter (Recommended)
npx ts-node reporter/src/formatReport.ts report.jsonExample Output:
ForgeScan Report (1.0.0)
[HIGH] scan-target/src/obfuscated-high.js (entropy: 6.3)
[MEDIUM] scan-target/src/packed-medium.js (entropy: 5.0)
[MEDIUM] scan-target/src/suspicious.js (entropy: 4.9)
[MEDIUM] Package "expres" resembles "express"
[MEDIUM] Package "lodas" resembles "lodash"
Scan source code only
cargo run -- ../scan-target/srcScan source code and dependencies
cargo run -- ../scan-target/src --depsJSON-only output (CI Usage)
cargo run -- ../scan-target/src --deps --jsonreport.jsonis generated output and should not be committednode_modules/is never requried for scanning- Dependency checks operate on
package.jsononly - ForgeScan is a static analyzer and does not execute code
ForgeScan is best suited for:
- Pre-install dependency checks
- Pre-commit or pre-merge validation
- CI pipelines
- Security demonstrations and research
It is not a runtime malware detector.
Built by Koushik Panchadarla