arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2403.13193cs.CRcs.AI
收藏

使用大型语言模型修复 JavaScript 程序漏洞的研究

A Study of Vulnerability Repair in JavaScript Programs with Large Language Models

Simon Fraser University(西蒙菲莎大学)

Tan Khang Le, Saba Alimadadi, Steven Y. Ko

AI总结:

本研究探讨了ChatGPT和Bard等大型语言模型在修复JavaScript程序安全漏洞中的准确性,并发现提示中适当的上下文对生成正确补丁至关重要。

摘要:

近年来,JavaScript已成为最广泛使用的编程语言,尤其是在Web开发中。然而,编写安全的JavaScript代码并非易事,程序员常常会犯错误,导致Web应用程序中出现安全漏洞。大型语言模型(LLMs)在多个领域展现了显著进步,其不断发展的能力表明它们具有基于需求规范自动生成代码的潜力,包括自动修复漏洞。在本研究中,我们探讨了LLMs(即ChatGPT和Bard)在查找和修复JavaScript程序安全漏洞方面的准确性。我们还研究了提示中上下文对引导LLMs生成正确漏洞代码补丁的影响。我们在真实软件漏洞上的实验表明,尽管LLMs在JavaScript代码自动程序修复方面具有潜力,但要实现正确的漏洞修复,通常需要在提示中提供适当数量的上下文。

英文摘要:

In recent years, JavaScript has become the most widely used programming language, especially in web development. However, writing secure JavaScript code is not trivial, and programmers often make mistakes that lead to security vulnerabilities in web applications. Large Language Models (LLMs) have demonstrated substantial advancements across multiple domains, and their evolving capabilities indicate their potential for automatic code generation based on a required specification, including automatic bug fixing. In this study, we explore the accuracy of LLMs, namely ChatGPT and Bard, in finding and fixing security vulnerabilities in JavaScript programs. We also investigate the impact of context in a prompt on directing LLMs to produce a correct patch of vulnerable JavaScript code. Our experiments on real-world software vulnerabilities show that while LLMs are promising in automatic program repair of JavaScript code, achieving a correct bug fix often requires an appropriate amount of context in the prompt.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑