Skip to main content
Linda Bujitu
Menu
Back to blog

Blog

Working AI code is not secure code

AI & Engineering4 December 2026 · 8 min read
Close-up of professionals reviewing documents and points of attention together at a meeting table.
Stock photo of a document review, not a client or incident. Working software still needs a separate assessment of risk and evidence.

The coding agent says the change is finished. The application builds, the tests are green and the pull request looks reasonable. That is a useful result, but it does not answer whether the code is secure. A test can confirm that normal use works while unexpected input crosses exactly the wrong boundary.

GitHub published a practical explanation of that difference on 2 December. The trigger is current: AI writes more code faster, but an agent can also introduce a vulnerable pattern, expose a secret or suggest a dependency that does not exist. GitHub therefore recommends several checkpoints, from a local security review to pull-request scanning and analysis of existing code. This is vendor guidance, not independent evidence that one product solves the problem. [1]

My broader conclusion as an architect is this: when AI accelerates code production, the evidence around that code must accelerate as well. Otherwise, what grows fastest is the volume of work that has not been evaluated on its difficult paths.

Functional correctness and security are different outcomes

Imagine an agent builds a search endpoint. The agreed test sends a normal search term and receives the correct results. Functionally, the task passes. If the implementation inserts input directly into a SQL query, an attacker can use different input to change the query. The test was not wrong; it simply proved less than the team assumed.

An October preprint makes that distinction visible in a laboratory benchmark. The researchers created 450 tasks from 150 real vulnerability scenarios across seven programming languages. Six coding agents passed 73.6 to 91.3 per cent of the tasks functionally. The best combined score for code that was both functional and secure was 25.1 per cent. This is a preprint and a controlled benchmark, not a measurement of all production code. The figures are not a universal failure rate, but they do show why functional acceptance alone is weak security evidence. [2]

The repository is a source of risk too

Coding agents do not work in an empty environment. They read existing files, search for similar functions and copy patterns. That makes them useful in a real codebase, but the same context can normalise a vulnerable example. ‘Follow the existing style’ sounds efficient until that style includes old security mistakes.

Researchers at ETH Zurich tested this in a preprint submitted on 8 November. Across 96 backend tasks and 20 task pairs in real C and C++ projects, agents generated less secure code when comparable repository code was insecure. In the C and C++ setup, the average gap between secure and insecure context was 35.4 percentage points. An explicit security warning reduced the effect but did not stop it. This is experimental research, not a guarantee about every agent or language. [3]

That changes the design question. You do not only review what the agent added. You also need to know which examples, conventions and dependencies it could treat as authoritative. Otherwise, technical debt becomes training material inside your own repository.

Do not put security in one prompt

An instruction such as ‘write secure code’ is useful, but too vague as the only measure. Security must appear in the task, tests, pipeline and permissions. For an endpoint, that could mean defining who has access, which input is untrusted, how failures are handled, which data must never reach logs and which abuse cases must be tested explicitly.

I would connect checkpoints to the change and its impact. During implementation, a focused review can examine the active change. Reproducible checks should run on every pull request. A periodic scan of the default branch looks at existing code that no longer appears in a recent diff. A critical release or audit justifies deeper investigation. None of these layers provides complete assurance by itself. Together, they reduce different blind spots.

Product status and scope matter too. According to GitHub's 17 November announcement, secret scanning in Copilot security review is a public preview, must be enabled and checks changes rather than automatically searching the complete repository history. Those limitations belong in the architecture decision. Otherwise, a control can create false confidence because its coverage is smaller than the team assumes. [4]

A practical review model for AI-generated changes

For an ordinary change, I would want six pieces of evidence before code is merged. Not as bureaucracy, but as a short and repeatable working agreement.

  • Traceability: record which task, agent, model configuration and relevant context produced the change.
  • Scope: confirm that only the intended files, dependencies, permissions and configuration changed.
  • Abuse paths: test untrusted input, missing authorisation, error handling and boundaries around sensitive data.
  • Independent analysis: combine deterministic tooling with a focused security review; do not make the creator the only reviewer.
  • Human decision: have an authorised reviewer assess risk, necessity and recoverability, not only style and readability.
  • Production feedback: monitor abnormal behaviour after release and keep rollback possible without another agent action.

The weight of these checks can differ. An internal script without sensitive access is not the same as authentication code, a data export or infrastructure as code. The goal is not to slow every change. It is to decide quickly which evidence matches this risk.

The value of engineers shifts towards judgement

AI can accelerate boilerplate, tests and first implementations. That does not make human judgement less important; it redistributes it. The scarce skill is increasingly recognising what the task did not say: the implicit trust boundary, the abuse scenario, the overly broad permission or the old pattern that should never have been copied.

For architects, an AI development workflow becomes part of the software architecture. Who may start an agent? Which parts of the repository may it read and change? Which checks are mandatory? Who accepts residual risk? Which evidence remains for operations and audit? These are not questions for after the pilot. They determine whether speed remains manageable.

A green build proves that code can run. Secure delivery requires evidence of what happens when someone uses that code differently from how you intended.

Linda Bujitu

Partner Solution Architect · Microsoft

Keep reading

Want to know more about my work and the choices behind data and AI platforms?

Join the conversation

Share your experience or ask a question. Keep it respectful and relevant.

Your name and comment will be public on this article. Do not share private information. We do not ask for an email address. Links are not allowed.

Your comment stays with this article until you request removal or it is removed for spam or abuse. Stored with Vercel. For removal: contact me.

Working AI code is not secure code | Linda Bujitu