AI startup due diligence: how investors check what is real / The engineering read
Security of AI-written code: what to check in diligence
Security of AI-written code in diligence comes down to two checks: scan the code rather than read it, because Veracode's July 2025 test of over 100 models found 45 percent of generated samples failed security tests, and check the risks that only exist because a model is in the product, which the OWASP Top 10 for LLM Applications lists, starting with prompt injection. The general security review still runs. This page covers what the AI adds: the scan to run on the current commit, the ten model-specific risks to ask about, and what a good answer looks like from a team that has done this work already.
Published September 17, 2026. Editorial.
Key takeaways
- Scan, do not read: Veracode's July 2025 report found 45 percent of AI-generated code samples introduced an OWASP Top 10 vulnerability, Java at 72 percent, with no improvement from newer or larger models.
- The model in the product adds risks a conventional scan never sees; the OWASP Top 10 for LLM Applications 2025 lists them, and prompt injection has held the first place for two editions.
- Ask how customer data flows to the model provider and under which terms; Anthropic's commercial terms state the provider may not train on customer content, and the target should know the equivalent for every provider it calls.
- A good answer is a scan from the last quarter with findings triaged and fixes merged, plus a written account of each of the ten model-specific risks; a weak answer is 'we will run one'.
Security of AI-written code in diligence is two checks. The first is a scan of the code on the current commit, because the measured failure rate of generated code is high enough that reading it is the wrong tool. The second is a review of the risks that exist only because a model is in the product, which no code scanner finds and which the OWASP list for LLM applications sets out.
Both sit on top of the general review in assessing security and compliance, which still runs in full. This page is about what the AI adds, and it keeps the argument short because the AI-generated code guide already makes it at length.
Why scan rather than read?
Scan rather than read because the failure rate of generated code is measured and high, and because generated code is consistent by default, which makes it read as competent whether or not it is secure. Reveneau's diligence protocol runs a static and dependency scan on every AI-written codebase before anyone opens a file, and reads only what the scan and the eval suite point to.
The figure that justifies this comes from Veracode's 2025 GenAI Code Security Report, published 30 July 2025, which tested over 100 large language models on coding tasks in Java, Python, C# and JavaScript and found that 45 percent of the generated samples failed security tests and introduced an OWASP Top 10 vulnerability. By language, Java failed 72 percent of the time, C# 45, JavaScript 43 and Python 38. For cross-site scripting specifically, the models failed to defend in 86 percent of relevant samples. Veracode also reported that security performance stayed flat regardless of model size or training sophistication [1]. Is AI-generated code secure goes through those numbers and what they mean for an engineering team; for a diligence reviewer the reading is simpler. Until scanned, assume the codebase carries that rate.
The second reason is the shape of the errors. Stack Overflow's 2025 survey found 66 percent of developers name output that is "almost right" as their main frustration with AI tools [2]. An almost-right input validator, an almost-right authentication check, an almost-right query builder: each passes the happy path and the eval suite, and each is what the scanner exists to find.
What are the model-specific risks?
The model-specific risks are the ones that exist because untrusted text reaches a model that can act on it, and the OWASP Top 10 for LLM Applications 2025 is the reference list [3]. A conventional scan sees none of them. The table gives each entry and the diligence question for it.
| OWASP LLM 2025 entry | Diligence question |
|---|---|
| LLM01 Prompt Injection | What untrusted text reaches the model, and what can the model do as a result? Ask for the injection test cases in the eval suite. |
| LLM02 Sensitive Information Disclosure | What customer data is in the context window, and can one customer's data reach another's session? |
| LLM03 Supply Chain | Which models, versions, libraries and third-party prompts are in the product, and how are they pinned? |
| LLM04 Data and Model Poisoning | If the product fine-tunes or retrieves from customer data, who can write to that data? |
| LLM05 Improper Output Handling | Is model output rendered, executed or written to a database without validation? |
| LLM06 Excessive Agency | What tools can the model call, with what permissions, and what needs a human approval? |
| LLM07 System Prompt Leakage | Does the system prompt contain anything that matters if it leaks, such as a credential or a rule a user could exploit? |
| LLM08 Vector and Embedding Weaknesses | If retrieval is used, how is access controlled at the document level? |
| LLM09 Misinformation | Where does the product state a model output as fact, and what checks it? |
| LLM10 Unbounded Consumption | What stops one user, or one bug, from running an unbounded number of model calls on the company's bill? |
Prompt injection holds the first position for the second consecutive edition of the list, and it is the one to ask about first, because a product that reads documents, emails or web pages and then takes actions is exposed to it by design. The test from how to verify an AI claim can include an injection case: an input that contains an instruction, to see whether the product follows it.
LLM10 is also a margin question. A product with no cap on model calls per user has a cost of goods that a single script can change, and that belongs in rebuilding inference gross margin from invoices as well as here.
How does customer data reach the model provider?
Customer data reaches the model provider in every request that includes it in the context, and the diligence question is which provider, under which terms, with what retention. Anthropic's commercial terms state that the customer retains all rights to its inputs and owns its outputs, and that "Anthropic may not train models on Customer Content from Services" [4]. The equivalent terms for every other provider the product calls, and the account type in force, are what the target should be able to show. A product that sends customer data to a consumer-grade endpoint has a different answer from one on a commercial plan, and the difference is a disclosure to the customers whose data went through.
Retention is the third part of the answer. Some commercial plans retain inputs for a fixed period for abuse monitoring, some offer zero-retention arrangements, and consumer products keep conversations on their own terms. The target should know which applies to each provider and be able to show the setting rather than describe it.
Ask the same question of the tools used to write the code, since the codebase itself may have contained customer data or credentials when it was sent as context. Code provenance and licence exposure covers that side.
How do you run the security check in diligence?
Run the security check in diligence in five steps, and do the first one before the management meeting.
- Ask for the last scan. A static analysis report and a dependency report from the last quarter, with each finding triaged and the fixes merged. If none exists, ask for permission to run one; if permission is refused, that is the finding.
- Run a scan on the current commit. Your own tools, on a clean checkout. Compare with the report you were given. A large gap between the two means the company's scan is stale or filtered.
- Walk the ten OWASP LLM entries with the team. One question each from the table above. Write the answer and the evidence. "We have injection cases in the eval suite" is an answer; "the model is safe" is not.
- Test one injection case live. In the claim-test session, supply an input that contains an instruction the product should not follow. Watch what happens.
- Trace the data flow. From the customer's input to each provider and back, with the terms and retention for each hop.
What does a good answer look like?
A good answer is a scan from the last quarter, with findings triaged and the fixes merged; a written account of each of the ten model-specific risks with the control for each; injection cases in the eval suite; a data-flow diagram naming every provider and the terms in force; and a cap on model calls per user in the code, with the number. A team with all five sends them in a day.
A weak answer is any of: "we will run a scan", "the model handles that", a system prompt as the only defence against injection, a provider named without the account type, or no answer to the question of what one user can cost the company in a day.
What goes in the report?
The report separates the two checks, because they have different fixes. Scanner findings are ordinary engineering debt: a count by severity, an estimate of the work to clear the high and critical items, and a note on whether the eval suite would catch a regression. Model-specific findings are design questions: an injection exposure in a product that takes actions is a change to the architecture, and a missing cap on consumption is a line in the margin model. Security review before launch is the engineer's version of the same list. Diligence on an AI-written codebase covers the other artefacts the scan sits beside, and the AI startup due diligence guide puts the security read in its place in the whole review.
Best for
- Any target with a model in the product that reads untrusted text or takes actions
- A reviewer who has the repository and a day
- A deal team pricing the engineering debt in a generated codebase
Avoid if
- The general security review has not been scoped yet; this page adds to it and does not replace it
- You have no repository access; walk the ten OWASP entries with the team and test one injection case live instead
Verify before you commit
- Run a static and dependency scan on the current commit and compare with the company's own report
- Walk the ten OWASP LLM entries and record the control and the evidence for each
- Test one prompt injection case live in the claim-test session
Common questions
Is AI-generated code less secure than human-written code?
AI-generated code has a measured security failure rate high enough to scan by default. Veracode's July 2025 report tested over 100 large language models on coding tasks in four languages and found 45 percent of generated samples failed security tests and introduced an OWASP Top 10 vulnerability, with Java at 72 percent and cross-site scripting defences failing in 86 percent of relevant samples. Veracode also found no improvement with larger or newer models. Treat the codebase as carrying that rate until scanned.
Why should I scan AI-written code instead of reading it?
Scan AI-written code instead of reading it because generated code is consistent by default and reads as competent whether or not it is secure, and because the failure rate is high enough that a reader will miss more than a scanner. Stack Overflow's 2025 survey found 66 percent of developers name almost-right output as their main frustration with AI tools; an almost-right validator passes the happy path and the eval suite. Run a static and dependency scan on the current commit and read what it flags.
What is prompt injection and why does it matter in diligence?
Prompt injection is an input crafted so that the model treats it as an instruction rather than as content, and it matters in diligence because a product that reads documents, emails or web pages and then acts is exposed to it by design. It is entry LLM01 in the OWASP Top 10 for LLM Applications 2025 and has held first place for two editions. Ask what untrusted text reaches the model, what the model can do as a result, and whether the eval suite contains injection cases; then test one live.
What are the model-specific security risks a code scanner cannot find?
The model-specific security risks a code scanner cannot find are the ten in the OWASP Top 10 for LLM Applications 2025: prompt injection, sensitive information disclosure, supply chain, data and model poisoning, improper output handling, excessive agency, system prompt leakage, vector and embedding weaknesses, misinformation and unbounded consumption. Each is a design question rather than a code defect, so the check is a conversation with the team, one question per entry, with the control and its evidence written down.
Does customer data go to the model provider, and is that a problem?
Customer data goes to the model provider in every request that includes it in the context, and whether that is a problem depends on the provider's terms, the account type and the retention. Anthropic's commercial terms state the customer owns its outputs and that Anthropic may not train models on customer content from the services; consumer terms differ. The target should show a data-flow diagram naming every provider and the terms in force, and a period on consumer-grade endpoints is a disclosure.
What does a good security answer from an AI startup look like?
A good security answer from an AI startup is a scan from the last quarter with findings triaged and fixes merged, a written control for each of the ten OWASP LLM entries, injection cases in the eval suite, a data-flow diagram naming each provider and its terms, and a cap on model calls per user with the number. A weak answer is any of 'we will run a scan', 'the model handles that', or a system prompt as the only injection defence. Veracode's 45 percent failure rate is why the scan comes first.
Can an eval suite catch security problems in AI-written code?
An eval suite catches security problems only where cases were written for them, such as injection inputs or output-handling checks, and a code scanner catches the rest. Veracode's July 2025 report found 45 percent of generated samples failed security tests regardless of whether the code ran correctly, and a suite derived from the functional specification does not test for that. Ask for both: injection cases in the suite, and a static and dependency scan on the current commit, read as two findings.
What is unbounded consumption and why is it a margin problem?
Unbounded consumption, entry LLM10 in the OWASP Top 10 for LLM Applications 2025, is the absence of a limit on how many model calls one user, one session or one bug can make. It is a security problem because it enables denial of service and denial of wallet, and a margin problem because inference is billed by the provider per token, so one script can change the month's cost of goods. Ask for the cap in the code, with the number, and check the invoices for a month where it was tested.
Should the diligence team run its own security scan or trust the startup's?
Run your own scan on a clean checkout of the current commit and compare it with the startup's report. A small gap means the company's process is current. A large gap means its scan is stale or filtered, which is a finding about process as much as about code. Veracode's July 2025 report found security performance flat across model sizes, so a newer generator is no reason to skip the scan; the rate applies to the code that exists now, and only a scan of that code answers the question.
How much does it cost to fix the security debt in a generated codebase?
The cost of fixing security debt in a generated codebase is the count of high and critical scanner findings multiplied by the work to clear each, plus any architecture change the model-specific review demands, and it belongs in the model as a post-close line. Scanner findings are ordinary engineering; an injection exposure in a product that takes actions is a design change and costs more. Veracode's 45 percent sample failure rate sets the expectation for a codebase that has never been scanned.
Related reading
A practical pre-launch security review for a small team
You do not need perfect security to launch. You need to check the handful of basics that catch most real problems, and to know when the risk is big enough to bring in a specialist.
How many tests does AI-generated code need?
The honest answer is not a number, and coverage percentages are the wrong unit. Here is the unit we use instead, and why a suite of fifteen checks can be worth more than two thousand.
More in The engineering read
Diligence on an AI-written codebase: what to ask for and what a good answer looks like
Diligence on an AI-written codebase asks for six things: the specification the code was generated from, the eval suite and its last failing run, the provenance record of which tool wrote which files, a current security scan, the list of models and versions the product calls, and a walkthrough by the person who directs the agents. It asks for these because the signals a reviewer used to rely on, commit history, style, comment density and test count, are produced by the model at no cost and tell you nothing about who understands the code. This page lists what to ask for and what a good answer looks like for each.
The eval suite as a diligence artefact: ask for the suite, the pass gate, and a failing run
The eval suite is the most useful diligence artefact an AI startup can hand over, because it is the only document that shows whether product quality is measured or asserted. Ask for three things: the suite itself, the pass gate that decides whether a change ships, and one run that failed together with what was done about it. A suite that exists, gates releases and has a history of catching problems tells you the company can say how good its product is. A suite that is all green and has never failed tells you it has never been used. This page is the method for reading one in a diligence session; what an eval suite is lives on the eval-driven development guide.
Code provenance and licence exposure in AI-generated code
Licence exposure in AI-generated code comes down to three questions: whether the generated code can be owned at all, whether the generator reproduced someone else's licensed code, and what the tool provider's terms say about who owns the output. The US Copyright Office concluded in January 2025 that copyright does not extend to purely AI-generated material and that prompts alone do not give a user authorship, which makes the first question real for a codebase that was mostly generated. The second is answered by the generator's own matching logs, and the third by reading the terms. This page gives the check an investor can run and what to record.