mlsanityData to 7 Oct 2026

Enhancing Security of AI-Based Code Synthesis with GitHub Copilot via Cheap and Efficient Prompt-Engineering

arXiv 2403.12671 ↗First posted 19 Mar 2024cs.CR cs.AIcited by 6

Not on the map. Why?

Abstract (arXiv)

AI assistants for coding are on the rise. However one of the reasons developers and companies avoid harnessing their full potential is the questionable security of the generated code. This paper first reviews the current state-of-the-art and identifies areas for improvement on this issue. Then, we propose a systematic approach based on prompt-altering methods to achieve better code security of (even proprietary black-box) AI-based code generators such as GitHub Copilot, while minimizing the complexity of the application from the user point-of-view, the computational resources, and operational costs. In sum, we propose and evaluate three prompt altering methods: (1) scenario-specific, (2) iterative, and (3) general clause, while we discuss their combination. Contrary to the audit of code security, the latter two of the proposed methods require no expert knowledge from the user. We assess the effectiveness of the proposed methods on the GitHub Copilot using the OpenVPN project in realistic scenarios, and we demonstrate that the proposed methods reduce the number of insecure generated code samples by up to 16% and increase the number of secure code by up to 8%. Since our approach does not require access to the internals of the AI models, it can be in general applied to any AI-based code synthesizer, not only GitHub Copilot.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). Builds on 11 of its 32 references that are in the map. First posted on arXiv 19 Mar 2024.

Builds on

11 of 32 references.

References · 11

  1. 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
  2. 2023CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Societycited by 1,348
  3. 2023A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPTcited by 612
  4. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  5. 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
  6. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  7. 2024Data-efficient Fine-tuning for LLM-based Recommendationcited by 103
  8. 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
  9. 2022Conversing with Copilot: Exploring Prompt Engineering for Solving CS1 Problems Using Natural Languagecited by 81
  10. 2023On the Robustness of Code Generation Techniques: An Empirical Study on GitHub Copilotcited by 64
  11. 2023Small Language Models Improve Giants by Rewriting Their Outputscited by 18

Built on by

Cited by year

Citing papers per year: 2024: 2; 2025: 4.

6 papers.