arXiv:2510.26457cs.SEcs.AI2025-10中稿 · ICSE 2026综述被引 8

让大模型更懂代码安全,自动发现并修复漏洞。

SecureReviewer: Enhancing Large Language Models for Secure Code Review through Secure-aware Fine-tuning

  • 用安全感知微调提升大模型识别漏洞能力
  • 在真实数据集上检测准确率显著优于基线
  • 适合安全开发、自动化审查团队使用

在开发早期识别并解决安全问题对降低软件系统长期风险至关重要。代码审查是开发者在代码合并前检查同事代码的有效实践。为提升评论生成效率,已有大量基于大语言模型(LLM)的自动化代码审查方法,但现有模型多聚焦通用审查,对安全问题的识别与修复能力仍不充分。且针对安全问题的适配面临数据稀缺和评估指标不足的挑战。为此,我们提出SecureReviewer,通过构建专用数据集,并采用安全感知微调策略,使大模型能有效识别安全漏洞并提供修复建议。为减少幻觉,引入RAG技术,将输出锚定在领域安全知识中。同时提出SecureBLEU新评估指标,衡量评论对安全问题的解决效果。实验表明,SecureReviewer在安全漏洞检测准确率及评论质量与实用性方面均超越当前最优基线。

原文摘要 · Abstract (English)

Identifying and addressing security issues during the early phase of the development lifecycle is critical for mitigating the long-term negative impacts on software systems. Code review serves as an effective practice that enables developers to check their teammates' code before integration into the codebase. To streamline the generation of review comments, various automated code review approaches have been proposed, where LLM-based methods have significantly advanced the capabilities of automated review generation. However, existing models primarily focus on general-purpose code review, their effectiveness in identifying and addressing security-related issues remains underexplored. Moreover, adapting existing code review approaches to target security issues faces substantial challenges, including data scarcity and inadequate evaluation metrics. To address these limitations, we propose SecureReviewer, a new approach designed for enhancing LLMs' ability to identify and resolve security-related issues during code review. Specifically, we first construct a dataset tailored for training and evaluating secure code review capabilities. Leveraging this dataset, we fine-tune LLMs to generate code review comments that can effectively identify security issues and provide fix suggestions with our proposed secure-aware fine-tuning strategy. To mitigate hallucination in LLMs and enhance the reliability of their outputs, we integrate the RAG technique, which grounds the generated comments in domain-specific security knowledge. Additionally, we introduce SecureBLEU, a new evaluation metric designed to assess the effectiveness of review comments in addressing security issues. Experimental results demonstrate that SecureReviewer outperforms state-of-the-art baselines in both security issue detection accuracy and the overall quality and practical utility of generated review comments.

代码安全大模型自动化审查

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。