Vibe codingSecurity checklist before you ship AI-written code

Security checklist before you ship AI-written code

Before you ship AI-written code to real users, run it through a short, specific checklist. The model that wrote it was optimising for code that runs, and it had no way of knowing your business, your users or the law where you operate. In a July 2025 study of more than 100 models, Veracode found security flaws in 45% of the coding tasks it tested. The six checks below cover the main areas to look at.

Six checks, in order
SecretsNo keys in code.
AuthRight people, right data.
DependenciesReal, current packages.
DataCollect less, protect it.
LicencesKnow what you can use.
TestsKey flows checked.

1. Secrets: keys, tokens and passwords

AI tools sometimes paste API keys straight into code because it is the quickest way to make something work. Search the codebase for anything that looks like a key, token or password, including in configuration files and old commits. Secrets belong in environment variables or the hosting platform’s secret store, never in the repository.

  • If you use GitHub, its secret scanning runs automatically and free of charge on public repositories, and push protection can block a push that contains a secret (GitHub Docs).
  • If a key has ever been committed or pasted into a chat, rotate it. Deleting the line does not remove it from history.
  • Give each key the narrowest permissions the provider allows.
Hands typing code on a laptop with programming text on the screen
Most of these checks take minutes, not days. Photo: Pexels

2. Authentication and access control

Broken access control is first on the OWASP Top 10:2025, a widely used list of web application security risks, and authentication failures are seventh. AI-written code often hides a button from users who should not press it, while the server behind that button still accepts the request from anyone.

  • Create two test accounts. Log in as one and try to view or edit the other’s records by changing IDs in the address bar.
  • Check that every action that changes data is checked on the server as well as in the interface.
  • If you use a hosted database that the browser talks to directly, confirm access rules are switched on for every table.

3. Dependencies

Software supply chain failures sit third on the OWASP 2025 list. AI adds its own twist: it sometimes recommends packages that do not exist. A USENIX Security 2025 paper measured average rates of at least 5.2% for commercial models and 21.7% for open-source models (Spracklen and others, 2025). Attackers can publish malware under those invented names.

  • For every package the AI added, check that it exists on the official registry, is actively maintained and is the one you meant.
  • Commit a lockfile so every install uses the same versions.
  • Turn on automated dependency alerts in your code host.
Close-up of a monitor showing security information and programming text
Read what the AI wrote, or have someone read it for you. Photo: Pexels

4. Personal data

The law applies to the data, whoever wrote the code. India’s Digital Personal Data Protection Act, 2023, the UAE’s Federal Decree-Law No. 45 of 2021 and the EU’s GDPR all set duties for businesses that collect personal data.

  • List every field that holds personal data and remove the ones you do not need.
  • Check that logs and error messages do not print email addresses, phone numbers or payment details.
  • Confirm backups exist, and that you know how to delete one person’s data if they ask.

5. Licences

Every open-source package comes with a licence, and some come with conditions, such as sharing your own source code. Run a licence report on your dependencies and read anything unusual. Your own repository needs thought too: according to GitHub’s documentation, without a licence the default copyright laws apply. Read the terms of the AI tool itself as well, including what it says about ownership of output and use of your code.

6. Tests and error handling

OWASP added mishandling of exceptional conditions to its 2025 list, at number ten. In practice, that means asking what happens when a payment fails, a form is submitted twice or an outside service is slow.

  • Write automated tests for the flows that matter most: sign-up, login, payment and anything that deletes data.
  • Run them on every change, before deploying.
  • Use a staging copy of the app with test data to try changes before customers see them.

Shipping AI-written code with confidence

None of these checks needs a large team. A founder can do the first pass in an afternoon, and a developer can confirm the findings in a day or two. What matters is doing them before launch rather than after an incident. If you want a second pair of eyes, our technology advice service covers code and security reviews, and for products that need rebuilding on firmer ground, see our SaaS and web app work.

This article is general information, not legal or professional advice.

Frequently asked questions

What is the most common security problem in AI-written code?

There is no single answer, but access control is a frequent weak spot in web apps generally and sits first on the OWASP Top 10:2025. In Veracode’s 2025 tests, models also struggled badly with cross-site scripting. Checking who can read and change each piece of data catches a large share of serious problems.

How do I check whether an AI suggested a fake package?

Look the package up on the official registry for your language, such as npm for JavaScript or PyPI for Python. Check that the name matches exactly, that it has a real maintainer and recent releases, and that its documentation describes what the AI claimed it does. If anything looks thin or new, ask a developer.

Who is responsible if AI-written code leaks customer data?

Generally the business that collects and controls the data, not the AI tool that wrote the code. Data protection laws such as India’s DPDP Act, the UAE’s personal data law and the GDPR place duties on the organisation. Contracts and circumstances vary, so take local legal advice for your specific case.

Tell us what you are trying to build.

A thirty-minute call, no charge. If we are not the right team for it, we will tell you and point you to someone who is.