CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistants

Amit Finkman Noah, Avishag Shapira, Eden Bar Kochva, Inbar Maimon, Dudu Mimran +2 more
4/13/2024
cs.CRcs.CLcs.LG

No confident code implementation found for this paper.

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{noah2024codecloak,
  title  = {CodeCloak: A Method for Evaluating and Mitigating Code Leakage by LLM Code Assistants},
  author = {Amit Finkman Noah and Avishag Shapira and Eden Bar Kochva and Inbar Maimon and Dudu Mimran and Yuval Elovici and Asaf Shabtai},
  year   = {2024},
  eprint = {2404.09066},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.09066v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.09066.svg)](https://codeofpaper.com/paper/2404.09066)

Discussion