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

StudySetupFinding
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 scenariosCopilot 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 taskParticipants 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

Safer habits

Suggestion flow with guardrails Copilot suggests code Security review (human + tools) Only merge if safe Never auto-accept across trust boundaries treat suggestions as untrusted input

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