AI-Assisted Engineering

GitHub Copilot and the Beginning of AI-Assisted Software Development

Last week GitHub launched a technical preview of Copilot, an 'AI pair programmer' that suggests whole functions inside the editor. It is the most capable coding assistant developers have seen, and it raises immediate questions about correctness, security and licensing. We look at what it does, how it works and how teams should approach it.

By EthicalHat Research · · 3 min read
Infographic: How Copilot turns context into code

On 29 June, GitHub announced Copilot, an "AI pair programmer" available as a technical preview for Visual Studio Code. Write a comment describing what you want, or the signature of a function, and Copilot suggests the implementation, sometimes a single line, often an entire function.

For many developers who have tried it this week, the reaction has been a mix of amazement and unease. It is by far the most capable coding assistant most of us have seen.

What Copilot does

Copilot runs inside the editor and continuously suggests code based on context:

  • Comments to code: describe the behaviour in a comment and get an implementation.
  • Function completion: from a name and signature, suggest the body.
  • Pattern continuation: after a few similar lines (test cases, mappings, configuration), suggest the next ones.
  • Alternatives: cycle through several different suggestions for the same spot.
python
import datetime

def parse_expiry(date_str):
    """Parse an expiry date in either 'YYYY-MM-DD' or 'MM/YY' format and return a date.
    For MM/YY, return the last day of that month."""
    # Copilot suggests an implementation like this:
    try:
        return datetime.datetime.strptime(date_str, "%Y-%m-%d").date()
    except ValueError:
        month, year = date_str.split("/")
        year = 2000 + int(year)
        next_month = datetime.date(year + int(month) // 12, int(month) % 12 + 1, 1)
        return next_month - datetime.timedelta(days=1)

It works across many languages, and is particularly strong in Python, JavaScript, TypeScript, Ruby and Go.

How it works

Copilot is powered by OpenAI Codex, a descendant of GPT-3 that has been further trained on a large amount of public source code. The extension sends context from the file you are editing to the model, which predicts likely continuations.

This is the same basic mechanism as language models generating text, applied to code. It explains both the strengths (Copilot has "seen" countless examples of common patterns) and the weaknesses (it predicts likely code, not correct code).

What developers are finding

Where it shines:

  • boilerplate and repetitive code,
  • unfamiliar APIs and libraries, where it recalls usage patterns you would otherwise look up,
  • test cases that follow an established pattern, and
  • small utility functions and data transformations.

Where it stumbles:

  • subtle logic errors that look right at first glance,
  • outdated or deprecated API usage,
  • code that does not fit your project's conventions or architecture, and
  • confident suggestions for things it does not know, such as internal APIs.

The questions it raises

Correctness and review

Copilot's suggestions need the same review as code from a colleague you have never worked with. The risk is that fluent, well-formatted code gets less scrutiny than it deserves.

Security

Because Codex learned from public code, it has also learned insecure patterns: string-concatenated SQL, weak hashing, missing input validation and hard-coded secrets. Security teams should assume some suggestions will be vulnerable, and make sure automated scanning and review are in place.

Licensing and attribution

Copilot was trained on public repositories under many licences, including copyleft licences such as the GPL. GitHub's preview documentation says that in its research, suggestions matched training code verbatim only rarely (around 0.1% of the time), and that it plans to add tooling to detect such matches. Whether training on public code and emitting suggestions raises licensing obligations is a question lawyers and open-source foundations are already debating.

Privacy

The extension sends code context to GitHub's service. Organisations with proprietary or regulated code need to understand what is sent, how long it is retained and how it may be used.

How teams should approach it

  1. Experiment, deliberately. Let interested developers try it on non-sensitive code, and share what works.
  2. Keep ownership clear. The developer who accepts a suggestion is responsible for it.
  3. Strengthen automated checks: tests, linters, SAST and dependency scanning.
  4. Get legal and security input before using it on proprietary code or in commercial products.
  5. Watch how it evolves. This is a technical preview. Capabilities, pricing and terms will change.

Why it matters

Copilot is the first AI coding tool that feels like it might change how software is written day to day, not just speed up typing. Even in its preview form, it hints at a future where describing intent becomes as important as writing syntax, and where reviewing generated code becomes a core developer skill.

Our secure SDLC team is evaluating AI pair programming tools, and our secure code review practice is adapting to catch the kinds of issues they introduce.

EthicalHat Research

The EthicalHat research team: penetration testers, SOC analysts and engineers writing about security, software engineering and AI.

Want an expert opinion on your own systems?

Email info@ethicalhat.com or call +1-844-838-4422. Our security engineers are happy to talk it through.