JournalIs AI-generated code secure? An honest scorecard for an AI SDLC
Agentic SDLC

Is AI-generated code secure? An honest scorecard for an AI SDLC

Arun CSFounding Principal Engineer, Orlian
Published
Reading time
7 min
Topic
Agentic SDLC
In short
  • 01A scan of over 7,000 AI-attributed GitHub files found a known weakness in about 12.1% of them, so about 88% had none.
  • 02Five AI-only revision rounds raised critical vulnerabilities by 37.6%, and 19.7% of 2.23 million samples referenced a package that does not exist.
  • 03The scorecard pairs six weaknesses with the control an AI SDLC runs against each and the case that still needs a named person.
  • 04At Moltbook a missing access rule left 1.5 million API tokens open to read and write, and fixing it took four rounds in about three hours.
  • 05Requirements, tests first, checks on every change, a staging scan and a signed release each catch different weaknesses.
  • 06Scans miss wrong requirements, unconfigured paths and brand-new attacks, so the last control is a person signing with the evidence.
  • 07In Orlian review and SAST agents check every change, secrets stay in a vault, packages come from approved registries and named people sign.

AI-generated code security depends on the controls around the code. Published studies find weaknesses in AI-written code often enough that nothing should merge unscanned and they also show that most files come out clean. An AI SDLC catches the repeatable weaknesses with tests, review and scans that run on every change and it leaves a short list of cases to a named person. This post scores both sides: what the studies measured, which control targets each weakness and what still needs a person. The wider method is covered in What is an agentic SDLC?

01What three studies measured about AI-generated code

Three published studies, each measuring a different weakness, give a clear picture of where the problems sit.

A large-scale analysis of public GitHub repositories ran a code scanner over more than 7,000 files attributed to four AI coding tools. About 12.1% of the files had at least one finding mapped to a known weakness category, which means about 88% had none. The findings with the highest severity scores were SQL injection, OS command injection, code injection and hard-coded credentials. The authors list their own limits: the files were found through attribution comments, the scan is static and cannot see runtime or logic flaws and the results show associations and prove no cause.

A controlled experiment on iterative generation started from ten secure code samples and had a language model revise each one ten times under four kinds of prompt, with no person looking between revisions. The abstract reports a 37.6% rise in critical vulnerabilities after five rounds. Feature-focused prompts produced the most vulnerabilities and security-focused prompts the fewest, as Figure 1 shows. The authors recommend a developer review between revisions and no more than three consecutive AI-only revisions.

Feature-focused revisions produced about four times the vulnerabilities of security-focused onesVulnerabilities found in 100 AI-revised samples per prompt type, with no person reviewing between revisions
  1. Feature-focused158
  2. Efficiency-focused124
  3. Ambiguous improvement67
  4. Security-focused38

Ratio of the highest to the lowest bar: 4.2 to 1. Bars start at zero. One model, ten baseline samples.
Source: arXiv 2506.11022, accepted at IEEE-ISTAS 2025

Figure 1 · Vulnerabilities by prompt type in an iterative code-generation experiment

A third study, summarised in a 2026 Cloud Security Alliance research note, generated 2.23 million code samples from 16 models and found that 19.7% referenced at least one package that does not exist. Attackers can register those invented names and wait for an agent to install them. The note describes one such name spreading through 237 repositories by way of AI-generated agent skills, with downloads coming from autonomous agents running their own output.

02The scorecard: six weaknesses, the control for each and what stays with a person

Each row pairs a weakness with the control an AI SDLC runs against it and the case that remains with a named person. No control closes a row for good. Each one narrows the odds. The last section says which of these controls Orlian runs today.

WeaknessWhat the research foundControl in an AI SDLCStill needs a person
01Injection (SQL, OS command, code)Among the highest severity scores in the GitHub analysisA SAST scan on every change before it merges and a DAST run against staging, as in SAST and DAST in the SDLC, plus an independent review of each changeQuery paths that look safe to a scanner and the decision to accept a finding
02Hard-coded credentials and secretsAmong the highest severity scores in the GitHub analysisA scan for secrets on every change and secrets held in a vault outside the codeDeciding which values count as secrets and rotating any that leaked
03Missing access control and unsafe configurationThe Moltbook exposure below: a database that anyone with a public key could read and writeThe access rules written as requirements and tested before any code exists, a DAST run against staging with test accounts and a signed release with the test evidence attachedConfirming that the access rules are the right ones
04Invented packages19.7% of 2.23 million samples referenced a package that does not existInstalls limited to approved registries and an allowlist of packages, a check that each new package exists, versions pinned in a lockfile and review of any new dependencyApproving each package that is not on the list
05Drift across AI-only revisions37.6% more critical vulnerabilities after five rounds with no person between themAn independent review and a scan on every change, a human gate after a short run of AI-only revisions and a named person signing before work moves to the next stageJudging when a change has moved too far from its intent
06Flaws in business logicOutside what a static scan can see, by the GitHub analysis's own accountTests written from the requirements before the code and a DAST run in stagingConfirming that the requirement says what the business means

03What a missing access rule exposed at Moltbook

On 31 January 2026 the security firm Wiz reported a misconfigured database behind Moltbook, a social network for AI agents whose founder had said publicly that he wrote no code for it. Wiz's report says the site's JavaScript carried the database connection details in plain view. That is safe when the database enforces row-level access rules and here those rules were missing, so anyone holding the public key could read and write the data. The exposure included 1.5 million API authentication tokens and 4,060 private conversations between agents, some holding plaintext third-party credentials. Wiz also edited an existing post as a test, which showed that write access was open too. This is the third row of the scorecard.

From first contact to final fix took about three hours and it took four rounds of fixes because each round exposed more, as Figure 2 shows. Wiz drew conclusions that map onto the scorecard. AI tools that generate such backends should enable the protection by default, deployment platforms should scan for exposed credentials and unsafe configurations and a person should review the configuration before launch.

Each round of fixes uncovered more exposed dataMoltbook disclosure and fixes, 31 January to 1 February 2026, times in UTC
  1. First contact with the maintainer21:48 UTC
  2. Misconfiguration reported22:06 UTC
  3. First fix: agent and owner tables23:29 UTC
  4. Second fix: messages and votes00:13 UTC
  5. Write access found00:31 UTC
  6. Third fix: write access blocked00:44 UTC
  7. More exposed tables found00:50 UTC
  8. Final fix: all tables secured01:00 UTC

Blue: a new exposure found while fixing the last one. Grey: a fix. Outline: contact and report.
Source: Wiz Research disclosure timeline, 2 February 2026

Figure 2 · Moltbook disclosure and fixes, from first contact to final fix

04How the controls stack in the pipeline

The controls in the scorecard sit at different points between a requirement and a release and each one looks at something different. A weakness that gets past one layer meets the next and the last layer is a person reading the evidence. Figure 3 shows the order.

Each layer of the pipeline targets different weaknesses
  1. RequirementAccess rules written down and confirmed by a product owner
    Missing access rulesUnclear requirements
  2. Tests firstFailing tests for those rules exist before any code is written
    Logic flawsAccess rules that were never tested
  3. Every changeAn independent review and a SAST scan before the change merges
    Injection and hard-coded secretsDrift across AI revisions
  4. StagingA DAST run with test accounts against the deployed build
    Exposed data and unsafe configurationFlaws that show only at runtime
  5. ReleaseA named person signs, with the test evidence attached
    Anything the earlier layers left openA person decides with the evidence

Blue: the layer that probes the running system from outside, where an exposure like Moltbook’s appears.
Illustrative: the layers of an AI SDLC pipeline

Figure 3 · Where each layer of an AI SDLC meets the weaknesses in the scorecard

Two of these layers matter most for an agent that revises its own work. The independent review and the scan on every change stop one AI-only revision from building on the last, which is the drift the iterative study measured. The signed release keeps a person at the end of the chain, a point developed in Autonomous software development with human gates.

05What no control catches yet

The scorecard leaves cases open and a post on AI-generated code security should name them. A scan finds the patterns it knows. It cannot tell that a requirement is wrong and the GitHub analysis lists runtime and logic flaws among the things its static scan could not see. A DAST run reaches only the routes and accounts it is given, so a flaw behind a path that nobody configured stays hidden. A new kind of attack, such as an invented package that an attacker registers first, can appear before any scan has a rule for it. The last control is a person signing at a gate and that signature is only as good as the evidence in front of the person and the time to read it.

A finding that a person accepts stays on the board as a ticket with a name beside the decision, so an accepted risk is a recorded choice. The figures in the studies above also come from specific models and tools at specific dates, which makes them a starting point for measuring a team's own findings over time.

06Where Orlian fits

In Orlian an independent Review agent and a SAST agent check every change inside the test-first AI coding agents wing before it merges and a person reviews the work at a human gate after a short run of AI-only revisions, in line with the iterative study's advice. A DAST agent is designed to attack staging in the AI test automation wing with more than one role, such as a normal user and an admin. The fully automated staging run is still being built as of date. Tests are written from the requirements before the code, production and staging secrets stay in a vault outside the code, agents install packages only from approved registries and named people sign the requirements, the changes to shared code and the release, each with the evidence attached. Findings become tickets on the same board as every other defect. None of this makes the scorecard disappear. It moves the repeatable weaknesses to the front of the pipeline, where they cost least to fix and puts a person where judgment is needed.

At Moltbook a missing access rule reached production with nobody asking who may read and write what. In an AI SDLC that question is a requirement, then a test and then a staging scan before it is a release and the answer has a name beside it.

Filed underAgentic SDLC
Written by

Arun CS

Founding Principal Engineer, Orlian. Arun works with engineering and security teams on running SAST and DAST on every change and turning each finding into a ticket that is fixed, reviewed and scanned again.

The Journal, by email

Get the next field note in your inbox.

We write when we have something worth reading: the method behind the platform, and what we learn delivering with it.

You're on the thread.

Thank you for your interest. The next field note will land in your inbox the moment it's written. We'll send updates, never noise.

That didn't go through. Check the email address and try again, or write to us at hello@orlian.ai.

One email per field note. No noise, and you can unsubscribe anytime.