Building Securely When AI Writes More of the Code

Building Securely When AI Writes More of the Code


As AI coding agents take on a growing share of software development, security teams face a new challenge: how do you build securely when a significant portion of the code is written by AI? In 2026, with AI-assisted development now mainstream, this question has moved from theoretical to operational.


Accelerating Secret Protection Engineering with Copilot


One practical answer comes from GitHub's own engineering teams. The Secret Protection engineering team collaborated with the GitHub Copilot coding agent to expand validity check coverage—the mechanisms that verify whether a detected secret (such as an API key or token) is actually live and exploitable, rather than a false positive.


By pairing human security engineers with an AI coding agent, the team was able to scale their coverage faster than manual development alone would allow. This reflects a broader 2026 trend: security engineering itself is increasingly augmented by AI, not just the application code it protects.


The Core Tension: Velocity vs. Security


AI-generated code introduces distinct security considerations:


  • Volume and speed — AI agents produce code at a pace that can outstrip traditional security review capacity.
  • Provenance and trust — understanding where AI-suggested code originates and whether it introduces vulnerable patterns.
  • Secret exposure — AI agents that handle credentials and configuration require robust secret protection and validity checking.
  • Supply chain risk — AI-suggested dependencies and patterns must be validated before adoption.

Emerging Practices for 2026


  1. Treat AI output as untrusted input. Every AI-generated change should pass through the same—or stricter—review and scanning pipelines as human contributions.
  2. Automate secret validity checks. Coverage of validity checking across secret types reduces noise and helps teams focus on genuine exposures.
  3. Use AI to defend AI-driven workflows. Coding agents can accelerate security engineering tasks, such as expanding detection coverage, when supervised by experienced engineers.
  4. Keep humans accountable. AI augments security teams but does not replace judgment on risk decisions and threat modeling.

  5. Conclusion


    Building securely in an AI-heavy development era is less about slowing down and more about redirecting AI capability toward security itself. The GitHub Secret Protection team's experience with Copilot demonstrates that AI coding agents, when combined with strong engineering oversight, can meaningfully accelerate defensive work—expanding coverage while keeping human experts in control.


    Originally based on insights from Parth Sehgal and Aaron Waggener on the GitHub Secret Protection engineering team.

    via GitHub AI Blog

Related