Manuscript Offprint

arXiv:2609.38012

A Function-level Dataset of Vulnerable and Fixed Source Code in JavaScript and TypeScript

Tamás Viszkok, Péter Hegedűs

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

JavaScript and TypeScript are widely used in modern web development, making their security critical; however, automated vulnerability detection is often constrained by the availability of high-quality training data. Here we present JsVul, a dataset curated from seven major sources. Unlike generic multi-language datasets that may retain noise – such as minified code and cosmetic edits – JsVul utilizes a language-specific pipeline. We collected pre-fix and post-fix versions of files around security fixes and, by filtering irrelevant artifacts and applying automated syntax normalization, isolated security-related changes. We ensured data integrity through multi-stage deduplication and heuristic-based labeling. Provided in a time-ordered JSONL format, JsVul supports robust model training in the JavaScript and TypeScript ecosystem and demonstrates the importance of language-aware preprocessing in building vulnerability datasets.

Background & Summary

The widespread use of JavaScript in both client-side and server-side environments has made it a prime target for attackers, particularly within the npm ecosystem where high interconnectivity allows vulnerabilities to propagate rapidly 1^{1}. As the software industry increasingly adopts Large Language Models (LLMs) for code generation, concerns have arisen regarding the security of the generated code, as models may reproduce vulnerabilities present in their training data 2^{2}. Consequently, the development of robust machine learning-based vulnerability detection systems depends on the availability of high-quality, reliable training data 3;4^{3;4}.

Constructing such datasets presents specific difficulties. Foundational approaches, such as DeepBugs 5^{5} and VulDeePecker 6^{6}, demonstrated the potential of applying probabilistic models and deep learning to vulnerability detection. However, in the broader domain of AI for Code, code duplication has been shown to artificially inflate model performance metrics, leading to poor generalization on novel data 7^{7}. Crucially, subsequent evaluations 8^{8} established that realistic class distributions and rigorous deduplication are essential for valid evaluation. Furthermore, standard experimental setups often ignore the evolution of vulnerabilities over time, introducing “temporal bias” (or data snooping) where models inadvertently learn from future patterns to predict past events 9;10^{9;10}. While benchmarks like Big-Vul 11^{11} have standardized assessment for C/C++, the JavaScript ecosystem has historically lacked a comparable resource utilizing strict cleaning methodologies.

Vulnerability dataset curation generally follows either manual curation or automated mining. Manual curation yields high precision but is difficult to scale, whereas automated mining scales well but often introduces noise. Datasets providing only metadata (repository URLs and commit hashes) introduce

*Corresponding author

Email addresses: twiszkok@inf.u-szeged.hu (T. Viszkok), hpeter@inf.u-szeged.hu (P. Hegedús) the risk of "link rot," where data is lost when URLs become invalid due to repositories being deleted or made private. Furthermore, multi-language datasets may not account for ecosystem-specific artifacts, such as minified code or the flexible syntax of JavaScript. Without language-specific filtering, automated scrapers may include irrelevant files (e.g., tests, build configurations) or cosmetic edits, inflating the scope of modified lines and misleading automated detection methods.

JsVul employs a hybrid approach to bridge the gap between precision and scale. We aggregated raw fixing commits from seven sources using automated retrieval, then refined these data through a pipeline that integrates language-specific automated cleaning with targeted manual verification. By applying JavaScript-specific syntax normalization and custom heuristics for minified code, JsVul isolates security-relevant fixes, resulting in a function-level dataset suitable for deep learning applications.

References (19)