SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories

Chihao Shen, Connor Dilgren, Purva Chiniya, Luke Griffith, Yu Ding +1 more
4/29/2025
cs.CRcs.AI

No official code found. Best implementation: ai-sec-lab/SecRepoBench (9 stars, last commit 2026-02-12).

Abstract

This paper introduces SecRepoBench, a benchmark to evaluate code agents on secure code completion in real-world repositories. SecRepoBench has 318 code completion tasks in 27 C/C++ repositories, covering 15 CWEs. We evaluate 29 standalone LLMs and 15 code agents across 3 state-of-the-art agent frameworks using our benchmark. We find that state-of-the-art LLMs struggle with generating correct and secure code completions. However, code agents significantly outperform standalone LLMs. We show that SecRepoBench is more difficult than the prior state-of-the-art benchmark. Finally, our comprehensive analysis provides insights into potential directions for enhancing the ability of code agents to write correct and secure code in real-world repositories.

View on arXivView PDF

Code Implementations(1)

Implementation of SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories

94C, C++Nov 1, 20258 months ago
benchmarkcode-agentcode-completionllmsoftware-engineering

Similar Papers

Cite this paper

@article{shen2025secrepobench,
  title  = {SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositories},
  author = {Chihao Shen and Connor Dilgren and Purva Chiniya and Luke Griffith and Yu Ding and Yizheng Chen},
  year   = {2025},
  eprint = {2504.21205},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2504.21205v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.21205.svg)](https://codeofpaper.com/paper/2504.21205)

Discussion