Content area

Abstract

Large language models (LLMs) have shown remarkable potential for automatic code generation. Yet, these models share a weakness with their human counterparts: inadvertently generating code with security vulnerabilities that could allow unauthorized attackers to access sensitive data or systems. In this work, we propose Feedback-Driven Security Patching (FDSP), wherein LLMs automatically refine vulnerable generated code. The key to our approach is a unique framework that leverages automatic static code analysis to enable the LLM to create and implement potential solutions to code vulnerabilities. Further, we curate a novel benchmark, PythonSecurityEval, that can accelerate progress in the field of code generation by covering diverse, real-world applications, including databases, websites, and operating systems. Our proposed FDSP approach achieves the strongest improvements, reducing vulnerabilities by up to 33% when evaluated with Bandit and 12% with CodeQL and outperforming baseline refinement methods.

Details

1009240
Business indexing term
Title
Leveraging Static Analysis for Feedback-Driven Security Patching in LLM-Generated Code
Publication title
Volume
5
Issue
4
First page
110
Number of pages
30
Publication year
2025
Publication date
2025
Publisher
MDPI AG
Place of publication
Washington
Country of publication
Switzerland
Publication subject
ISSN
2624800X
Source type
Scholarly Journal
Language of publication
English
Document type
Journal Article
Publication history
 
 
Online publication date
2025-12-05
Milestone dates
2025-10-02 (Received); 2025-11-13 (Accepted)
Publication history
 
 
   First posting date
05 Dec 2025
ProQuest document ID
3286310480
Document URL
https://www.proquest.com/scholarly-journals/leveraging-static-analysis-feedback-driven/docview/3286310480/se-2?accountid=208611
Copyright
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). Notwithstanding the ProQuest Terms and Conditions, you may use this content in accordance with the terms of the License.
Last updated
2025-12-24
Database
ProQuest One Academic