Skip to content

Commit d37c834

Browse files
committedFeb 9, 2025
update osv_supply_chain
1 parent 791ccec commit d37c834

File tree

2 files changed

+373
-15
lines changed

2 files changed

+373
-15
lines changed
 

‎markdown/osv_supply_chain/osv_malicious_packages.md

+37-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,42 @@ jupyter:
1212
name: python3
1313
---
1414

15+
# 📊 OSV Security Trends: Malicious Code & Vulnerabilities in Software Supply Chains
16+
17+
This notebook analyzes **OSV data**, highlighting **malicious code campaigns** and **vulnerabilities** across key ecosystems like **npm, PyPI, and Maven**.
18+
19+
## 🔍 Overview
20+
- **npm had over 19K affected packages**, making it the most impacted registry.
21+
- **PyPI & Maven continue to show vulnerability spikes**, especially in recent years.
22+
- **Malicious Code vs. Vulnerabilities:** Attackers embed **malicious dependencies** and exploit **supply chain weaknesses.**
23+
24+
## 🔗 Data Source
25+
- **Source:** [OSV.dev](https://osv.dev) (Open Source Vulnerability)
26+
27+
28+
## 📥 Load OSV Ecosystem Summary Data
29+
30+
The dataset contains a summary of **ecosystem-specific OSV vulnerabilities and malicious code incidents** across multiple years.
31+
32+
We will load and preview the dataset:
33+
1534
```python vscode={"languageId": "python"}
1635
import pandas as pd
1736

1837
df = pd.read_csv("../../data/osv/processed/osv_ecosystem_summary.csv")
1938
df.head(1)
2039
```
2140

41+
## 📊 Creating a Security Trends Table
42+
43+
We will use **Great Tables** to create an interactive summary of the OSV dataset, featuring:
44+
- **Ecosystem breakdown** (npm, PyPI, Maven, etc.)
45+
- **Type of threat** (🐞 Vulnerability | 💀 Malicious Code)
46+
- **Peak attack year**
47+
- **Trend data visualization** (bar charts for yearly trends)
48+
2249
```python vscode={"languageId": "python"}
23-
from great_tables import GT, md, html, nanoplot_options
50+
from great_tables import GT, md, nanoplot_options
2451
import pandas as pd
2552
import numpy as np
2653
import ast
@@ -64,12 +91,12 @@ gt_table = (
6491
.tab_source_note(
6592
source_note=md("**Legend:** Bug = Vulnerability | Skull = Malicious Code")
6693
)
67-
.tab_stubhead(label="Ecosystem")
94+
.tab_stubhead(label=md("*Ecosystem*"))
6895
.cols_label(
6996
ecosystem="Ecosystem",
7097
icon="Type",
71-
total_affected="Total",
72-
peak_attack_year="Peak",
98+
total_affected="Total Affected Packages",
99+
peak_attack_year="Peak Year",
73100
trend_data="Year Trend",
74101
)
75102
.fmt_nanoplot(
@@ -79,7 +106,7 @@ gt_table = (
79106
options=nanoplot_options(
80107
data_bar_stroke_color="black",
81108
data_bar_stroke_width=2,
82-
data_bar_fill_color="darkgray",
109+
data_bar_fill_color="darkred",
83110
reference_line_color="pink",
84111
),
85112
)
@@ -91,8 +118,13 @@ gt_table = (
91118
)
92119
.fmt_icon(columns="icon", fill_color=color_map)
93120
)
121+
```
122+
123+
## 💾 Saving and Displaying the Table
94124

125+
The interactive table will be saved as an **HTML file** and displayed in the notebook.
95126

127+
```python vscode={"languageId": "python"}
96128
# Generate the raw HTML from the table
97129
html_output = gt_table.as_raw_html()
98130

0 commit comments

Comments
 (0)