mlsanityData to 26 Nov 2026

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

arXiv 2611.06294 ↗Submitted 4 Nov 2026cs.CR cs.AI cs.SEcited by 0

Not on the map. Why?

Abstract (arXiv)

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.

Key facts. No citing papers in the map yet (data through 26 Nov 2026). Builds on 38 of its 68 references that are in the map. Submitted 4 Nov 2026.

Builds on

38 of 68 references.

References · 38

  1. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,765
  2. 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 909
  3. 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 510
  4. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 446
  5. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 387
  6. 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 384
  7. 2024CodeAgent: Enhancing Code Generation with Tool-Integrated Agent Systems for Real-World Repo-level Coding Challengescited by 291
  8. 2022Do Users Write More Insecure Code with AI Assistants?cited by 202
  9. 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 193
  10. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 165
  11. 2025Context Length Alone Hurts LLM Performance Despite Perfect Retrievalcited by 154
  12. 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 122
26 more
  1. 2023LongCoder: A Long-Range Pre-trained Language Model for Code Completioncited by 119
  2. 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 108
  3. 2024RepoGraph: Enhancing AI Software Engineering with Repository-level Code Graphcited by 104
  4. 2025CVE-Bench: A Benchmark for AI Agents' Ability to Exploit Real-World Web Application Vulnerabilitiescited by 102
  5. 2024Instruction Tuning for Secure Code Generationcited by 75
  6. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 71
  7. 2023LLMSecEval: A Dataset of Natural Language Prompts for Security Evaluationscited by 67
  8. 2023CodeLMSec Benchmark: Systematically Evaluating and Finding Security Vulnerabilities in Black-Box Code Language Modelscited by 60
  9. 2024Dataflow-Guided Retrieval Augmentation for Repository-Level Code Completioncited by 42
  10. 2023SALLM: Security Assessment of Generated Codecited by 40
  11. 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 37
  12. 2024On Leakage of Code Generation Evaluation Datasetscited by 37
  13. 2025Is Vibe Coding Safe? Benchmarking Vulnerability of Agent-Generated Code in Real-World Taskscited by 30
  14. 2024On the Impacts of Contexts on Repository-Level Code Generationcited by 25
  15. 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyondcited by 23
  16. 2025SafeGenBench: A Benchmark Framework for Security Vulnerability Detection in LLM-Generated Codecited by 21
  17. 2025Give LLMs a Security Course: Securing Retrieval-Augmented Code Generation via Knowledge Injectioncited by 19
  18. 2025SecRepoBench: Benchmarking Code Agents for Secure Code Completion in Real-World Repositoriescited by 19
  19. 2024SecCoder: Towards Generalizable and Robust Secure Code Generationcited by 18
  20. 2025SecureVibeBench: Benchmarking Secure Vibe Coding of AI Agents via Reconstructing Vulnerability-Introducing Scenarioscited by 18
  21. 2025A.S.E: A Repository-Level Benchmark for Evaluating Security in AI-Generated Codecited by 15
  22. 2026SEC-bench Pro: Can Language Models Solve Long-Horizon Software Security Tasks?cited by 15
  23. 2025Exploring the Security Threats of Knowledge Base Poisoning in Retrieval-Augmented Code Generationcited by 10
  24. 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 8
  25. 2024SeCodePLT: A Unified Platform for Evaluating the Security of Code GenAIcited by 6
  26. 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agentscited by 2

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2026ReCUBE: Evaluating Repository-Level Context Utilization in Code Generation
  2. 2026RealSec-bench: A Benchmark for Evaluating Secure Code Generation in Real-World Repositories
  3. 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
  4. 2024On The Importance of Reasoning for Context Retrieval in Repository-Level Code Editing
  5. 2026In Line with Context: Repository-Level Code Generation via Context Inlining
  6. 2026RepoZero: Can LLMs Generate a Code Repository from Scratch?
  7. 2025Benchmarking LLMs and LLM-based Agents in Practical Vulnerability Detection for Code Repositories
  8. 2025SEC-bench: Automated Benchmarking of LLM Agents on Real-World Software Security Tasks