You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

YAML Metadata Warning:empty or missing yaml metadata in repo card

Check out the documentation for more information.

SALVE Dataset — Schema & Datasheet

Formal documentation of the curated secure/insecure JavaScript & TypeScript vulnerability dataset (T1 deliverable "Dataset Documentation & Benchmarking Guidelines"). Follows the Datasheets for Datasets structure (Gebru et al.).

This datasheet describes the active, versioned dataset salve-core-le9-v2 (built 2026-06-18). All figures below are measured from that file, not estimated. The dataset is resolved through the registry (data/datasets/registry.json); see §8 for versioning. The raw, pre-clean collection pool is data/js_vuln_pairs.jsonl (§3).

Companion docs: collection methodology → data_collection.md; quality control → preprocessing.md §1; file-count noise → file_count_investigation.md; CWE/Joern validation → cwe_frequency_and_joern.md, oracle_validation.md.


1. Overview / Motivation

Pairs of vulnerable (pre-patch) and fixed (post-patch) real-world JS/TS source files, each drawn from a security-fix commit and labelled with a CWE type. Built to (T1) study security-preserving perturbations and (T2) measure whether LLM vulnerability classifiers are robust to those perturbations. Real fixes from real projects — not synthetic — so the secure/insecure distinction reflects how vulnerabilities are actually introduced and patched.


2. Composition

2.1 Size (measured — salve-core-le9-v2)

Granularity Count
Records (one per changed core file) 7,075
Unique vulnerabilities (vuln_id) 3,727
Unique projects 1,328
Unique fix commits 2,310
Complete pre+post pairs 5,184 (73.3%)
Malformed JSON 0
Language split JS 58.8% / TS 41.2%

How this relates to the collection pool. The raw extraction (js_vuln_pairs.jsonl) yields 3,943 JS/TS single-CWE single-commit vulns across 16,251 deduped file-records. The active dataset applies quality control (§4) — dedup, core-only, a ≤9 core-files-per-commit cut, and a min-patch filter — retaining 3,727 / 3,943 = 94.5% of the collected vulnerabilities while discarding release/refactor noise. (See data_collection.md for the full upstream→collected provenance funnel: upstream 44,037 all-language vulns → single-CWE → single-commit → JS/TS → 3,943 collected.)

Read this carefully: one row = one file in a fix commit, not one vulnerability. A vulnerability may span several files (now at most 9, by construction), and a fix commit may carry several vulnerabilities.

2.2 Record schema (one JSON object per line)

Field Type Completeness Description
id str 100% Composite primary key: vuln_id::commit_sha::file_path. Dedup key.
cwe str 100% CWE identifier, e.g. CWE-79. Exactly one CWE per vuln (0 conflicts).
cve str/null 55.1% CVE id when one exists. Null for the ~45% that are GHSA-only advisories. Use metadata.vuln_id as the universal key.
language str 100% javascript or typescript.
pre_patch str 77.6% non-empty Removed (vulnerable) lines of the unified diff, - stripped — not the whole file. Empty when the fix only adds lines. Full pre-fix files → data/reconstructed/ (§2.7).
post_patch str 95.6% non-empty Added (fixed) lines of the unified diff, + stripped. Empty when the fix only deletes lines.
commit_url str 100% GitHub commit URL for the fix.
metadata.vuln_id str 100% Advisory ID — CVE-… or GHSA-…. The de-facto identifier.
metadata.summary str 100% Advisory summary text.
metadata.score num 95.7% CVSS base score.
metadata.severity str 95.7% Qualitative band (none/low/medium/high/critical), derived from score.
metadata.published_date str 100% ISO date of the advisory.
metadata.project str 100% Source repository URL.
metadata.commit_sha str 100% Fix commit SHA (parent = sha~1 = the vulnerable state).
metadata.file_path str 100% Path of the file within the repo.
metadata.additions int 100% Lines added in this file's diff (median 6, mean 22, max 2,293).
metadata.deletions int 100% Lines deleted (median 2, max 2,454).
metadata.shared_commit bool 100% true if the file shares its commit with other vuln files.
metadata.category str 100% File category from quality control — always "core" in this dataset (§4 Pass 1).
metadata.relevance_score float optional Present only when the relevance filter (Pass 4) scored the file; absent in v2 (relevance filter off).

2.3 CWE composition — by unique vulnerability (canonical)

Top-12 of 3,727 vulns (one CWE each); top-10 = 62.7%, top-12 = 66.5%.

Rank CWE Name Vulns %
1 CWE-79 Cross-site Scripting (XSS) 1,131 30.3%
2 CWE-1321 Prototype Pollution 231 6.2%
3 CWE-22 Path Traversal 192 5.2%
4 CWE-918 SSRF 140 3.8%
5 CWE-78 OS Command Injection 131 3.5%
6 CWE-352 CSRF 110 3.0%
7 CWE-200 Information Exposure 108 2.9%
8 CWE-94 Code Injection 108 2.9%
9 CWE-1333 ReDoS 95 2.5%
10 CWE-20 Improper Input Validation 89 2.4%
11 CWE-400 Uncontrolled Resource Consumption 81 2.2%
12 CWE-601 Open Redirect 64 1.7%

2.4 CWE composition — by file-record

Counted by record (7,075): CWE-79 30.0%, CWE-22 5.1%, CWE-1321 5.0%, CWE-918 4.7%, CWE-352 3.5%, CWE-200 3.1%. The by-vuln and by-file rankings now agree (both led by XSS at ~30%). This is a side effect of the ≤9-files-per-commit cut: the old corpus showed a large CWE-95 (Eval Injection) spike at file level (13.6%) driven by a few vulns whose fix commits touched hundreds of files — those release/refactor commits are exactly what the commit cut removes, so the file-level skew is gone.

2.5 Pair completeness (critical for paired use)

Side Count %
Complete pair (pre and post non-empty) 5,184 73.3%
Empty pre_patch (file added by fix) 1,584 22.4%
Empty post_patch (file removed by fix) 309 4.4%

For any task needing both a vulnerable and a fixed version of the same file (secure/insecure classification, perturbation pairing), use the 5,184 complete pairs. The remainder are single-sided by nature (vendored additions, deletions). Note these are diff hunks, not full files — for whole-file analysis use the reconstructed corpus (§2.7). Completeness improved markedly over the collection pool (59.6% → 73.3%) because the commit cut removes large new-file dumps (empty-pre records).

2.6 Language

JavaScript 4,162 (58.8%), TypeScript 2,913 (41.2%). Both first-class; TS matters for cross-file taint resolution (see oracle_validation.md).

2.7 Reconstructed full files (data/reconstructed/)

extraction/reconstruct_files.py fetches the complete pre- and post-fix files from GitHub (post = file at the patch commit; pre = file at the parent commit, with reverse-diff fallback) and writes them as data/reconstructed/<CWE>/<vuln_id>__<safe_path>.{pre,post}.<ext>. This is the corpus the Joern/Semgrep oracles run on (whole-file analysis needs full context, not diff hunks). Currently ~957 complete full-file pairs across the top-10 CWEs (a subset, expanding). Note: the reconstructed corpus is not yet restricted to the active dataset's commit cut — that wiring is pending.


3. Collection process (summary)

Vulnerabilities come from a dashboard export of advisory data (OSV / GitHub Security Advisories). extraction/fetch_dataset.py keeps only single-commit, single-CWE advisories, takes each changed core .js/.ts/.jsx/.tsx/.mjs/.cjs file's unified diff, and emits removed lines as pre_patch and added lines as post_patchdata/js_vuln_pairs.jsonl (the collection pool). extraction/reconstruct_files.py separately fetches the whole pre/post files (§2.7). Full sourcing methodology and the upstream→collected funnel → data_collection.md.


4. Preprocessing / quality control

preprocessing/noise_reduction.py applies, in order: (0) dedup (drops 75.3% exact-duplicate rows from a source-CSV bug), (1) category verification (keeps only core — drops test/docs/config/lockfile/vendored/generated), (1b) commit core-file cap (discards whole commits touching > N core files), (2/3) CWE/language filters (opt-in), (4) relevance filter (opt-in, signal- preserving), (5) per-vuln file cap (opt-in), (6) minimum patch size.

The active dataset salve-core-le9-v2 is built with Pass 1b at N=9 and min-patch ≥1 (relevance filter and per-vuln cap off):

python3 preprocessing/noise_reduction.py \
    --max-commit-core-files 9 --no-cap --min-patch-lines 1 \
    --dataset-version salve-core-le9-v2

Pipeline (records): raw 65,825 → dedup 16,251 → core 14,551 → ≤9-files/commit 7,075 → min-patch≥1 7,075. The ≤9 cut is the elbow of the commit-size/retention curve (dashboard "Commit-size cutoff" page): it discards 101 large release/refactor/merge commits (~half of all core-file records) while retaining 94.5% of vulnerabilities, because those commits' files are mostly non-vulnerable source churn. See file_count_investigation.md.


5. Recommended uses & benchmarking guidelines

  • Secure/insecure classification: use the 5,184 complete pairs (§2.5). Treat pre_patch = vulnerable (label 1), post_patch = fixed (label 0).
  • Stratify by CWE using the by-vulnerability counts (§2.3); the long tail is steep (top-1 alone is 30%).
  • Split by vuln_id or project, not by row — files from one vuln/commit are highly correlated; a row-level split leaks.
  • Use score for severity (severity band is derived from it).
  • Ground-truth "still vulnerable?" labels for perturbed variants come from the Joern oracle (validation/joern/cwe_specs.json), not from this file.
  • Pin the dataset version (salve-core-le9-v2) and its sha256 from the registry (§8) in any experiment for reproducibility.

6. Known limitations (foundation notes)

  1. cve is 55.1% populated — the rest are GHSA-only advisories with no CVE by nature. metadata.vuln_id is the universal key (CVE/GHSA mix).
  2. 73.3% are complete two-sided pairs. Empty-pre (new files) and empty-post (deletions) are inherent to commit-derived data; paired tasks must filter to the complete subset.
  3. Vuln attribution is commit-level. A CVE is attributed to a whole commit; the actual fix may be in a subset of its (now ≤9) files. The commit cut and the optional relevance filter mitigate this but do not perfectly localize the fix — "a core file" is a changed source file, not necessarily the vulnerable file (see file_count_investigation.md).
  4. Inadvertent/incidental fixes are only approximately excluded (via the single-commit + commit-cut filters); oracle-verified exclusion exists for the perturbation loop, not retroactively over the base pairs.
  5. CWE granularity varies (e.g. CWE-94 vs CWE-95 both code/eval injection).
  6. Collection is by file extension, so the dataset includes JS/TS files from polyglot repos whose primary language is not JS — there is no clean "JS share" denominator against the upstream set (see data_collection.md).

7. Provenance & maintenance

  • Collection pool: data/js_vuln_pairs.jsonl (gitignored — large; regenerated by extraction/fetch_dataset.py).
  • Active dataset: data/datasets/salve-core-le9-v2.jsonl (+ a byte-identical copy at data/js_vuln_pairs_clean.jsonl for back-compat), resolved via the registry (§8).
  • Reconstructed files: data/reconstructed/<CWE>/* (pre/post full files).
  • Regenerate: the noise_reduction.py command in §4. This datasheet should be regenerated when the active dataset version changes.

8. Dataset versions & registry

Every built dataset is recorded in data/datasets/registry.json by preprocessing/dataset_registry.py, with the exact filters, measured counts, a sha256 of the file and its source, and a build date. The registry names one active version; downstream code resolves it via dataset_registry.active_path() instead of hard-coding a path, and the dashboard exposes a version selector.

Version Records Vulns Filters Status
salve-core-le9-v1 6,800 3,668 core, ≤9 files/commit, min-patch ≥2 superseded
salve-core-le9-v2 7,075 3,727 core, ≤9 files/commit, min-patch ≥1 active

v2 lowered min-patch from ≥2 to ≥1 to recover 59 legitimate one-line fixes (e.g. a single added escape()/validation call) that ≥2 had dropped. min-patch counts changed lines (combined pre+post), not files. Build a new version with noise_reduction.py --dataset-version <name>; it is registered and marked active automatically.

Downloads last month
6