Mapping systemic risks in the NPM ecosystem through topology-independent analysis methods.
Centralized package managers like NPM have transformed the software ecosystem into a complex and fragile structure. Current security approaches often fail to detect systemic risks stemming from the network's architecture. This study aims to map these risks using topological analysis methods independent of package content.
We constructed a directed graph modeling the top 1,000 packages by dependents (infrastructure) and popularity, extending dependencies to a depth of 7. By calculating metrics like In-degree, Betweenness, and Inverted Clustering, we developed the Behavioral Risk Score (BRS) to quantify structural criticality.
🔗 Live Preview: yusufarbc.github.io/npm-supply-chain-network-analysis
This study presents critical insights into the topological structure of the NPM ecosystem:
For the theoretical foundation of the project and case analyses, please review the following documents:
git clone https://github.com/yusufarbc/npm-supply-chain-network-analysis.git
cd npm-supply-chain-network-analysis
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r analysis/requirements.txt
python -m pip install notebook
python -m notebook
# Open the analysis/analysis.ipynb file
The analysis engine runs through analysis/run_pipeline.py. You can perform a complete analysis by
running the first cell in the notebook.
from analysis.run_pipeline import run_pipeline
# Default: Most critical infrastructure packages (Top 1000 Dependents + Depth 7)
result = run_pipeline(
top_n=1000, # Number of packages (per leaderboard category)
leaderboard_mode="combined", # Mode: combined (dependents + downloads)
depth=7, # Scanning depth
results_dir="../results", # Output directory
compute_plots=True # Generate plots
)
| Mode | Parameter | Description | Use Case |
|---|---|---|---|
| Most Dependent | dependents |
Most depended-upon packages | Critical Infrastructure Analysis (Default) |
| Most Downloaded | downloads |
Most downloaded packages | General popularity and traffic analysis |
| Trending | trending |
Rapidly rising packages | Early warning and anomaly detection |
academic/: Academic paper and LaTeX source files.analysis/: Python analysis code, data fetching and processing modules.results/: Analysis outputs (CSV, JSON, GEXF) and generated plots.media/: Project images.This project is licensed under the MIT License.