arXiv(opens in a new tab)cs.CRAug 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2608.25730

From Verdict to Diagnosis: Attributable Security Review of Pull Requests

Zhuo Chen, Boyang Wang, Xiyue Zhang, Xiaoyun Xu, Ahmad-Reza Sadeghi, Stjepan Picek, Lichao Wu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Zhuo Chen

University of Bristol

Boyang Wang

University of Bristol

Xiyue Zhang

University of Bristol

Xiaoyun Xu

Zhongguancun Academy

Ahmad-Reza Sadeghi

Technical University Darmstadt

Stjepan Picek

University of Zagreb & Radboud University

Lichao Wu

University of Bristol

Abstract

Automated code reviewers are commonly evaluated by whether they block a malicious pull request (PR). A block, however, may be triggered by an unrelated issue rather than the vulnerability that makes the PR unsafe. Such a review appears successful under verdict-based evaluation, yet can misdirect remediation and leave the actual vulnerability unaddressed. We call this discrepancy between the verdict and the delivered diagnosis the Verdict–Diagnosis (VD) gap.

Measuring this gap requires knowing not only whether a PR is vulnerable, but also which vulnerability should be identified and what evidence establishes it. We therefore introduce MALPR-BENCH, a benchmark comprising 89 malicious PRs and 50 benign controls across 44 repositories and eight language families. Its pre-committed, mechanism-level ground truth enables verdict correctness, vulnerability identification, and evidence validation to be evaluated separately.

We further introduce PRGUARD, an attributable PR security reviewer that separates vulnerability identification from evidence validation and retrieves security-relevant repository context to substantiate its findings. Across 31 held-out malicious PRs, PRGUARD and CodeRabbit [4], a widely deployed commercial AI code reviewer, achieve nearly identical blocking performance, yet PRGUARD/DeepSeek identifies 1.38×1.38\times as many target vulnerabilities. On absence-type PRs, where a required guard or ownership check is missing, PRGUARD identifies 3×3\times more vulnerabilities than CodeRabbit. Applied to real-world production repositories, PRGUARD further uncovers twelve previously undisclosed, proof-of-concept-backed vulnerabilities across five widely used projects.

1 Introduction

Large language models (LLMs) are increasingly used to generate production code, yet their output can contain security weaknesses that lead to exploitable vulnerabilities [12]. Autonomous coding agents compound this problem by turning generated code directly into pull requests, scaling both the number of potentially insecure changes and the workload required to assess them [17]. This automation operates within a rapidly growing review workload: GitHub reports that monthly commit volume more than doubled from 1.4 billion to 2.9 billion between April and August 2026, while merged-PR volume approached 130 million per month [8]. Automated reviewers and static-analysis tools thus increasingly mediate which changes receive human attention [2, 13]. General-purpose code review usually emphasizes whether a change behaves as intended and is maintainable. Security review must additionally assess whether the change creates or leaves open an exploitable path in the surrounding system. Since that path may extend beyond the diff, the decisive evidence can lie in unchanged repository code.

This distinction raises a foundational evaluation question: what does it mean for an automated PR security review to be correct? Existing vulnerability-detection evaluations commonly measure whether a system correctly classifies code as vulnerable or benign [27]. Recent PR-security benchmarks similarly emphasize whether a reviewer approves or rejects a malicious change, sometimes additionally checking whether the rejection raises a security concern [16]. Still, these metrics do not necessarily establish that the reviewer identified the vulnerability that actually makes the PR unsafe. A correct blocking verdict can therefore conceal an incorrect diagnosis.

We call this discrepancy between a reviewer’s verdict and its diagnosis of the actual vulnerability the Verdict–Diagnosis (VD) gap. Consider a production PR, detailed in Section 6.2 and Table 7. The PR accepted a client-supplied run identifier, but an unchanged checkpoint lookup did not bind that identifier to the current project, enabling cross-project access. A reviewer blocked the PR, but reported a client-side secret-rendering issue rather than the missing ownership check. Verdict-only scoring would mark this review as successful, even though fixing the reported issue would leave the authorization flaw unaddressed.

This gap motivates our first research question: RQ1: How faithfully does a correct PR-review verdict reflect a correct diagnosis of the underlying vulnerability? Answering this question requires richer ground truth than a vulnerable/benign label. For each malicious PR, an evaluation must specify not only that the PR is vulnerable but also which vulnerability should be identified and what repository evidence establishes it. We therefore introduce MALPR-BENCH, a PR-security benchmark to distinguish verdict correctness from both target-vulnerability identification and repository-evidence validation in the delivered review. Each benchmark case has a frozen case-specific rubric specifying the target vulnerability, accepted descriptions of its mechanism, the code evidence required to substantiate it, and off-target security findings that do not receive credit. This allows us to measure whether a reviewer reaches the correct verdict, identifies the target vulnerability, and substantiates that vulnerability with concrete repository evidence.

However, measuring the VD gap alone does not improve the reliability of the security review. We thus ask a follow-up question: RQ2: Can separating vulnerability identification from evidence validation help PR reviewers narrow the VD gap? To answer this question, we propose PRGUARD, which first formulates a concrete candidate vulnerability and then tests its critical premises against repository evidence. Since evidence may lie beyond the changed lines, PRGUARD examines the repository context surrounding the change and retrieves additional evidence when needed to resolve a concrete security question. We evaluate how target-vulnerability identification and evidence validation vary across configurations that provide different forms and amounts of repository evidence. The goal of PRGUARD is therefore not merely to block more malicious PRs, but to make each blocking verdict attributable to the actual vulnerability introduced by the pull request and grounded in repository evidence that substantiates the diagnosis.

Controlled benchmarks measure the VD gap against vulnerabilities known to the evaluators, but real-world review begins without a predefined target or rubric. We therefore ask: RQ3: Can PRGUARD uncover real-world vulnerabilities? We apply PRGUARD to historical PR candidates from production repositories and confirm twelve previously undisclosed, PoC-backed vulnerabilities across five repositories. On these cases, independent runs of PRGUARD and CodeRabbit both block 10/12 PRs, but produce 10/12 and 4/12 attributable blocks, respectively. Thus, identical verdict totals mask a 2.5×2.5 \times difference in attributable blocks. Our contributions are as follows:

• We formulate and characterize the Verdict–Diagnosis gap in automated PR security review and introduce a systematic evaluation framework that individually measures verdict correctness, target-vulnerability identification, and evidence validation.

• We introduce MALPR-BENCH, a mechanism-grounded benchmark comprising 89 malicious PRs and 50 benign controls across 44 repositories and eight languages. Its pre-committed rubrics specify both the target vulnerability and the repository evidence to support it.

• We design PRGUARD, an attributable PR security reviewer that separates vulnerability identification from evidence validation to bridge verdicts with evidence.

• On the 31-case common-coverage challenge set, PR-GUARD/DeepSeek identifies 1.38×1.38\times as many target vulnerabilities as CodeRabbit despite similar blocking totals. On absence-type PRs, both systems block 9/14 cases, but PRGUARD/DeepSeek identifies 3×3\times more vulnerabilities. We further establish the practical significance of the VD gap by uncovering twelve previously undisclosed and PoC-backed vulnerabilities across five production repositories.

The paper is organized as follows: Section 2 defines the threat model and attributable security review problem. Section 3 presents MALPR-BENCH and its mechanism-level evaluation methodology. Section 4 introduces the design and implementation of PRGUARD. Section 5 evaluates the Verdict–Diagnosis gap and PRGUARD on held-out PRs from MALPR-BENCH. Section 6 studies previously undisclosed production vulnerabilities. Section 7 discusses the implications and scope of the findings, and Section 8 reviews related work. Finally, Section 9 concludes this work. The appendices provide construction and reproducibility records, case-level evidence, implementation and grading details, ethical considerations, and open-science documentation.

References (19)