Enhancing Security of AI-Based Code Synthesis with GitHub Copilot via Cheap and Efficient Prompt-Engineering
Jakub Res, Ivan Homoliak, Martin Pere\v{s}\'ini, Ale\v{s} Smr\v{c}ka,, Kamil Malinka, Petr Hanacek

TL;DR
This paper introduces prompt-altering techniques to improve the security of AI-generated code, specifically targeting GitHub Copilot, by reducing insecure outputs without needing model internals or expert knowledge.
Contribution
It proposes three novel prompt-altering methods—scenario-specific, iterative, and general clause—to enhance code security in AI-based code synthesis tools.
Findings
Reduced insecure code samples by up to 16%
Increased secure code generation by up to 8%
Applicable to any AI-based code synthesizer without model internals
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsEmbedded Systems Design Techniques · Parallel Computing and Optimization Techniques · VLSI and Analog Circuit Testing
