Sabaragamuwa University of Sri Lanka

Evaluating the security of JavaScript code generated by GitHub Copilot using static analysis tools

Show simple item record

dc.contributor.author Partheepan, V.
dc.contributor.author Wijerathna, R.M.K.K.
dc.date.accessioned 2026-06-03T06:38:10Z
dc.date.available 2026-06-03T06:38:10Z
dc.date.issued 2026-01-28
dc.identifier.isbn 978-624-5727-44-5
dc.identifier.uri http://repo.lib.sab.ac.lk:8080/xmlui/handle/susl/5318
dc.description.abstract Artificial Intelligence (AI) tools are changing the way code is written in software development. According to a Sonatype (2023) report 97% of developers use Large Language Models (LLMs) for their work and improve software development. However, there are still concerns about the security of AIgenerated code. This paper examines the security weaknesses of the JavaScript code generated by GitHub Copilot. Addressing the type of the frequencies and CommonWeakness Enumeration (CWE) weaknesses, the comparison of various static analysis tools, and the possibility of prompt refinement to reduce insecure output. Previous studies have demonstrated that AI-written code often has exploitable vulnerabilities (Fu et al.2023) found 29.5% of Python and 24.2% of JavaScript affected of CWEs in Copilot-written code when rewritten to code of actual projects on GitHub. We gathered 500 real-world developer tasks on Stack Overflow and GitHub Issues, and they included the tasks like API usage, input validation, and DOM manipulation. Prompts were translated and GitHub Copilot in Visual Studio Code generated the generated JavaScript code corresponding to each task. Our analysis, we found that there were vulnerabilities to security in the generated JavaScript code. ESLint identified 323 issues and 345 issues were identified by CodeQL, respectively. In total, these results span 31 distinct categories of Common Weakness Enumeration (CWE). The vulnerabilities were repeated many times; they were prototype pollution (CWE-915), improper output encoding (CWE-117), regex-based denial of service (CWE-1333), DOM-based cross-site scripting (CWE-79), and path traversal (CWE-22). Especially, seven of those CWEs are among the 2025 CWE Top 25, highlighting their severity. The security flaws were mitigated by 51.8% which indicates that security-centric prompts are effective when they are carefully refined. The results indicate that Copilot-generated JavaScript code frequently contains security vulnerabilities. To achieve responsible development with the help of AI, we suggest applying a multi-tool analysis pipeline and security-conscious prompts. en_US
dc.language.iso en en_US
dc.publisher Faculty of Computing. Sabaragamuwa University of Sri Lanka. en_US
dc.subject GitHub Copilot en_US
dc.subject JavaScript en_US
dc.subject AI Code Generation en_US
dc.subject Security Weaknesses/CWE en_US
dc.subject Static Code Analysis en_US
dc.title Evaluating the security of JavaScript code generated by GitHub Copilot using static analysis tools en_US
dc.type Article en_US


Files in this item

This item appears in the following Collection(s)

Show simple item record

Search DSpace


Advanced Search

Browse

My Account