Secure AI · Platform rescue

AI-written code: the guardrails we put on it.

By , Founder and PrincipalPublished Last updated 2 min read

AI coding tools make engineers faster, and they can produce insecure, unmaintainable code just as fast. The fix is not to ban them but to put guardrails around them: protect your code and secrets, have a person review every change, run security testing automatically, and keep a clear record of what AI produced. These are the guardrails we use, and the ones we put in place when we rescue AI-built platforms.

What goes wrong

We are regularly asked to look at products that were built quickly with AI tools and now cannot scale or pass a security review (see our AI-first startup case study). The patterns repeat:

  • secrets and API keys committed to the code
  • missing access checks, so one user can see another’s data
  • no tests, so every fix breaks something else
  • dependencies added without checking who maintains them
  • a codebase no one on the team fully understands

Our guardrails

1. Protect the code and the secrets.

Use AI coding tools that do not retain or train on your code, configured at an organisation level rather than on personal accounts. Secrets stay in a secrets manager, never in prompts or code.

2. Every change is reviewed by a person.

AI-written code goes through the same pull request review as any other code, by an engineer who understands it well enough to own it.

3. Security testing runs on every change.

Automated static analysis, dependency and secret scanning in the CI pipeline, so common flaws are caught before they reach production.

4. Tests before trust.

AI-generated features ship with tests. If no one can describe how a change was tested, it does not merge.

5. Limit what coding agents can do.

Coding agents get access to the repository and a test environment, not production, and not real customer data. ACSC guidance on agentic AI recommends least privilege, human approval for high-impact actions and the ability to roll back, and the same applies to the agents that write your software.

6. Check the supply chain.

New libraries and AI-suggested packages are checked before they are added. AI tools can suggest packages that are outdated, abandoned or do not exist.

7. Standards written down.

Coding standards, architecture decisions and a definition of done that apply whether code is typed or generated.

If you are building an AI product

Your product also needs its own AI security. The OWASP Top 10 for LLM Applications lists the main risks:

  • prompt injection
  • sensitive information disclosure
  • supply chain weaknesses
  • data and model poisoning
  • improper output handling
  • excessive agency
  • system prompt leakage
  • vector and embedding weaknesses
  • misinformation
  • unbounded consumption

(OWASP) We test against these before launch.

For investors and boards

If a company you are investing in or acquiring is built largely with AI tools, ask how its code is reviewed, tested and secured. Our technical due diligence assesses the use and risks of AI-generated code as standard.

Sources

FAQ

Should we ban AI coding tools?
No. Banning them usually pushes their use onto personal accounts, where you have no control. Approve the right tools and put guardrails around them.
Can you fix a product that was built mostly with AI?
Yes. Platform rescue starts with an assessment and a risk-ranked plan, then re-architecture and handover with standards in place.

Start with a Secure AI readiness review.

Book a consultationSee the readiness review

Cookie preferences

Choose what you're comfortable with. You can change your mind at any time from "Cookie settings" in the footer.

Strictly necessary

Remembers your cookie choice and protects our forms from bots (Cloudflare Turnstile). The site can't work securely without these.

Always active

Analytics

Mixpanel (EU) counts page views, clicks and scrolls. Salesflare records page visits so we can see which pages someone viewed after they contact us or click a tracked email link. No names, emails or form contents are sent to Mixpanel.

Session replay

Mixpanel (EU) records how pages are used, with all text and form entries masked and images hidden. Requires Analytics.