dilekmandal's picture
Upload README.md with huggingface_hub
01ba415 verified
|
Raw History Blame Contribute Delete
5.92 kB
---
license: gpl-2.0
language:
- en
tags:
- cybersecurity
- software-security
- vulnerability-detection
- java
- code-classification
- llm
- fine-tuning
task_categories:
- text-classification
- text-generation
---
# OWASP Benchmark Java – LLM Fine-Tuning Dataset
A chat-formatted dataset derived from the **OWASP Benchmark for Java** and prepared for large language model fine-tuning for Java vulnerability detection.
## Dataset Summary
This dataset contains **21,041 Java security analysis examples** derived from OWASP Benchmark test cases.
Each example contains:
- A system instruction describing the security analysis task
- A Java source-code sample
- An assistant response containing:
- `vulnerable`: vulnerability presence (`true` / `false`)
- `cwe`: CWE identifier
- `category`: vulnerability category
The data is formatted using the `messages` structure commonly used for conversational and instruction fine-tuning.
## Dataset Structure
| Split | Examples |
|---|---:|
| Train | 16,849 |
| Validation | 2,096 |
| Test | 2,096 |
| **Total** | **21,041** |
## Example
```json
{
"messages": [
{
"role": "system",
"content": "You are a Java application security analyzer..."
},
{
"role": "user",
"content": "Analyze the following Java source code..."
},
{
"role": "assistant",
"content": "{\"vulnerable\": true, \"cwe\": \"CWE-501\", \"category\": \"trustbound\"}"
}
]
}
```
## Labels
The dataset contains the following CWE categories:
- CWE-22 – Path Traversal
- CWE-78 – OS Command Injection
- CWE-79 – Cross-Site Scripting
- CWE-89 – SQL Injection
- CWE-90 – LDAP Injection
- CWE-327 – Broken/Risky Cryptographic Algorithm
- CWE-328 – Weak Hashing
- CWE-330 – Weak Randomness
- CWE-501 – Trust Boundary Violation
- CWE-614 – Sensitive Cookie Without 'Secure' Flag
- CWE-643 – XPath Injection
The primary binary classification target is:
```text
vulnerable = true / false
```
## Intended Use
The dataset is intended for:
- Java source-code vulnerability detection
- Security-focused LLM fine-tuning
- Research on code security classification
- Evaluation of vulnerability-aware language models
- CWE classification experiments
## Data Source
The underlying source is the **OWASP Benchmark for Java**, an open-source benchmark designed to evaluate the accuracy, coverage, and speed of software vulnerability detection tools.
The OWASP Benchmark project states that its test cases contain intentionally vulnerable and non-vulnerable examples mapped to specific CWEs.
Source project:
https://github.com/OWASP-Benchmark/BenchmarkJava
Project information:
https://owasp.org/www-project-benchmark/
## Dataset Preparation
The original OWASP Benchmark Java examples were transformed into a conversational JSONL format suitable for LLM fine-tuning.
The transformation:
1. Extracted the Java source code from each benchmark test.
2. Associated each example with its corresponding CWE.
3. Preserved the vulnerable/non-vulnerable label.
4. Preserved the vulnerability category.
5. Converted each example into a `system / user / assistant` message structure.
6. Created train, validation and test splits.
No model-generated labels were used.
## Split
The dataset contains:
- `train.jsonl`
- `validation.jsonl`
- `test.jsonl`
The current split contains approximately 80% training data, 10% validation data and 10% test data.
### Distribution
The CWE distribution is approximately consistent across the three splits.
The vulnerable/non-vulnerable distribution is also approximately consistent across the splits.
## Important Note About Benchmark Similarity
OWASP Benchmark is a synthetic security benchmark containing many test cases based on common Java application structures and vulnerability patterns.
Consequently, structurally similar source-code examples may occur across different splits.
This dataset should therefore be interpreted as an OWASP Benchmark-based fine-tuning dataset rather than as a leakage-controlled real-world software corpus.
For rigorous generalization studies, evaluation on an independent real-world Java vulnerability dataset is recommended.
## Limitations
This dataset is based on a synthetic benchmark rather than naturally occurring production vulnerabilities.
Performance on this dataset should not be interpreted as equivalent to performance on real-world enterprise Java applications.
Models trained on this dataset may learn benchmark-specific code patterns.
For this reason, results should preferably be reported together with evaluation on additional independent datasets.
## License
The underlying OWASP Benchmark for Java is distributed under the **GNU General Public License v2.0 (GPL-2.0)**.
Users should review the original project's license and terms before redistributing or using derivative datasets.
The original project and its license information are available at:
https://github.com/OWASP-Benchmark/BenchmarkJava
## Attribution
This dataset is derived from the OWASP Benchmark Project.
OWASP Benchmark Project:
https://owasp.org/www-project-benchmark/
OWASP Benchmark for Java:
https://github.com/OWASP-Benchmark/BenchmarkJava
This repository does not claim ownership of the original OWASP Benchmark source material.
## Citation
If you use this dataset, please cite the original OWASP Benchmark project in addition to citing this dataset repository.
## Disclaimer
This dataset is intended for research and security engineering purposes.
The presence of a vulnerability label reflects the OWASP Benchmark's intended test classification and does not constitute a security assessment of production software.