--- dataset_info: features: - name: project dtype: string - name: commit_id dtype: string - name: func dtype: string - name: vul dtype: int64 - name: CVE ID dtype: string - name: CWE ID dtype: string - name: CWE Name dtype: string - name: CWE Description dtype: string - name: Potential Mitigation dtype: string - name: __index_level_0__ dtype: int64 splits: - name: train num_bytes: 64041861 num_examples: 15770 - name: validation num_bytes: 9198025 num_examples: 2253 - name: test num_bytes: 17932135 num_examples: 4506 download_size: 25107430 dataset_size: 91172021 configs: - config_name: default data_files: - split: train path: data/train-* - split: validation path: data/validation-* - split: test path: data/test-* --- # CWE Enriched and Balanced BigVul+PrimeVul This dataset is a processed and enriched version of the **BigVul and PrimeVul datasets**, enhanced using CWE mappings from [MITRE's CWE Database](https://cwe.mitre.org/). The purpose of this dataset is to provide a cleaner, more balanced, and more informative version of the original datasets for vulnerability prediction and CWE classification tasks. ## πŸ“Œ Dataset Description This dataset contains vulnerability information from BigVul and PrimeVul datasets, with additional columns added from CWE ID mappings fetched from MITRE’s CWE database. The dataset was cleaned, balanced, and split into **training, validation, and test sets** while maintaining: - The distribution ratio of vulnerable and non-vulnerable functions. - The distribution ratio of each CWE ID across all splits. ### πŸ’‘ Key Features: - **Project & Commit Information:** Metadata related to the project and its commits. - **Function Code (`func`):** The code snippet associated with each entry. - **Vulnerability Label (`vul`):** Whether the function is vulnerable (`1`) or not (`0`). - **CVE ID & CWE ID Mapping:** Relevant IDs for categorizing vulnerabilities. - **CWE Information:** Additional information fetched from MITRE's CWE database including: - `CWE Name` - `CWE Description` - `Potential Mitigation` ## πŸ“‚ Dataset Structure The dataset consists of the following columns: | Column Name | Description | |-----------------------|----------------------------------------------------------------| | project | The name of the project where the code is taken from. | | commit_id | The unique commit identifier. | | func | The function code snippet. | | vul | Label indicating if the function is vulnerable (`1`) or not (`0`). | | CVE ID | The CVE identifier (if applicable). | | CWE ID | The CWE identifier corresponding to the vulnerability. | | CWE Name | The name of the CWE ID. | | CWE Description | Description of the CWE category. | | Potential Mitigation | Recommended mitigations for addressing the vulnerability. | ## πŸ“Š CWE IDs Contained In This Dataset The dataset contains the following **13 unique CWE IDs (Including Not Applicable)**: | CWE ID | CWE Name | |-----------|-------------------------------------| | CWE-119 | Improper Restriction of Operations within the Bounds of a Memory Buffer | | CWE-20 | Improper Input Validation | | CWE-125 | Out-of-bounds Read | | CWE-399 | Resource Management Errors | | CWE-200 | Information Exposure | | CWE-787 | Out-of-bounds Write | | CWE-264 | Permissions, Privileges, and Access Control | | CWE-416 | Use After Free | | CWE-476 | NULL Pointer Dereference | | CWE-190 | Integer Overflow or Wraparound | | CWE-189 | Numeric Errors | | CWE-362 | Concurrent Execution using Shared Resource with Improper Synchronization (Race Condition) | | NOT_APPLICABLE | Not applicable / No CWE ID assigned | ## πŸ” Data Splitting & Balancing The dataset has been split into **training, validation, and test sets** using stratified sampling to ensure the distribution of: 1. Vulnerable (`vul = 1`) and Non-Vulnerable (`vul = 0`) functions. 2. Each CWE ID remains consistent across splits. ## πŸ“₯ Usage To load this dataset from the Hugging Face Hub: ```python from datasets import load_dataset dataset = load_dataset('mahdin70/cwe_enriched_balanced_bigvul_primevul') ``` ## πŸ“Œ Citation If you use this dataset, please cite the original sources of BigVul and PrimeVul datasets.