Datasets:
license: other
language:
- en
task_categories:
- text-classification
- question-answering
- text-generation
- feature-extraction
pretty_name: CodeSecAudit-RAG
size_categories:
- 10K<n<100K
tags:
- code-security
- vulnerability-detection
- rag
- secure-coding
- owasp
- cwe
- code-review
- cybersecurity
CodeSecAudit-RAG
CodeSecAudit-RAG is a curated defensive dataset for building an Enterprise Code Review and Security Auditor Agent. It combines vulnerability-detection examples with a retrieval-ready secure-coding knowledge corpus.
The dataset is designed for practical AIML and MLOps workflows such as vulnerability detection, security review explanation, and RAG-based secure coding guidance retrieval.
Dataset Components
1. Review Dataset
Files:
review_combined/train.jsonl.gzreview_combined/validation.jsonl.gzreview_combined/test.jsonl.gz
Total records: 28,548
Sources:
- CodeXGLUE Defect Detection: large binary vulnerable/non-vulnerable C examples
- OWASP Benchmark Python: CWE-labeled Python benchmark examples
The review dataset supports binary vulnerability detection and CWE-aware security review.
2. RAG Corpus
File:
rag/rag_corpus.jsonl.gz
Total chunks: 2,833
Source:
- OWASP Cheat Sheet Series
The RAG corpus contains secure coding guidance chunks for retrieval-augmented generation. It covers topics such as SQL injection prevention, XSS, code injection, OS command injection, authentication, authorization, secrets management, file upload security, SSRF, deserialization, and cryptographic failures.
Intended Use
This dataset is intended for defensive security research and educational AI engineering projects, including:
- vulnerability detection
- secure code review
- security explanation generation
- RAG-based secure coding assistants
- MLOps and dataset engineering demonstrations
Not Intended For
This dataset is not intended for building offensive exploitation tools, malware generation systems, or automated attack systems. The dataset should be used for defensive code review, secure coding education, and vulnerability remediation workflows.
Schema
Review records include:
idsource_namesource_typesource_splitoriginal_idlanguageframeworktaskcwe_idowasp_categoryseverityis_vulnerablevulnerability_nameinput_codefixed_codeexplanationsecure_patterntagsmetadata
RAG records include:
idsource_namesource_typedoc_typesource_filetitlesection_titlechunk_indexlanguageframeworktaskcwe_idvulnerability_nameowasp_categorycontentpositive_patternnegative_patterntagsmetadata
Dataset Statistics
Review dataset:
| Split | Records |
|---|---|
| Train | 22,827 |
| Validation | 2,846 |
| Test | 2,875 |
| Total | 28,548 |
RAG corpus:
| Component | Count |
|---|---|
| RAG chunks | 2,833 |
| Covered CWE types | 16 |
| Average chunk size | ~869 characters |
Loading Example
from datasets import load_dataset
review = load_dataset(
"json",
data_files={
"train": "review_combined/train.jsonl.gz",
"validation": "review_combined/validation.jsonl.gz",
"test": "review_combined/test.jsonl.gz",
}
)
rag = load_dataset(
"json",
data_files={"train": "rag/rag_corpus.jsonl.gz"}
)
Limitations
CodeXGLUE provides binary labels but does not provide exact CWE labels, so those records use cwe_id: unknown. OWASP Benchmark Python provides stronger CWE-specific labels. The RAG corpus is documentation-derived and should be used as retrieval context rather than ground-truth model labels.
Source and License Notice
This is a curated derivative dataset built from public security datasets and documentation. Users should review the original source licenses before redistribution or commercial use. The dataset card intentionally uses license: other because the final package combines sources with different licensing terms.
Author
Created and curated by Om Choksi.