|
Download README.md from Helinity/python-security-benchmark: direct link, hf CLI and curl.
- Browser
- Download file 15 kB
-
https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/README.md
- Command line
-
hf download hf://datasets/Helinity/python-security-benchmark/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Helinity/python-security-benchmark/resolve/main/README.md
15 kB
| pretty_name: "CodeDNA: Python Security Benchmark" | |
| language: | |
| - en | |
| license: apache-2.0 | |
| task_categories: | |
| - text-classification | |
| size_categories: | |
| - n<1K | |
| tags: | |
| - python | |
| - code | |
| - cybersecurity | |
| - secure-coding | |
| - synthetic | |
| configs: | |
| - config_name: default | |
| default: true | |
| data_files: | |
| - split: examples | |
| path: data/examples.jsonl | |
| - config_name: corpus | |
| data_files: | |
| - split: train | |
| path: data/research/corpus/train.jsonl | |
| - split: validation | |
| path: data/research/corpus/validation.jsonl | |
| - split: test | |
| path: data/research/corpus/test.jsonl | |
| - config_name: benchmark | |
| data_files: | |
| - split: train | |
| path: data/research/benchmark/train.jsonl | |
| - split: validation | |
| path: data/research/benchmark/validation.jsonl | |
| - split: test | |
| path: data/research/benchmark/test.jsonl | |
| - config_name: official | |
| data_files: | |
| - split: train | |
| path: data/research/v3b2/official/train.jsonl | |
| - split: validation | |
| path: data/research/v3b2/official/validation.jsonl | |
| - split: test | |
| path: data/research/v3b2/official/test.jsonl | |
| - config_name: corpus_3c1 | |
| data_files: | |
| - split: train | |
| path: data/research/v3c1/corpus/train.jsonl | |
| - split: validation | |
| path: data/research/v3c1/corpus/validation.jsonl | |
| - split: test | |
| path: data/research/v3c1/corpus/test.jsonl | |
| - config_name: official_3c1 | |
| data_files: | |
| - split: train | |
| path: data/research/v3c1/official/train.jsonl | |
| - split: validation | |
| path: data/research/v3c1/official/validation.jsonl | |
| - split: test | |
| path: data/research/v3c1/official/test.jsonl | |
| dataset_info: | |
| - config_name: corpus | |
| features: | |
| - name: code | |
| dtype: string | |
| - name: code_files | |
| list: | |
| - name: code | |
| dtype: string | |
| - name: path | |
| dtype: string | |
| - name: cwe_id | |
| dtype: string | |
| - name: difficulty | |
| dtype: string | |
| - name: evidence_reference | |
| dtype: string | |
| - name: expected_finding | |
| dtype: bool | |
| - name: explanation | |
| dtype: string | |
| - name: fix_explanation | |
| dtype: string | |
| - name: framework | |
| dtype: string | |
| - name: hard_negative | |
| dtype: bool | |
| - name: id | |
| dtype: string | |
| - name: label | |
| dtype: string | |
| - name: language | |
| dtype: string | |
| - name: leakage_group_id | |
| dtype: string | |
| - name: pair_id | |
| dtype: string | |
| - name: pattern | |
| dtype: string | |
| - name: provenance | |
| struct: | |
| - name: authoring | |
| dtype: string | |
| - name: collection | |
| dtype: string | |
| - name: independent_human_review | |
| dtype: bool | |
| - name: origin | |
| dtype: string | |
| - name: review_note | |
| dtype: string | |
| - name: sample_id | |
| dtype: string | |
| - name: sanitization | |
| dtype: string | |
| - name: scenario_family_id | |
| dtype: string | |
| - name: secure_fix | |
| dtype: string | |
| - name: sink_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_type | |
| dtype: string | |
| - name: split | |
| dtype: string | |
| - name: taint_path | |
| list: string | |
| - name: verification_method | |
| dtype: string | |
| - name: verification_status | |
| dtype: string | |
| - name: vulnerability_type | |
| dtype: string | |
| - name: vulnerable_lines | |
| list: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - config_name: benchmark | |
| features: | |
| - name: code | |
| dtype: string | |
| - name: code_files | |
| list: | |
| - name: code | |
| dtype: string | |
| - name: path | |
| dtype: string | |
| - name: cwe_id | |
| dtype: string | |
| - name: difficulty | |
| dtype: string | |
| - name: evidence_reference | |
| dtype: string | |
| - name: expected_finding | |
| dtype: bool | |
| - name: explanation | |
| dtype: string | |
| - name: fix_explanation | |
| dtype: string | |
| - name: framework | |
| dtype: string | |
| - name: hard_negative | |
| dtype: bool | |
| - name: id | |
| dtype: string | |
| - name: label | |
| dtype: string | |
| - name: language | |
| dtype: string | |
| - name: leakage_group_id | |
| dtype: string | |
| - name: pair_id | |
| dtype: string | |
| - name: pattern | |
| dtype: string | |
| - name: provenance | |
| struct: | |
| - name: authoring | |
| dtype: string | |
| - name: collection | |
| dtype: string | |
| - name: independent_human_review | |
| dtype: bool | |
| - name: origin | |
| dtype: string | |
| - name: review_note | |
| dtype: string | |
| - name: sample_id | |
| dtype: string | |
| - name: sanitization | |
| dtype: string | |
| - name: scenario_family_id | |
| dtype: string | |
| - name: secure_fix | |
| dtype: string | |
| - name: sink_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_type | |
| dtype: string | |
| - name: split | |
| dtype: string | |
| - name: taint_path | |
| list: string | |
| - name: verification_method | |
| dtype: string | |
| - name: verification_status | |
| dtype: string | |
| - name: vulnerability_type | |
| dtype: string | |
| - name: vulnerable_lines | |
| list: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - config_name: official | |
| features: | |
| - name: code | |
| dtype: string | |
| - name: code_files | |
| list: | |
| - name: code | |
| dtype: string | |
| - name: path | |
| dtype: string | |
| - name: cwe_id | |
| dtype: string | |
| - name: difficulty | |
| dtype: string | |
| - name: evidence_reference | |
| dtype: string | |
| - name: expected_finding | |
| dtype: bool | |
| - name: explanation | |
| dtype: string | |
| - name: fix_explanation | |
| dtype: string | |
| - name: framework | |
| dtype: string | |
| - name: hard_negative | |
| dtype: bool | |
| - name: id | |
| dtype: string | |
| - name: label | |
| dtype: string | |
| - name: language | |
| dtype: string | |
| - name: leakage_group_id | |
| dtype: string | |
| - name: pair_id | |
| dtype: string | |
| - name: pattern | |
| dtype: string | |
| - name: provenance | |
| struct: | |
| - name: authoring | |
| dtype: string | |
| - name: collection | |
| dtype: string | |
| - name: independent_human_review | |
| dtype: bool | |
| - name: origin | |
| dtype: string | |
| - name: review_note | |
| dtype: string | |
| - name: sample_id | |
| dtype: string | |
| - name: sanitization | |
| dtype: string | |
| - name: scenario_family_id | |
| dtype: string | |
| - name: secure_fix | |
| dtype: string | |
| - name: sink_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_type | |
| dtype: string | |
| - name: split | |
| dtype: string | |
| - name: taint_path | |
| list: string | |
| - name: verification_method | |
| dtype: string | |
| - name: verification_status | |
| dtype: string | |
| - name: vulnerability_type | |
| dtype: string | |
| - name: vulnerable_lines | |
| list: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - config_name: corpus_3c1 | |
| features: | |
| - name: assumptions | |
| dtype: string | |
| - name: code | |
| dtype: string | |
| - name: code_files | |
| list: | |
| - name: code | |
| dtype: string | |
| - name: path | |
| dtype: string | |
| - name: code_sha256 | |
| dtype: string | |
| - name: cwe_id | |
| dtype: string | |
| - name: cwe_rationale | |
| dtype: string | |
| - name: cwe_reference | |
| dtype: string | |
| - name: evidence_reference | |
| dtype: string | |
| - name: explanation | |
| dtype: string | |
| - name: framework | |
| dtype: string | |
| - name: full_behavior_contract | |
| dtype: bool | |
| - name: hard_negative | |
| dtype: bool | |
| - name: id | |
| dtype: string | |
| - name: independent_review | |
| dtype: bool | |
| - name: label | |
| dtype: string | |
| - name: leakage_group_id | |
| dtype: string | |
| - name: pair_id | |
| dtype: string | |
| - name: pattern | |
| dtype: string | |
| - name: sample_id | |
| dtype: string | |
| - name: scenario_family_id | |
| dtype: string | |
| - name: secure_fix | |
| dtype: string | |
| - name: sink_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_type | |
| dtype: string | |
| - name: split | |
| dtype: string | |
| - name: taint_path | |
| list: string | |
| - name: threat_model | |
| dtype: string | |
| - name: verification_contract | |
| dtype: string | |
| - name: verification_status | |
| dtype: string | |
| - name: vulnerable_lines | |
| list: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - config_name: official_3c1 | |
| features: | |
| - name: assumptions | |
| dtype: string | |
| - name: code | |
| dtype: string | |
| - name: code_files | |
| list: | |
| - name: code | |
| dtype: string | |
| - name: path | |
| dtype: string | |
| - name: code_sha256 | |
| dtype: string | |
| - name: cwe_id | |
| dtype: string | |
| - name: cwe_rationale | |
| dtype: string | |
| - name: cwe_reference | |
| dtype: string | |
| - name: evidence_reference | |
| dtype: string | |
| - name: explanation | |
| dtype: string | |
| - name: framework | |
| dtype: string | |
| - name: full_behavior_contract | |
| dtype: bool | |
| - name: hard_negative | |
| dtype: bool | |
| - name: id | |
| dtype: string | |
| - name: independent_review | |
| dtype: bool | |
| - name: label | |
| dtype: string | |
| - name: leakage_group_id | |
| dtype: string | |
| - name: pair_id | |
| dtype: string | |
| - name: pattern | |
| dtype: string | |
| - name: sample_id | |
| dtype: string | |
| - name: scenario_family_id | |
| dtype: string | |
| - name: secure_fix | |
| dtype: string | |
| - name: sink_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_location | |
| struct: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| - name: source_type | |
| dtype: string | |
| - name: split | |
| dtype: string | |
| - name: taint_path | |
| list: string | |
| - name: threat_model | |
| dtype: string | |
| - name: verification_contract | |
| dtype: string | |
| - name: verification_status | |
| dtype: string | |
| - name: vulnerable_lines | |
| list: | |
| - name: end_line | |
| dtype: int64 | |
| - name: path | |
| dtype: string | |
| - name: start_line | |
| dtype: int64 | |
| # CodeDNA: Python Security Benchmark | |
| An independent AI/ML security research project with original synthetic Python | |
| examples for vulnerability detection, secure remediation and static analysis. | |
| Paired implementations include explicit security assumptions and executable | |
| verification. | |
| **154 records · 34 CWE categories · 115 evidence-eligible examples · Apache-2.0** | |
| [Documentation](docs/README.md) · [Methodology](docs/methodology.md) · [Release notes](docs/releases.md) · [Review protocol](docs/review.md) | |
| ## Scope | |
| Examples cover SQL injection, command injection, path traversal, unsafe | |
| deserialization, authorization, credential handling and related weaknesses. | |
| Fixtures use Flask, FastAPI, SQLAlchemy and Python's standard library, including | |
| cross-module flows and benign/adversarial checks. | |
| This is a small educational research dataset. Examples are synthetic; labels have | |
| not undergone independent human review. It is not a production vulnerability corpus. | |
| ## Quick start | |
| Install `datasets` in a Python environment. This public dataset can be loaded | |
| without a Hugging Face account or access token: | |
| ```python | |
| from datasets import load_dataset | |
| dataset = load_dataset( | |
| "Helinity/python-security-benchmark", | |
| "official_3c1", | |
| revision="v0.1.0", | |
| ) | |
| print(dataset["test"][0]["code_files"]) | |
| ``` | |
| Pin `v0.1.0` for reproducible experiments. See the | |
| [reproduction instructions](docs/README.md#reproduction) for installation and checks. | |
| ## Configurations | |
| | Configuration | Records | Use | | |
| |---|---:|---| | |
| | `default` | 64 | Original eight-field compatibility snapshot | | |
| | `corpus` | 84 | Legacy research corpus, including excluded examples | | |
| | `official` | 49 | Evidence-eligible subset of the legacy corpus | | |
| | `corpus_3c1` | 70 | Application fixtures and hard negatives | | |
| | `official_3c1` | 66 | Evidence-eligible subset of the application corpus | | |
| | `benchmark` | 60 | Historical subset; not the current official evaluation set | | |
| Names are stable API identifiers; `_3c1` identifies the application expansion. | |
| The two corpora contain 154 distinct records. Their official subsets contain 115 | |
| records and are evaluated separately. Other configurations overlap these sets; | |
| do not sum every row of the table. Use the declared splits: `default` includes | |
| held-out examples and must not serve as training data for those evaluations. | |
| ## Evidence and limitations | |
| - **Runtime evidence:** 82 eligible records have Docker evidence; 33 have | |
| controlled local-process property evidence, which is not an OS sandbox. | |
| - **Validation:** the historical acceptance audit recorded 65 regression tests | |
| and 140 application contract checks. The migrated release passed 66 regression | |
| tests after a privacy-log regression test was added. These are separate runs. | |
| - **Exclusions:** 39 records remain outside official scoring, including four | |
| HTML/redirect examples without sufficient sink context. | |
| - **Human review:** pending. Secure labels depend on each example's assumptions; | |
| they do not establish the security of an entire application. | |
| Use only `code` or `code_files` as detector inputs. Fixes, contracts, annotations | |
| and explanations can disclose the expected label. Small synthetic fixtures and | |
| small test splits do not support broad model-generalization claims. | |
| ## Repository | |
| ```text | |
| data/ Versioned datasets, splits and evidence | |
| curation/ Original example definitions | |
| research/ Fixtures, generators, verification and evaluation | |
| scripts/ Compatibility dataset generation and validation | |
| tests/ Regression tests | |
| docs/ Guides, methodology and historical audit reports | |
| releases/ Frozen schemas, statistics, eligibility and review materials | |
| ``` | |
| The [documentation index](docs/README.md) separates current guidance from historical | |
| reports. `main` carries documentation maintenance; the `v0.1.0` tag remains fixed. | |
| ## License and provenance | |
| Authored with AI assistance for this project. No third-party dataset or proprietary | |
| code was imported. Original examples and annotations use [Apache-2.0](LICENSE); | |
| dependencies retain their own licenses. | |