RepoAudit: An Autonomous LLM-Agent for Repository-Level Code Auditing

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Guo, Jinyao, Wang, Chengpeng, Xu, Xiangzhe, Su, Zian, Zhang, Xiangyu
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866908384597377024
author Guo, Jinyao
Wang, Chengpeng
Xu, Xiangzhe
Su, Zian
Zhang, Xiangyu
author_facet Guo, Jinyao
Wang, Chengpeng
Xu, Xiangzhe
Su, Zian
Zhang, Xiangyu
contents Code auditing is the process of reviewing code with the aim of identifying bugs. Large Language Models (LLMs) have demonstrated promising capabilities for this task without requiring compilation, while also supporting user-friendly customization. However, auditing a code repository with LLMs poses significant challenges: limited context windows and hallucinations can degrade the quality of bug reports, and analyzing large-scale repositories incurs substantial time and token costs, hindering efficiency and scalability. This work introduces an LLM-based agent, RepoAudit, designed to perform autonomous repository-level code auditing. Equipped with agent memory, RepoAudit explores the codebase on demand by analyzing data-flow facts along feasible program paths within individual functions. It further incorporates a validator module to mitigate hallucinations by verifying data-flow facts and checking the satisfiability of path conditions associated with potential bugs, thereby reducing false positives. RepoAudit detects 40 true bugs across 15 real-world benchmark projects with a precision of 78.43%, requiring on average only 0.44 hours and $2.54 per project. Also, it detects 185 new bugs in high-profile projects, among which 174 have been confirmed or fixed. We have open-sourced RepoAudit at https://github.com/PurCL/RepoAudit.
format Preprint
id arxiv_https___arxiv_org_abs_2501_18160
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle RepoAudit: An Autonomous LLM-Agent for Repository-Level Code Auditing
Guo, Jinyao
Wang, Chengpeng
Xu, Xiangzhe
Su, Zian
Zhang, Xiangyu
Software Engineering
Programming Languages
68N30, 68T01
D.3.0; D.2.4; I.2.5; I.2.6
Code auditing is the process of reviewing code with the aim of identifying bugs. Large Language Models (LLMs) have demonstrated promising capabilities for this task without requiring compilation, while also supporting user-friendly customization. However, auditing a code repository with LLMs poses significant challenges: limited context windows and hallucinations can degrade the quality of bug reports, and analyzing large-scale repositories incurs substantial time and token costs, hindering efficiency and scalability. This work introduces an LLM-based agent, RepoAudit, designed to perform autonomous repository-level code auditing. Equipped with agent memory, RepoAudit explores the codebase on demand by analyzing data-flow facts along feasible program paths within individual functions. It further incorporates a validator module to mitigate hallucinations by verifying data-flow facts and checking the satisfiability of path conditions associated with potential bugs, thereby reducing false positives. RepoAudit detects 40 true bugs across 15 real-world benchmark projects with a precision of 78.43%, requiring on average only 0.44 hours and $2.54 per project. Also, it detects 185 new bugs in high-profile projects, among which 174 have been confirmed or fixed. We have open-sourced RepoAudit at https://github.com/PurCL/RepoAudit.
title RepoAudit: An Autonomous LLM-Agent for Repository-Level Code Auditing
topic Software Engineering
Programming Languages
68N30, 68T01
D.3.0; D.2.4; I.2.5; I.2.6
url https://arxiv.org/abs/2501.18160