Skip to content
tezvyn:

Compare SAST and DAST. Why use both, and their limits?

Source: circleci.comMediumHow cards are made

Compare SAST and DAST. Why use both, and their limits?

Tests whether you understand complementary security testing layers in CI/CD. A strong answer contrasts static source analysis without execution against dynamic runtime attack simulation and explains that relying on only one leaves applications vulnerable.

What's really being asked

This question tests whether you understand the full spectrum of application security testing in a CI/CD context and can articulate why mature practices layer multiple techniques rather than relying on a single scan. Interviewers want to see that you know SAST and DAST operate at different phases of the lifecycle, examine different artifacts, and catch different classes of vulnerabilities.

The full answer

First, define SAST as static application security testing that analyzes source code without executing the program, often called white-box testing, and note that it is used early in development to catch flaws like SQL injection, buffer overflows, XML external entity attacks, and OWASP Top 10 risks before deployment. Second, define DAST as dynamic application security testing that simulates attacks on live running applications to find vulnerabilities only visible during execution, serving as a post-deployment assessment. Third, explain why mature teams use both: the CircleCI article notes that teams relying on just one type of testing leave applications vulnerable, and together these methods fill security gaps by covering pre-deployment code analysis and post-deployment runtime exposure. Fourth, outline the primary limitations: SAST cannot detect issues that only appear when the application is running, and DAST cannot provide early feedback on source code flaws because it requires a deployed live target.

The mistakes people make

A major red flag is claiming that one approach replaces the other or that unit and integration tests are sufficient for security. Another mistake is describing SAST and DAST as competing tools rather than complementary layers; the article explicitly frames them as a paired strategy. Candidates also err by saying SAST requires a running application or that DAST analyzes source code directly.

What usually comes next

An interviewer might ask how you would integrate these tools into a CI/CD pipeline, what specific SAST tools you have used such as Semgrep, Checkmarx, SonarQube, or Klocwork, or how you prioritize remediation when DAST finds a vulnerability in production. They may also ask about the difference between security testing and functional testing, since the article emphasizes that normal user-condition tests do not reveal security flaws.

A concrete example

Suppose your team is building a web application. You configure Semgrep or SonarQube in the CI pipeline to scan code changes before merge for OWASP Top 10 violations; this SAST step catches a potential SQL injection in a data access layer. After deployment to staging, a DAST tool simulates malicious requests against the live application and discovers a vulnerability that only appears during execution, such as a flaw exposed by runtime data handling that static analysis could not see. The team fixes the code flaw pre-deployment thanks to SAST and patches the runtime issue before production thanks to DAST.

Interview question

A team catches a SQL injection flaw pre-merge using SAST, but a runtime data-handling vulnerability slips into production. What does this best illustrate?

  • a.The SQL injection should have been caught by DAST in a staging environment.
  • b.DAST is unnecessary if SAST scans all code paths before deployment.
  • c.SAST requires a deployed application to accurately identify vulnerabilities.
  • d.SAST cannot detect issues that only manifest when the application is running.Correct
Why?

SAST examines source code without execution, so it misses runtime-only flaws like the data-handling vulnerability described. Option B is wrong because the article states that relying on just one type of testing leaves applications vulnerable, meaning the tools are complementary, not redundant.

Just read this? Test yourself on what you have been reading.

Read the original → circleci.com

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles