跳到正文
arXiv cs.AI· Jiongchi Yu, Keke Lian, Junqing Wang, Zhikang Fan, Zhaoxuan Li, Yongheng Huang, Ziming Zhao, Dong Zhang·· 3 小时前AI 评分56

A.S.E 2.0 提出 CASE-Bench,研究仓库上下文如何影响 LLM 生成代码的安全性

A.S.E 2.0: Understanding How Repository Context Impacts the Security of LLM-Generated Code

AI 导读

论文发布 CASE-Bench,包含来自 51 个项目真实 CVE 的 145 个仓库级任务,比较 13 种上下文构建方法与 6 个 LLM。

正文 · 原文

View PDF HTML (experimental)

Abstract:Large language model (LLM) coding assistants and agents construct a repository context before generating code. For security-sensitive code, this context decides whether the model sees the project's safeguards (e.g., authorization checks) or insecure code to imitate. However, context construction is designed almost exclusively for functional correctness, and secure-code benchmarks treat the context as fixed, so how repository context affects the security of generated code remains unclear. We construct CASE-Bench, a benchmark of 145 repository-level tasks from real CVEs in 51 projects. Each task runs in Docker, has functional tests and a proof-of-concept exploit validated in both directions, and is annotated with the repository code that enforces or undermines its security. Using CASE-Bench, we compare 13 context construction methods and six controls with six LLMs, edit single context elements, and analyze coding-agent trajectories. We find that (1) functionality-oriented context raises the functional pass rate by up to 8.2 percentage points (pp) but the secure pass rate by at most 3.7 pp, (2) withholding a safeguard lowers the secure pass rate by up to 8.1 pp, while one inserted insecure exemplar raises correct-but-exploitable code by 6.3 pp, and (3) coding agents observe the relevant safeguard in only 27-36% of trajectories. These findings inform security-aware context construction and secure-code evaluation.
Comments: 15 pages
Subjects: Cryptography and Security (cs.CR); Artificial Intelligence (cs.AI); Software Engineering (cs.SE)
Cite as: arXiv:2611.06294 [cs.CR]
  (or arXiv:2611.06294v1 [cs.CR] for this version)
  https://doi.org/10.48550/arXiv.2611.06294

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Jiongchi Yu [view email]
[v1] Wed, 4 Nov 2026 10:29:52 UTC (678 KB)

来源:arXiv cs.AI · arxiv.org