File size: 4,575 Bytes
6425f96 5e69895 6425f96 7bca467 04ed029 7bca467 04ed029 7bca467 04ed029 7bca467 04ed029 7bca467 04ed029 7bca467 04ed029 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
---
dataset_info:
features:
- name: project
dtype: string
- name: commit_id
dtype: string
- name: CVE ID
dtype: string
- name: CWE ID
dtype: string
- name: func
dtype: string
- name: vul
dtype: int8
splits:
- name: train
num_bytes: 299777443
num_examples: 239822
- name: test
num_bytes: 63350463
num_examples: 51390
- name: validation
num_bytes: 63678823
num_examples: 51392
download_size: 190857204
dataset_size: 426806729
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: test
path: data/test-*
- split: validation
path: data/validation-*
license: mit
task_categories:
- text-classification
- feature-extraction
tags:
- Code
- Vulnerability
---
# Merged BigVul and PrimeVul Dataset
**Dataset ID**: `mahdin70/merged_bigvul_primevul`
This dataset is a merged and preprocessed combination of the **BigVul** (`bstee615/bigvul`) and **PrimeVul** (`colin/PrimeVul`, "default" configuration) datasets, designed for vulnerability analysis and machine learning tasks. The preprocessing ensures consistency in column names, data types, and formats, making it suitable for fine-tuning models.
## Dataset Overview
The dataset integrates vulnerability data from two sources:
- **BigVul**: A dataset of real-world vulnerabilities from open-source C/C++ projects.
- **Paper**: (https://doi.org/10.1145/3379597.3387501)
- **Repository**: (https://github.com/ZeoVan/MSR_20_Code_vulnerability_CSV_Dataset)
- **PrimeVul**: A vulnerability dataset with additional project-specific details.
- **Paper**: (https://doi.org/10.48550/arXiv.2403.18624)
- **Repository**:(https://github.com/DLVulDet/PrimeVul)
The merged dataset retains key information about projects, commits, functions, and vulnerabilities, standardized for consistency.
### Columns
The dataset contains the following columns:
- **`project`**: String - The name of the project (e.g., "qemu", "linux-2.6").
- **`commit_id`**: String - Unique identifier of the commit associated with the function.
- **`func`**: String - The source code of the function before fixing (from `func_before` in BigVul).
- **`vul`**: Int8 - Vulnerability label (1 = vulnerable, 0 = not vulnerable).
- **`CVE ID`**: String - Common Vulnerabilities and Exposures identifier (e.g., `CVE-2007-1320`), or `NOT_APPLICABLE` if `vul = 0`.
- **`CWE ID`**: String - Common Weakness Enumeration identifier (e.g., `CWE-20`), or `NOT_APPLICABLE` if `vul = 0`.
### Splits
- **Train**: Combined training data from BigVul and PrimeVul.
- **Test**: Combined testing data from BigVul and PrimeVul.
- **Validation**: Combined validation data from BigVul and PrimeVul.
## Preprocessing Steps
The dataset was preprocessed to ensure consistency and quality:
### BigVul Preprocessing
- **Source Columns**:
- `project`, `commit_id`, `CVE ID`, `CWE ID`, `func_before`, `vul`.
- **Transformations**:
- Renamed `func_before` to `func`.
- Kept `CWE ID` in its original format (`CWE-XXX`).
- Converted `vul` to `int8`.
### PrimeVul Preprocessing
- **Source Columns**:
- `project`, `commit_id`, `cve`, `cwe`, `func`, `target`.
- **Transformations**:
- Renamed `cve` to `CVE ID`, `cwe` to `CWE ID`, `target` to `vul`.
- Standardized `CWE ID` by removing brackets from list format (e.g., `["CWE-XXX"]` → `CWE-XXX`), taking the first element if multiple CWEs exist.
- Converted `vul` from `int64` to `int8`.
### Merging and Final Preprocessing
- **Merging**: Concatenated preprocessed BigVul and PrimeVul data for each split (`train`, `test`, `validation`).
- **Final Steps**:
- Removed rows with any null values.
- Removed duplicates based on the `func` column.
- For rows where `vul = 0`, replaced `CVE ID` and `CWE ID` with `"NOT_APPLICABLE`.
## Dataset Statistics
Below are the analysis results for the final merged dataset:
### Train Split
- **Number of rows**: 239,822
- **Unique CWE IDs (excluding `NOT_APPLICABLE`)**: 127
- **Unique commit IDs**: 7,559
- **Vulnerable functions (`vul = 1`)**: 9,037
### Test Split
- **Number of rows**: 51,390
- **Unique CWE IDs (excluding `NOT_APPLICABLE`)**: 87
- **Unique commit IDs**: 6,032
- **Vulnerable functions (`vul = 1`)**: 1,911
### Validation Split
- **Number of rows**: 51,392
- **Unique CWE IDs (excluding `NOT_APPLICABLE`)**: 91
- **Unique commit IDs**: 6,059
- **Vulnerable functions (`vul = 1`)**: 1,933
## Usage
### Loading the Dataset
```python
from datasets import load_dataset
dataset = load_dataset("mahdin70/merged_bigvul_primevul") |