Is AI-Generated Code Safe? 5 Safeguards to Check Before You Sign Off

Is AI-Generated Code Safe? 5 Safeguards to Check Before You Sign Off
Published

16 Sept 2026

Author
Roshan Manandhar

Roshan Manandhar

Is AI-Generated Code Safe? 5 Safeguards to Check Before You Sign Off
5:44
 
Table of Contents

Security and procurement reviews have caught up with AI-assisted delivery, and they now want evidence, not assurances. If your vendor can only offer assurances, the follow-up questions land with you. This article sets out five safeguards you can verify, the questions to put to any vendor in writing, and what a testable answer reads like. 

lightbulb-filament

Why we wrote this

We wrote this because the same exchange keeps coming up with project owners in regulated organisations. A vendor assessment asks how AI-written code is reviewed, and the delivery partner replies with a reassurance instead of a process. The project owner then has to go back and ask again, and explain the delay to their own security team.
 
We build with AI agents every day, so we answer this question ourselves, and we'd rather buyers knew exactly what to test. This is written for the person who completes the assessment and has to defend each answer. It should be just as useful if the vendor you're checking isn't us.
 

Question 14 on the security questionnaire

The vendor security questionnaire lands on a Monday. It runs to 60 questions, and the security team wants it back before Thursday's steering committee.

Most of it you can answer from the last project. Then you reach question 14: "Identify which components were generated by AI tools, and describe the review applied to them."'
You forward it to your delivery partner. The reply comes back within the hour: "We use AI responsibly, with human oversight throughout." You read it twice, and you can already hear the follow-up from security. 
 

The short answer: AI-written code is as safe as the process around it. That process is visible, so you can check it. Five safeguards tell you whether it exists: narrow agent permissions, a senior engineer who reviews and merges every change, enforced coding standards, a human gate before release, and a full audit trail. 

Why "we use AI responsibly" won't pass review

That reply fails for a simple reason. 

It describes an intention, not a control, and a reviewer can't test an intention.
 

A control has three parts a reviewer can check: an owner, a trigger that makes it run every time, and evidence that it ran. "Human oversight throughout" has none of them. There's no named person, no fixed point in the process where oversight must happen, and no record to inspect.

That test works on every vendor answer you'll read. If a reply names who, when and where the record lives, it's a control. If it doesn't, ask again. 
 
Here's the honest part. AI code isn't automatically worse than human code, because people write vulnerable code too. What changes is volume: AI makes some familiar mistakes faster, and in larger batches.
 

Responsibility doesn't move to the tool either. The Australian Signals Directorate's Secure by Design guidance asks technology manufacturers "to assume utmost responsibility for the security of their products and services". So the useful question isn't whether a vendor uses AI, but whether their process would catch a bad change, and whether they can prove it. 

Five safeguards to ask about

Each safeguard below is something you can ask for and verify. NIST's Secure Software Development Framework (SP 800-218) was written partly for this conversation: it says purchasers can use its common vocabulary "to foster communications with suppliers in acquisition processes". 

1. Narrow agent permissions

Each AI agent has one job and only the access that job needs.

  • What it looks like: a permissions list per agent. The agent that plans can't commit code, and the agent that builds can't push to the main branch.
  • What good looks like: no agent holds production credentials, and no single agent can plan, write and ship the same change. 

2. A senior engineer reviews and merges every pull request

A named, accountable person reads each change before it joins the codebase.

  • What it looks like: branch protection that blocks any merge without an approving review, from a reviewer senior enough to reject it.

  • What good looks like: changes kept small enough to read properly, and a reviewer who isn't also the person who prompted the change.

3. Coding standards and templated scaffolding

The written rules and starting templates every piece of code must follow, whoever or whatever wrote it. 

  • What it looks like: a written standard, templates for common patterns such as logging and error handling, and automated checks that fail the build when code breaks the rules.

  • What good looks like: agents start from approved patterns instead of inventing their own, so sensitive code paths look the same across the codebase.

4. A human gate before release

A deliberate stop where a person decides whether a change goes live.

  • What it looks like: a release step no tool can clear on its own, with a named approver and a recorded decision.

  • What good looks like: the gate sits after testing and before release, and the approver can see what changed and what was tested.

5. A full audit trail

A record linking every change to its request, its author, its review and its release.

The questions to put in writing

Safeguard
Question to ask
Good answer
Red flag
Narrow agent permissions
Which agents touch our code, and what can each one do?
A per-agent permissions list; no agent holds production credentials
"The AI has full repository access, but we watch it closely"
Senior review of every pull request
Who approves each merge, and can that be bypassed?
A senior engineer reviews and merges every pull request; branch protection is enforced
"Developers check their own AI output"
Standards and scaffolding
What standards does AI-written code have to meet, and how are they checked?
Written standards, templated scaffolding and automated checks that block the build
"The model follows best practice"
Human gate before release
Who decides a change goes to production?
A named person, every release, with the decision recorded
"Anything that passes tests deploys itself"
Full audit trail
Can you show the trail for one change from last month?
They produce it quickly: ticket, pull request, reviewer, release
"We can pull that together if needed"

Ask for one real example of each, from a current project with client details removed. A vendor with these controls can show them. A vendor without them will describe them.

Then make the answers part of the contract. Attach the vendor's written replies to the statement of work, so the safeguards become obligations rather than sales-stage descriptions. If the team or tooling changes mid-project, ask for updated answers in writing instead of assuming the old ones still hold. 

What the process looks like in practice

ADLC

Here's how we run this at EB Pearls. Our Agentic Development Life Cycle (ADLC) has three parts working together.

Agents plan, build, test and prepare deployment, each with one job and narrow permissions. The planner can't commit code. The builder can't push to main.
Senior engineers own architecture and review every pull request.
 
Governance keeps output consistent and traceable: coding standards, templated scaffolding, a strict status state machine and a full audit trail. 
The state machine is the part a security reviewer can see. Every ticket moves through a Jira "AI Dev" status trail: Plan, Discover, Design, Build, Verify, Human Gate, Release, Learn.
 
A good answer reads something like this. 
 
"Each change is drafted by a build agent with no access to the main branch, reviewed and merged by a named senior engineer, and released only after a recorded human approval. The full trail for any change is available on request."
 
We sum it up like this: "We replaced the relay. Not the runners." Agents took over the hand-offs between steps. The judgement stayed with people.
 
 

What drives effort and cost

Safe AI-assisted delivery isn't the cheapest way to produce code. The saving comes from fewer hand-offs, not from skipped review. Five things move the effort most: 

icons-learning-1

Regulatory scope

Work under financial services, health or privacy obligations needs more evidence per change, and that evidence takes time to produce.
icons8-user-groups-1-1-2

Review depth

A second reviewer, threat modelling and security-focused review on sensitive modules all add hours. Faster generation moves time into review; it doesn't remove it.
icons-card-payment

Test coverage

A codebase with thin tests needs tests written first, so AI-assisted changes can be checked against something.
tools

Tool and data restrictions

If your policy limits which AI services can see your source code, or where it's processed, the approved toolset narrows. 
icons8-web-accessibility-1

Your own approval steps

If your change board or security team signs off releases, their cadence sets the pace as much as the build does.
 
 

How we approach it

icons-salesforce

NEXUS Studio

Every build runs on the ADLC, whether it's a new product, an AI-powered application or a platform modernisation. The five safeguards are standard, and the audit trail gives your security team something concrete to review.

We'll also tell you where we'd recommend extra review, and when to commission an independent penetration test.

Every pull request is reviewed and merged by a senior EB Pearls engineer. Nothing reaches production without human approval.
 

Check your own problem

Before your next security review, answer these three questions about your delivery partner:
 
  1. Can they name the person who reviews and merges every pull request?
  2. Is there a release step that no tool can clear on its own?
  3. Could they show you the full trail for one change from last month?

 

If any answer is no, put the five questions in the table above to them in writing.

If you're weighing up how to run an AI-assisted build through your security review, book a call. We'll walk through the options with you, including the ones that don't involve us.
 
 

Frequently Asked Questions

Is AI-generated code less secure than code written by people?

Not inherently, since people write insecure code too. The difference is volume: AI produces more code, faster, so weak review lets more problems through. The review process matters more than who typed the code.

What does a good AI code review process look like?

A good AI code review process has a senior engineer, not the person who prompted the change, approve every pull request before it merges. Branch protection blocks any merge without that approval, and changes stay small enough to read properly. Automated checks run first, so the reviewer's time goes on logic and security rather than formatting.

What is AI coding governance?

AI coding governance is the set of rules and records that control how AI tools are used to write software. It covers which tools are allowed, what each can access, the standards their output must meet, who approves each change and how every decision is recorded. Good governance produces evidence a security reviewer can inspect, not just a policy document.

Who is accountable if AI-written code causes a problem?

The same people who would be accountable for any other code: the team that approved and released it. A tool can't hold accountability, so every change needs a named person who approved it. Check that your contract sets out the vendor's responsibilities, and that the audit trail shows who approved each change.

Who owns code that an AI tool helped write?

Ownership should be set by your contract, not by the tool. Ask for an IP clause that assigns the delivered code to you however it was drafted, and make sure the repository sits in an account you control. If you're unsure how a clause applies, have your legal team review it.

Will an AI tool share our source code with its provider?

It can, depending on the tool and how it's configured. Ask your vendor which AI services see your code, where that processing happens and whether the provider can retain it or train on it. If your policy restricts any of these, name the approved tools in the contract.

Should AI tools write authentication or payment code?

They can, provided those modules get deeper review: a second senior reviewer, a threat model before build and targeted security tests. Some organisations keep these areas human-written, which is a reasonable policy. Either way, plan an independent penetration test separately, because no build process replaces it.

How long does it take to put AI coding safeguards in place?

Most of the safeguards are settings and process rather than new tools, so the time depends on your starting point. A team with branch protection, written coding standards and reasonable test coverage is adding to a working base, while a codebase with thin tests needs those tests written first. Your own release approvals, such as a change board, also set the pace.

What affects the cost of safe AI-assisted development?

Review depth, regulatory scope, the state of your existing tests and any limits on which AI tools may see your code drive most of the cost. Sensitive modules need deeper review and more evidence per change, and thin test coverage has to be fixed before AI-assisted changes can be checked. The saving comes from fewer hand-offs, not from skipping review.
 
 
Topics:

Want a second opinion before you decide?

Book a free 30-minute Fit Call. Whether it’s an AI idea, a new build or a system that’s slowing down, we’ll tell you what’s worth doing, what we’d drop, and whether we’re the right fit at all. No commitment. No pitch deck.