PreprintCited by 75Software Engineering ResearchWeb Application Security VulnerabilitiesSoftware Testing and Debugging Techniques

The DOI matches its DataCite record, with a small difference in title or year; the references it cites are not checked yet.

Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Study

Open access

Abstract

Modern code generation tools utilizing AI models like Large Language Models (LLMs) have gained increased popularity due to their ability to produce functional code. However, their usage presents security challenges, often resulting in insecure code merging into the code base. Thus, evaluating the quality of generated code, especially its security, is crucial. While prior research explored various aspects of code generation, the focus on security has been limited, mostly examining code produced in controlled environments rather than open source development scenarios. To address this gap, we conducted an empirical study, analyzing code snippets generated by GitHub Copilot and two other AI code generation tools (i.e., CodeWhisperer and Codeium) from GitHub projects. Our analysis identified 733 snippets, revealing a high likelihood of security weaknesses, with 29.5% of Python and 24.2% of JavaScript snippets affected. These issues span 43 Common Weakness Enumeration (CWE) categories, including significant ones like CWE-330: Use of Insufficiently Random Values, CWE-94: Improper Control of Generation of Code, and CWE-79: Cross-site Scripting. Notably, eight of those CWEs are among the 2023 CWE Top-25, highlighting their severity. We further examined using Copilot Chat to fix security issues in Copilot-generated code by providing Copilot Chat with warning messages from the static analysis tools, and up to 55.5% of the security issues can be fixed. We finally provide the suggestions for mitigating security issues in generated code.

Overview

Integrity signals

Registry

DataCite · 10.48550/arxiv.2310.02059

Cites

Statistics

Recomputing p-values needs the paper’s full text.

Verification

Claims the paper makes

We couldn’t retrieve this paper’s full text, so its claims and self-check weren’t run. The registry and citation checks still apply.

Claims other papers make about this one

Each is checked against this paper’s own text: does it say what the citing paper says it does?

Citations

The citation lists haven’t been fetched yet

References 53 · Cited by 75

Metadata

Authors
Fu, Y., Liang, P., Tahir, A., Li, Z., Shahin, M., Yu, J., & Chen, J.
Affiliations
  • Wuhan University (CN)
  • Massey University (NZ)
  • Central China Normal University (CN)
  • RMIT University (AU)
Venue
arXiv
Publisher
arXiv
Published
2023
Volume
34
Issue
8
Pages
1-34
ISSN
1049-331X (ISSN-L)
OpenAlex
W4407392582
Cited by
75
References
53
Citations by year
2026: 47 · 2025: 20 · 2024: 8
FWCI
70.24
Type
journal article
Language
en
Open access
Locations
  • ACM Transactions on Software Engineering and Methodology (publishedVersion)
  • arXiv (Cornell University) (submittedVersion, cc-by)
  • arXiv (Cornell University) (cc-by)
Funders
  • National Natural Science Foundation of China (62172311)
  • Science and Technology Program of Hubei Province (2024BAA008)
Topics
  • Physical Sciences › Computer Science › Information Systems › Software Engineering Research
  • Physical Sciences › Computer Science › Information Systems › Web Application Security Vulnerabilities
  • Physical Sciences › Computer Science › Software › Software Testing and Debugging Techniques
Keywords
AI-generated code, GitHub Copilot, code generation security, security vulnerabilities, Common Weakness Enumeration, cross-site scripting, large language models, static analysis warnings, open source projects, Python, JavaScript

About these checks

Registry, retraction, Cites and statistics results are computed, not judged, with one exception: a printed reference that no index lists is read once by a model before it counts as a citation error. Claims are extracted by a model and kept only when their quote appears verbatim in the text; each cited source is then checked, with a model’s help, for whether it says what the claim relies on. Those verdicts can be wrong — read the claim’s quote and the cited source before relying on one.

Statistics and arithmetic are recomputed, not judged.

Confidence bands are shown only for fields calibrated on our annotated test set. None is calibrated yet, so no band is shown.

What counts as a claim ›How we measure confidence ›How we check this ›

Are you an author, or do you see a problem with this page? Request a review