JournalSAST and DAST in the SDLC: how an AI SDLC scans one defect twice
Agentic SDLC

SAST and DAST in the SDLC: how an AI SDLC scans one defect twice

Arun CSFounding Principal Engineer, Orlian
Published
Reading time
5 min
Topic
Agentic SDLC
In short
  • 01The worked example is an order search that adds typed text straight into a database query, so a quote character changes what the query does.
  • 02SAST flags that line on the pull request as a file and a line. DAST would see it on staging as a route and a request.
  • 03SAST reads the code before the merge and misses runtime flaws. DAST attacks the running app and cannot point at the line.
  • 04The same flaw class, SQL injection (CWE-89), was behind the 2023 MOVEit breach by the CL0P ransomware gang.
  • 05SAST sits in Build ahead of the merge and DAST sits in Verify against staging, each in front of a signed gate.
  • 06Every finding becomes a ticket that loops through fix, review and rescan until the scan is clear.
  • 07In Orlian both scans file findings to the same board, and two of the five signed gates stop work while serious findings are open.

SAST and DAST in the SDLC answer one question from two sides: SAST reads the code of every change before it merges and DAST attacks the running system on staging. This post follows one flaw, a database query built from user input, through both scans to show what each one sees, what each one misses and how a finding becomes a ticket in an AI SDLC. The wider method is covered in What is an agentic SDLC?

01The flaw: a search that builds its query from the search box

The sample project is an order management app. Its orders page has a search box and the search function adds the typed text straight into a database query. The line below is illustrative.

TypeScript
// orders/search.ts, line 42const rows = await db.query("SELECT * FROM orders WHERE note LIKE '%" + term + "%'");

A person who types a quote character followed by a condition that is always true changes the meaning of the query. The safe version passes the text to the database as a value in a parameter, which keeps it from being read as part of the command.

02One flaw, two reports

In the sample project the SAST agent flagged the query on the pull request, rated it high and cited the file and the line. The same flaw would look different from staging, because DAST never reads the code: it sends requests to the running app and reports what comes back.

SAST sees the line of code and DAST sees the behaviour
SAST reads the pull requestRuns on every change before it merges
orders/search.ts, line 42db.query(... + term + ...)HIGH: query built from user inputCWE-89, found in search()
Seen as: a file and a line
DAST probes the running appIllustrative: the same flaw reaching staging
GET /orders/searchSent: a quote and an always-true condition in the search textReturned: far more orders than expected
Seen as: a route and a request

Solid: the sample project's scan. Dashed: what DAST would report had the flaw reached staging.

Figure 1 · one flaw as SAST and DAST each report it

The two reports lead to different fixes. The first points a developer at a line to change. The second points at a route and a request that reproduces the behaviour, which a developer then has to trace back to the code.

03What each scan catches and misses

Each scan reaches what the other cannot, so the two together cover more than either alone.

SASTDAST
RunsOn every pull request, before the change mergesAgainst staging, after the build is deployed
ReadsThe source codeThe running app, through its routes and test accounts
Catches wellUnsafe queries, secrets in code, weak cryptographyInjection, broken authentication, weak sessions and missing protections such as response headers
MissesFlaws that exist only at runtime, such as a missing header or a cookie settingCode paths that no request reaches and the line that caused the problem
Finding points toA file and a lineA route and a request
Stops workThe change at the Build gate while high or critical findings are openThe release at the Verify gate while critical or high findings are open

04What the same flaw class did in the MOVEit breach

A query built from input is not a classroom example. From 27 May 2023 the CL0P ransomware gang exploited a previously unknown SQL injection flaw, CVE-2023-34362, in Progress Software's MOVEit Transfer file transfer product. The group used it to install a web shell on internet-facing MOVEit Transfer servers and to steal data from the databases behind them, according to the joint CISA and FBI advisory. The flaw is catalogued as CWE-89, a query assembled from input that an attacker controls, which is the class that both scans in this post are built to find and the one used as the worked example in this post.

05Where each scan runs in the pipeline

SAST sits inside Build, on every pull request and ahead of the merge. DAST sits in Verify, after the Stage wing has deployed the build and loaded test data and test accounts. Verify also runs the traced tests described in Test cases from requirements against the same staging build.

SAST runs before the merge and DAST runs against staging
Commit lands
Pull request opens
SAST scans the change
runs on every change
Build gate: engineer approves
Staging is deployed
DAST probes staging
runs against staging
Verify gate: QA lead accepts
Release
Figure 2 · where SAST and DAST sit between commit and release

Each scan stands before a signed gate. A person approves the change at the Build gate with no high or critical security findings open and a person accepts the test evidence at the Verify gate with no critical or high findings open. The AI SDLC maturity model places scans on every change at level 4, the level at which a named person signs each hand-off.

06From finding to closed ticket

A finding from either scan becomes a ticket on the same board as the project's other defects, linked to the code it concerns and to the requirement or policy it touches, the same linking that keeps a requirements traceability matrix current. The ticket then follows one loop: the Dev agent fixes it, the Review agent checks the fix and the scan runs again. Keeping the reviewer separate from the author of the change is the practice described in what AI coding agents do well and where they need a spec.

Every finding returns through the same loop until the scan is clear
Scan raises a finding
Ticket on the project board
linked to the code and the requirement
Dev agent fixes it
Review agent checks the fix
Scan runs again
Clear?
Ticket closed, record kept
Figure 3 · from a scan finding to a closed ticket

In the sample project the SAST finding on the pull request went round the loop and ended fixed, rescanned and clear to merge. On staging the DAST run reported one medium finding, a missing content security policy header and one low finding, a session cookie without the SameSite setting. It found no blockers and each finding became a ticket.

07Where Orlian fits

In Orlian the SAST agent in the test-first AI coding agents wing scans every pull request before it merges and the DAST agent in the AI test automation wing attacks staging with the test accounts that the Stage wing creates. Both grade findings by severity and file them to the same board as every other defect and two of the five signed gates stop work while serious findings are open.

A query built from input is the weakness class behind the MOVEit breach. In the sample project the same class was flagged on a pull request, before the change merged, which is the reason an AI SDLC runs SAST on every change and keeps DAST for the staging checks that code alone cannot show.

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.