CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistants
Not on the map. Why?
Abstract (arXiv)
LLM-based code assistants are becoming increasingly popular among developers. These tools help developers improve their coding efficiency and reduce errors by providing real-time suggestions based on the developer's codebase. While beneficial, the use of these tools can inadvertently expose the developer's proprietary code to the code assistant service provider during the development process. In this work, we propose a method to mitigate the risk of code leakage when using LLM-based code assistants. CodeCloak is a novel deep reinforcement learning agent that manipulates the prompts before sending them to the code assistant service. CodeCloak aims to achieve the following two contradictory goals: (i) minimizing code leakage, while (ii) preserving relevant and useful suggestions for the developer. Our evaluation, employing StarCoder and Code Llama, LLM-based code assistants models, demonstrates CodeCloak's effectiveness on a diverse set of code repositories of varying sizes, as well as its transferability across different models. We also designed a method for reconstructing the developer's original codebase from code segments sent to the code assistant service (i.e., prompts) during the development process, to thoroughly analyze code leakage risks and evaluate the effectiveness of CodeCloak under practical development scenarios.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 24 of its 35 references that are in the map. First posted on arXiv 13 Apr 2024.
Builds on
24 of 35 references.
References · 24
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2022Prompt-to-Prompt Image Editing with Cross Attention Controlcited by 2,409
- 2020Extracting Training Data from Large Language Modelscited by 2,144
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2023A Survey on Evaluation of Large Language Modelscited by 1,227
- 2023StarCoder: may the source be with you!cited by 790
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2023Analyzing Leakage of Personally Identifiable Information in Language Modelscited by 278
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
12 more
- 2023Can Sensitive Information Be Deleted From LLMs? Objectives for Defending Against Extraction Attackscited by 156
- 2022Lost at C: A User Study on the Security Implications of Large Language Model Code Assistantscited by 87
- 2023How Secure is Code Generated by ChatGPT?cited by 77
- 2022TEMPERA: Test-Time Prompting via Reinforcement Learningcited by 50
- 2023Exploring the Potential of ChatGPT in Automated Code Refinement: An Empirical Studycited by 44
- 2023RePrompt: Automatic Prompt Editing to Refine AI-Generative Art Towards Precise Expressionscited by 43
- 2024PRewrite: Prompt Rewriting with Reinforcement Learningcited by 43
- 2021CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoningcited by 39
- 2022Automatic Code Documentation Generation Using GPT-3cited by 37
- 2023Automatic Code Summarization via ChatGPT: How Far Are We?cited by 34
- 2023Analysis of ChatGPT on Source Codecited by 12
- 2023Using ChatGPT as a Static Application Security Testing Toolcited by 8
Built on by
Citing papers per year: 2024: 1; 2025: 2.
3 papers.
- 2024Web2Code: A Large-scale Webpage-to-Code Dataset and Evaluation Framework for Multimodal LLMscited by 73
- 2025VeriLeaky: Navigating IP Protection vs Utility in Fine-Tuning for LLM-Driven Verilog Codingcited by 10
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 0
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Prompts19 Nov 2025
- 2025VeriLeaky: Navigating IP Protection vs Utility in Fine-Tuning for LLM-Driven Verilog Coding17 Mar 2025
- 2024Web2Code: A Large-scale Webpage-to-Code Dataset and Evaluation Framework for Multimodal LLMs28 Jun 2024