Security testing in a delivery pipeline looks at an application from two directions. SAST reads the code. DAST prods the running system. The full forms are static application security testing and dynamic application security testing. They find different bugs, which is why security standards and enterprise security questionnaires usually expect both.
SAST: reading the code
A SAST tool parses source code (or bytecode) and follows data from inputs, such as request parameters, to dangerous operations such as SQL queries, shell commands or HTML output. If untrusted data reaches one without validation or encoding, it raises a finding with the file and line.
- Runs: on every pull request, in seconds to minutes.
- Good at: injection, unsafe deserialisation, weak cryptography calls, hard-coded credentials, path traversal.
- Weak at: anything that depends on configuration or runtime behaviour, and business logic. It also produces false positives that need triage.
- Tools: Semgrep, CodeQL, SonarQube, Checkmarx, Snyk Code.
DAST: attacking the running app
A DAST tool crawls a deployed application, usually a staging environment, and sends malicious inputs to every form, parameter and API endpoint. It reports what actually responded badly.
- Runs: against a deployed build, nightly or before release. A full scan can take hours.
- Good at: missing security headers, server misconfiguration, reflected XSS, injection that is really exploitable, TLS problems, exposed admin pages.
- Weak at: pointing to the line of code, finding pages it can't reach, and authorisation flaws between users.
- Tools: ZAP, Burp Suite, Invicti.
SAST and DAST difference
| SAST | DAST | |
|---|---|---|
| Tests | Source code | Running application |
| Testing style | White box | Black box |
| When | Every commit or pull request | After deployment to a test environment |
| Finds | Where the bug is in code | Whether it's exploitable |
| Languages | Needs support for your stack | Language-independent |
| Two related tools often appear alongside them. SCA (software composition analysis) checks open-source dependencies for known vulnerabilities, and pairs with an SBOM. IAST instruments the running app so a test hits code paths and reports the exact line. |
Example: one bug, seen both ways
A Node.js API builds a query with string concatenation:
const rows = await db.query(
`SELECT * FROM orders WHERE customer_id = '${req.query.customer}'`
);
SAST flags it on the pull request: req.query.customer flows into db.query unparameterised, at orders.js:42. DAST, run nightly against staging, sends customer=' OR '1'='1 to /api/orders and gets back every order in the database, proving it can be exploited. The fix is a parameterised query (WHERE customer_id = $1), and both scans pass on the next run.
How to run them in CI/CD
- SAST, SCA and secret scanning on every pull request. Block merges only on high-confidence, high-severity findings, or developers will learn to ignore the tool.
- DAST on a schedule against staging, with authenticated scans using test accounts.
- Send findings to the same backlog as other bugs, with fix deadlines by severity.
- Use a penetration test for logic and authorisation flaws neither tool finds. For card payments, PCI DSS v4.0.1 requirement 6.2.3 asks for bespoke code to be reviewed for vulnerabilities before release, and SAST is the usual automated part of that review. We build security scanning into pipelines as part of our quality engineering work. See CI tools compared.