The security of code produced by an LLM coding assistant depends in part on which repository context the model receives before generating code. An arXiv paper examines this previously underexplored influence and finds that context helpful for functionality does not automatically improve security.
The researchers introduce CASE-Bench, a benchmark of 145 tasks drawn from real vulnerabilities in 51 projects. Tasks run in Docker environments and include functional tests and validated proof-of-concept exploits. The benchmark also identifies repository code that enforces or undermines security. The study compares 13 context-construction methods and six controls across six LLMs.
Functionality-oriented context raised the functional pass rate by up to 8.2 percentage points, but the secure pass rate by no more than 3.7 points. Removing a safeguard from the context lowered the secure pass rate by up to 8.1 points. Adding an insecure code example raised the share of correct but exploitable results by 6.3 points. In the coding-agent trajectories examined, agents observed the relevant safeguard in only 27 to 36 percent of cases.
The findings suggest that context construction and security evaluation should be considered together; they do not establish that the same effects occur across all models or projects. The original paper details the benchmark, comparison methods, and agent trajectories: arXiv: A.S.E 2.0