AI coding assistants are great for boilerplate, but they also autocomplete insecure patterns from their training data. For students learning to code, the danger is accepting a suggestion that looks right but introduces a real vulnerability.
What the studies found
| Study | Setup | Finding |
|---|---|---|
| Pearce et al. (2022) | 89 security-sensitive scenarios across C, C++, Java, Python | ~40% of Copilot suggestions contained a security vulnerability |
| Asare et al. (2023) | Compared Copilot to human developers on the same vulnerability scenarios | Copilot replicated the original vulnerable code ~33% of the time and the fixed version ~25% of the time |
| Sandoval et al. (2023) | User study with a realistic coding task | Participants with LLM access introduced similar or slightly more vulnerabilities than the control group in that setup |
The takeaway is consistent: Copilot is not inherently secure or insecure. It reflects patterns from training data, including insecure ones. The main risk is uncritical acceptance, which is highest for beginners who cannot yet spot the flaw.
Why students are especially at risk
- You cannot review what you do not yet understand. A SQL injection or path traversal bug looks like normal code.
- The assistant is confident even when wrong. There is no warning label on an insecure suggestion.
- Copy-pasting AI output into a graded project or a portfolio app can ship a real vulnerability to production later.
Safer habits
- Treat every suggestion as untrusted until you can explain why it is safe.
- Run linters and SAST tools (Bandit, Semgrep, CodeQL) locally and in CI.
- Use parameterised queries, input validation, and modern crypto libraries by default.
- Ask the assistant to explain the security of its own suggestion, then verify the explanation yourself.
VERDICT
AI code assistants speed up work but are not security-aware. Students and beginners must review suggestions and rely on automated checks before shipping code.
Sources
- Pearce et al., “Asleep at the keyboard? Assessing the security of GitHub Copilot’s code contributions”, IEEE S&P 2022
- Asare et al., “Is GitHub’s Copilot as bad as humans at introducing vulnerabilities in code?”, Empirical Software Engineering 2023
- Sandoval et al., “Lost at C: A user study on the security implications of large language model code assistants”, USENIX Security 2023