What is SAST? Static application security testing explained
What is SAST? A plain explanation of static application security testing: how it works, what it finds, where it fits beside DAST and SCA, and how to start.
SAST (static application security testing) is the practice of scanning an application’s source code for security flaws without running it. A SAST tool reads your code the way a careful reviewer would, follows how data moves through it, and points to the file and line where a vulnerability such as SQL injection or a hard-coded password lives — before that code ever reaches production.
This explainer covers how SAST works, what it can and cannot find, how it compares with DAST and SCA, and what a sensible first rollout looks like for an Indian enterprise development team.
What does SAST actually do?
A SAST tool takes source code (and sometimes bytecode or binaries) as input and produces a list of findings. Each finding normally includes:
- What the issue is, often mapped to a CWE identifier such as CWE-89 (SQL injection) or CWE-798 (hard-coded credentials).
- Where it is — file, function and line number.
- How severe it is — typically critical, high, medium or low.
- How to fix it — in better tools, a suggested change rather than a generic paragraph.
Because the analysis happens on code at rest, SAST is sometimes called white-box testing: the tool can see everything, including code paths that are hard to reach from the outside.
How does static analysis find vulnerabilities?
Modern SAST tools combine several techniques:
- Parsing. The code is turned into an abstract syntax tree, so the tool understands structure rather than just text.
- Pattern and rule matching. Rules describe known-dangerous constructs — a weak hashing function, a disabled certificate check, a secret in a string literal.
- Data-flow (taint) analysis. The tool tracks untrusted input (a form field, an HTTP header, a file) from where it enters the program (the source) to where it is used dangerously (the sink), such as a database query or a shell command. If the data reaches the sink without being validated or escaped, that is a finding.
- Control-flow analysis. The tool works out which paths through the code are possible, which helps it ignore dead code and reduce noise.
A worked example makes this concrete. Imagine a loan-status lookup in a bank’s customer portal:
String pan = request.getParameter("pan");
String sql = "SELECT status FROM loans WHERE pan = '" + pan + "'";
ResultSet rs = stmt.executeQuery(sql);
A SAST tool sees that pan comes from an HTTP request (a source), is concatenated into a SQL string, and reaches executeQuery (a sink) with no sanitisation. It flags SQL injection, points to line 2, and suggests a parameterised query:
PreparedStatement ps = conn.prepareStatement("SELECT status FROM loans WHERE pan = ?");
ps.setString(1, pan);
A human reviewer might catch this too — but not across two million lines of code, on every commit, without fail.
What kinds of issues can SAST find?
SAST is strongest on flaws that are visible in the code itself. Typical categories include:
| Category | Examples |
|---|---|
| Injection | SQL, OS command, LDAP and XPath injection |
| Cross-site scripting | Untrusted input written into HTML without encoding |
| Secrets in code | API keys, database passwords, private keys in source files |
| Weak cryptography | MD5 or SHA-1 for passwords, hard-coded keys, insecure random numbers |
| Insecure configuration in code | Disabled TLS verification, permissive CORS, debug mode left on |
| Path traversal | User input used to build file paths |
| Unsafe deserialisation | Deserialising untrusted data into objects |
Many of these map directly to the OWASP Top 10, which is why OWASP lists static analysis tools as a core part of secure development.
Many SAST tools also report code quality issues — duplicated logic, overly complex functions, dead code. These are not vulnerabilities, but messy code is where vulnerabilities hide, so seeing both in one report helps teams fix the whole picture.
What can SAST not find?
Being honest about limits helps you plan the rest of your testing:
- Runtime and environment issues. A misconfigured web server, an exposed admin port or a weak TLS setting on a load balancer are not in your source code.
- Business-logic flaws. If a discount can be applied twice, the code may be perfectly “safe” from a pattern point of view.
- Vulnerabilities in third-party libraries. SAST analyses your code. Known CVEs in open-source components are the job of software composition analysis (SCA) and an SBOM.
- Authentication and authorisation design. SAST can spot a missing check in some frameworks, but it cannot tell you whether your access model is right.
That is why SAST is one layer of an application security programme, not the whole programme.
SAST vs DAST vs SCA: what is the difference?
| SAST | DAST | SCA | |
|---|---|---|---|
| What it tests | Your source code | The running application | Third-party and open-source components |
| When it runs | Before build, at commit, in CI | After deployment to a test environment | At build time, and continuously |
| Points to the line of code | Yes | Usually not | Points to the component and version |
| Finds runtime and configuration issues | No | Yes | No |
| Typical output | Findings by file and line | Findings by URL and request | Component inventory, CVEs, licences (an SBOM) |
Most mature teams run all three. If you are starting from nothing, SAST is usually the first step, because it catches flaws while the developer still remembers writing the code.
Why does SAST matter for Indian enterprises?
Indian regulators increasingly expect secure development, not only secure infrastructure. SEBI’s Cybersecurity and Cyber Resilience Framework (2024) asks regulated entities to obtain SBOMs for software used in core and critical activities, and CERT-In’s technical guidelines on SBOM, CBOM and related bills of materials encourage government, public sector and essential services organisations to require them in procurement. Banks and NBFCs working under RBI’s IT and cyber security expectations face similar questions in audits: how do you know the code you release is safe?
A SAST tool gives you a repeatable answer. Every release has a scan, every finding has an owner, and every exception has a reason. That is evidence an auditor can follow — far stronger than “our developers are careful”.
Where should SAST run in the development lifecycle?
The short answer: early, and more than once.
- On the developer’s machine, before commit. The fastest feedback loop. A pre-commit scan catches a hard-coded secret before it ever enters Git history, where it is very hard to remove.
- In the CI/CD pipeline, on every push or pull request. This is the safety net. Even if a developer skips the local check, the pipeline does not.
- As a quality gate. Set a threshold — for example, any critical finding fails the build — so that serious issues cannot be merged by accident.
We cover the mechanics in detail in our guide to adding SAST to your CI/CD pipeline with quality gates.
How to start with SAST without drowning in findings
The most common failure is turning on a scanner, getting 4,000 findings on day one, and having developers ignore all of them. A better rollout:
- Pick one or two active repositories — ideally a customer-facing application, such as a payments or onboarding service.
- Run a baseline scan and triage the results with a security engineer and a senior developer together.
- Fix or formally accept the criticals first. Record every accepted risk with a reason and a review date.
- Turn on the gate for new code only. Block builds on new critical findings; work through the existing backlog over time.
- Tighten the threshold gradually — critical, then high — as the backlog shrinks.
- Scan often. If your licensing charges per scan, you will be tempted to scan weekly instead of on every push. Avoid that trade-off where you can; our SAST tools buyer’s guide explains why.
Where Ayati Code fits
Ayati Code is a static application security testing tool that scans for vulnerabilities and code quality issues in one pass. It runs before code enters the pipeline (pre-commit) or as it is pushed, blocks the build when findings cross the severity threshold you set, and suggests a fix for each vulnerability. It also generates SBOM, CBOM and QBOM reports for any project, and its licence allows unlimited scans, so teams never have to ration how often they check their code.
If you are planning your first SAST rollout, book a walkthrough on your own repositories.
Frequently asked questions
What is SAST in simple terms?
SAST, or static application security testing, reads an application’s source code without running it and flags patterns that are known to cause vulnerabilities, such as SQL injection or hard-coded secrets. It works like a very thorough code reviewer that never gets tired.
What is the difference between SAST and DAST?
SAST examines source code from the inside before the application runs, so it can point to the exact file and line. DAST attacks a running application from the outside, as a user or attacker would, so it finds issues that only appear at runtime but cannot always say where in the code they come from.
When should SAST run?
As early as possible and as often as possible: on the developer’s machine before a commit, and again in the CI/CD pipeline on every push or pull request. The earlier a flaw is found, the cheaper it is to fix.
Does SAST produce false positives?
Yes, every SAST tool reports some findings that are not exploitable in practice. Good tools reduce this with data-flow analysis and let you tune rules, and a severity threshold keeps the build gate focused on findings that matter.