Graphite Reviewer is now Diamond

Privacy and security considerations when using AI coding tools

Greg Foster
Greg Foster
Graphite software engineer
Try Graphite

Table of contents

Using AI-powered coding and code review tools, such as GitHub Copilot, Amazon CodeWhisperer, and Graphite's Diamond, can significantly enhance developer productivity by automating routine tasks and providing real-time suggestions. However, these tools also introduce important privacy and security considerations. Below is a practical guide for safely adopting these technologies in your organization.

AI coding tools analyze your code by sending snippets or context to cloud-based models. For instance, GitHub Copilot sends code snippets temporarily to GitHub's AI servers for generating suggestions but doesn't store your code or use it for training by default. Similarly, Amazon CodeWhisperer provides enterprise-level privacy options that ensure your proprietary code isn't retained or used for model improvements.

Despite these assurances, transmitting data outside your organization's controlled environment carries risks, including potential interception, accidental leaks, or vendor-side breaches. To mitigate this, organizations should:

  • Choose enterprise-level subscriptions with strict privacy guarantees.
  • Confirm vendor policies explicitly forbid storing or using your proprietary code for training.
  • Avoid sharing sensitive information, such as credentials or confidential data, within AI prompts.
  • Ensure encryption is always utilized during data transmission.

AI-generated suggestions might inadvertently include open-source code snippets subject to restrictive licenses, posing legal and compliance risks. GitHub research indicates that around 1% of Copilot suggestions can directly match publicly available licensed code.

Best practices include:

  • Activating built-in filters in tools like GitHub Copilot to prevent direct copying of licensed public code.
  • Conducting thorough manual reviews to verify originality and compliance of AI-generated code.
  • Providing regular training to developers on IP awareness, ensuring they recognize and address potential license-related issues promptly.

Although reputable AI vendors implement robust security measures, the possibility of inadvertent code leakage remains. Malicious actors might exploit vulnerabilities or misuse AI tools to extract sensitive information through attacks such as prompt injection.

To reduce these risks:

  • Restrict AI tool access to only necessary repositories or codebases, minimizing exposure.
  • Regularly audit and monitor AI tool interactions to detect unusual or potentially malicious activities.
  • Maintain rigorous data handling agreements with vendors, explicitly detailing confidentiality obligations and breach responses.

AI coding tools, trained on extensive public repositories, can sometimes propose insecure coding patterns. Studies highlight that up to 40% of AI-generated code suggestions may introduce potential vulnerabilities such as SQL injections or improper data handling.

To enhance security:

  • Mandate rigorous human review processes for all AI-generated code, especially for critical components.
  • Employ integrated automated security analysis features offered by tools like Amazon CodeWhisperer, which scans for vulnerabilities during coding.
  • Educate developers to critically assess AI-generated suggestions, emphasizing caution against blind acceptance.

Selecting the right AI coding or review tool involves assessing vendors' security posture and data handling practices. Consider the following checklist when evaluating potential vendors:

  • Transparency: Opt for vendors with comprehensive documentation outlining their data privacy and security practices, such as GitHub's Trust Center or AWS's detailed FAQs.
  • Security certifications: Seek vendors demonstrating adherence to recognized standards like SOC 2 Type II or ISO 27001 certification.
  • Third-party audits: Prefer providers regularly conducting penetration tests and maintaining active bug bounty programs.
  • Data residency and isolation: Select tools offering regional data storage or processing options aligned with your organization's compliance needs.
  • Vendor reputation and references: Evaluate through existing customer testimonials and case studies, prioritizing vendors trusted by organizations within your industry.

To safely integrate AI coding tools within your organization, establish and implement the following best practices:

  • Clear use policies: Define precisely where and how AI coding assistance can be utilized, restricting use in highly sensitive or security-critical components.
  • Enterprise-grade subscriptions: Always prefer enterprise-grade options, as they generally provide stronger privacy protections and comprehensive administrative controls.
  • Secure configurations: Regularly update tool settings to minimize data collection and enable features that filter potentially unsafe suggestions.
  • Robust human oversight: Maintain strong human oversight on AI-generated code through thorough manual reviews combined with automated vulnerability scanning.
  • Developer training: Regularly educate your development teams about the specific risks associated with AI-generated code, emphasizing careful assessment of each suggestion.

Graphite's Diamond is an AI-driven code review tool that integrates directly with GitHub pull requests, offering automated code critiques. Diamond encrypts all data at rest and in transit, aligning with rigorous SOC 2 compliance standards. It employs Anthropic Claude AI, ensuring robust privacy protection by explicitly not using customer data for model training. Nevertheless, when leveraging tools like Diamond, organizations should carefully evaluate third-party integrations to confirm they align with internal compliance and security protocols.

AI coding and review tools deliver considerable productivity and quality improvements, yet they must be adopted with careful attention to privacy and security risks. By thoughtfully selecting and configuring tools, implementing stringent review and monitoring practices, and continually educating developers, organizations can safely leverage these advanced tools. Balancing innovation with disciplined risk management ensures both productivity gains and secure coding practices in the evolving landscape of AI technology.

Built for the world's fastest engineering teams, now available for everyone