What Is SAST? How Static Application Security Testing Works
What is SAST and how does it work? Source-sink, taint analysis, false positives, CI/CD integration and tool selection in one guide.

Speed keeps increasing in modern software development.
New features are built in shorter timeframes.
Code is pushed to repository systems many times a day.
Thanks to CI/CD pipelines, applications can be tested and moved to production within hours or even minutes.
This speed brings software teams significant advantages.
But it also raises a critical question:
How will security controls keep up with this speed?
It is not possible to perform manual source code analysis after every code change.
Nor is it realistic to carry out a comprehensive penetration test after every commit.
Security controls therefore have to be automated.
This is where SAST – Static Application Security Testing comes in.
SAST is a method that analyses source code or software components for security without running the application.
The basic aim is to detect security problems in the code a developer writes as early as possible.
But SAST is not a simple scanning system that merely looks for certain words or lines of code.
Modern SAST solutions try to understand an application's source code using techniques such as:
Data Flow Analysis, Taint Analysis, Control Flow Analysis, Source-Sink Analysis and Semantic Code Analysis
SAST has therefore become one of the fundamental security layers of modern Application Security and DevSecOps programmes.
1. What Is SAST?
SAST is short for Static Application Security Testing.
In general terms it can be described as:
Static application security testing
or
Static code security analysis
The defining feature of SAST is that analysis can be performed without needing to run the application.
A SAST tool examines software components such as source code, compiled code or bytecode to detect potential security problems.
Consider, for example, a parameter taken from a user in a web application being passed into an SQL query without any validation.
By following that data flow, the SAST system tries to detect this relationship:
User Input → Application Function → SQL Query
If there is no safe validation or parameterized query mechanism in between, the system may raise a potential SQL Injection finding.
This approach means the vulnerability can be detected before the application reaches the production environment.
2. Why Is SAST Called "Static"?
The word "static" in SAST's name means the application is not run during analysis.
In other words, the system does not send attacks to the application from outside.
It does not create HTTP requests.
It does not actively call API endpoints.
It does not use the application through a browser.
Instead it examines the code itself.
SAST therefore differs from DAST — Dynamic Application Security Testing.
DAST assesses the running application from the outside, while SAST analyses the application's internal structure.
This distinction matters.
Because SAST can detect at code level some security problems that are very hard to see from outside.
For example:
- hard-coded credentials,
- insecure cryptographic usage,
- risky function calls,
- unchecked data flows,
- API keys inside code,
- exception handling problems
are more easily seen at source code level.
3. How Does SAST Analyse Source Code?
The way SAST systems work can differ according to the technology used.
But in general there are several basic analysis methods.
Chief among them are:
- Lexical Analysis
- Syntax Analysis
- Abstract Syntax Tree
- Control Flow Analysis
- Data Flow Analysis
- Taint Analysis
- Semantic Analysis
Modern SAST systems use some or all of these methods to derive the security meaning of source code.
The basic aim here is not merely to find a particular line of code.
The real aim is:
to understand how data moves within the application.
4. What Is an Abstract Syntax Tree – AST?
One of the basic structures a SAST system can use while analysing source code is the Abstract Syntax Tree – AST.
An AST represents the structural meaning of source code in the programming language as a tree.
A developer may have written this code, for example:
result = userInput + 10
Looking at that line, a human
can understand that a variable is being added to user input.
But for an analysis engine to evaluate the code systematically, the code must be broken into its parts.
Thanks to the AST, the system can structurally understand:
- variables,
- functions,
- operators,
- method calls,
- conditions,
- loops.
This structure forms the basis of more advanced security analysis.
5. What Is Control Flow Analysis?
Control Flow Analysis analyses which code blocks the application can execute under which conditions.
Consider an application with this logic:
If the user is an admin, grant access to the management panel.
If not, deny access.
Rather than assessing lines independently, the SAST system analyses the program's possible execution paths.
This structure can generally be modelled through a Control Flow Graph – CFG.
A Control Flow Graph shows the routes by which one code block can be reached from another within a program.
The security system can then look for answers to questions such as:
- Is the security check applied on every code path?
- Can a particular condition be skipped?
- Can a risky function be called without passing a security check?
This analysis is particularly valuable in complex applications.
6. What Is Data Flow Analysis?
One of the most important components of SAST technology is Data Flow Analysis.
Data Flow Analysis tracks where a piece of data comes from and where it goes within the application.
A user may be typing a username into a web form, for example.
That data:
is taken from the HTTP request.
Is assigned to a variable.
Is sent to another function.
May later be used in an SQL query.
The SAST system tries to understand that chain.
For example, there may be a data flow like:
HTTP Parameter → Variable → Function → SQL Query
If user input reaches a critical point without passing a safe check, a security problem may arise.
SAST's strength therefore comes not from examining lines of code one by one but from being able to assess the data flows inside the code.
7. What Is a Source?
One of the concepts used most often in the SAST world is Source.
A source is the point at which untrusted or externally controllable data enters the application.
Some of the areas that can be regarded as sources are:
- HTTP GET parameters
- HTTP POST data
- API request bodies
- HTTP headers
- Cookies
- URL parameters
- File uploads
- Data arriving from external services
- Content arriving over a message queue
What they have in common is that the data can come from a source entirely outside the application's control.
Source points are therefore particularly important in security analysis.
8. What Is a Sink?
A sink is the security-critical function the data reaches.
Security risk can arise if user-controlled data is used in operations such as:
- SQL query
- Operating system command
- File system operation
- HTML output
- JavaScript output
- LDAP query
- Network request
- Template engine
- XML parser
These functions are not always insecure.
The risk arises when user-controlled data reaches them without passing appropriate security controls.
One of the fundamental questions of SAST analysis is therefore:
Can data coming from a source reach a sink without being made safe?
9. How Does Source-to-Sink Analysis Work?
Source-to-sink analysis is the basic approach of modern SAST systems.
Consider a filename parameter coming from the user in a web application.
The application may use that parameter with this logic:
User parameter → Build file path → Read file
Here,
the user parameter can be regarded as the source,
and the file-reading function as the sink.
If the user can pass /etc/passwd or another file path to the application, a Path Traversal problem may arise.
By following the code, the SAST system tries to determine how user input reaches the file-reading function.
This analysis does not always take place within a single file.
Data may pass through more than one function.
It may be passed to another class.
It may be processed in different modules.
Advanced SAST solutions must therefore be capable of interprocedural analysis — analysis across functions.
10. What Is Taint Analysis?
Taint analysis is an analysis method that tracks user-controlled or untrusted data within an application.
In this approach, data coming from outside is marked "tainted" — untrusted.
For example, on the line:
userInput = request.getParameter("search")
the userInput variable can be regarded as tainted because it is controllable by the user.
That data may be assigned to another variable:
searchText = userInput
In that case searchText becomes tainted too.
If the data is later passed into an SQL query, the system can detect the risk.
The SAST engine essentially tracks this:
How does untrusted data spread within the application?
This approach is particularly effective at detecting injection-type vulnerabilities.
11. What Is a Sanitizer?
The third important concept between source and sink is the sanitizer, or security control.
A sanitizer is the operation or function that makes user input safe.
But there is an important point to note here.
The same sanitizer is not used for every security problem.
For SQL Injection the right method may be a parameterized query.
For XSS, context-aware output encoding can be used.
For file operations, safe path validation can be applied.
It is therefore not enough for a SAST system to know only the source and sink points.
It must also understand the security controls in between.
If data flows like this, for example:
Source → Validation → Parameterized Query → SQL
it may be safe.
But if it flows like this:
Source → String Concatenation → SQL
a potential SQL Injection problem may exist.
12. How Does SAST Detect SQL Injection?
Consider a username parameter from the user being added directly into an SQL query.
The application may use this logic:
query = "SELECT * FROM users WHERE username='" + username + "'"
Here username is controlled by the user.
The SAST system may define:
the request parameter
as the source,
and the SQL execute function as the sink.
If it detects that there is no safe parameterization in the data flow between them, it can raise an SQL Injection warning.
But if the code has been implemented like this:
SELECT * FROM users WHERE username = ?
and the user input is passed via a parameterized query, the risk is significantly reduced.
Advanced SAST systems try to make that distinction.
13. How Does SAST Detect XSS?
In Cross-Site Scripting analysis, how user input is passed into web output matters.
If a name parameter from the user is added directly into HTML, for example, the system may raise a potential XSS risk.
The data flow may look like this:
HTTP Parameter → Application Variable → HTML Response
If safe output encoding has not been applied here, the SAST system can detect a security problem.
But the reason XSS analysis is complex is that there are different output contexts.
A piece of data may be used:
inside an HTML body,
inside an HTML attribute,
inside JavaScript,
inside CSS,
inside a URL.
It is therefore important that modern SAST systems can perform context-aware analysis.
14. How Does SAST Find Command Injection?
Command Injection can arise when user-controlled data is used in operating system commands.
For example, an application may take an IP address from the user and run a ping command.
The logic may look like this:
ping + userInput
If user input is added directly into the operating system command, an attacker may try to manipulate the command structure.
The SAST system may define:
the user input as the source,
and the operating system command function as the sink.
If there is no appropriate security control in between, a Command Injection finding can be raised.
Problems of this type are generally assessed as critical security risks.
15. Can SAST Detect SSRF?
In certain circumstances, yes.
Server-Side Request Forgery — SSRF — occurs when an attacker causes the server to send requests to other systems.
An application might have a feature like this, for example:
"Let the user enter a URL and have the system download that content."
If the URL coming from the user is called directly by the back end, an attacker may try to reach targets such as:
- localhost,
- internal IP addresses,
- cloud metadata services,
- internal corporate services.
By determining that user input reaches an HTTP client function, the SAST system can raise a potential SSRF risk.
But because the real exploitation conditions may depend on the application's network structure, the finding may need manual validation.
16. Can SAST Find Broken Access Control?
This is an important question.
The answer is:
In some cases yes, but not always.
Broken Access Control mostly relates to the application's business logic.
Completely forgetting an authentication check on an API endpoint, for instance, can be detected by SAST.
But in more complex scenarios the problem can only be seen by understanding the application's business rule.
For example:
A user may need to view only the documents in their own department.
There may be an authorisation check in the code.
But the check may be applied against the wrong business rule.
The SAST system sees that an authorisation check technically exists.
Yet it may not understand that the real business rule has been implemented incorrectly.
SAST therefore does not entirely replace manual source code analysis or pentesting.
17. Can SAST Find Hard-Coded Credentials?
Yes.
Many SAST and Secret Scanning solutions try to detect sensitive information inside source code.
For example, information such as:
- passwords,
- API keys,
- secret tokens,
- private keys,
- cloud credentials
can be analysed through particular patterns.
But Secret Scanning is often treated as a security layer separate from SAST.
Because secret detection systems can analyse not only the current code but also the repository history.
That matters a great deal.
A developer may have deleted an API key from the code.
But the key may still exist in an old Git commit.
18. What Is Interprocedural Analysis?
In simple security analysis, data can be tracked within the same function.
But in modern applications data usually passes through many different functions.
User input may, for example:
be received in a controller.
Be sent to the service layer.
Pass through a utility function.
Be passed into an SQL query in the repository layer.
The data flow may therefore look like this:
Controller → Service → Helper → Repository → Database
For the SAST system to detect the security problem, it must track the data flow across functions.
This method is called Interprocedural Analysis.
The success of advanced SAST engines depends largely on how accurately they can analyse complex data flows of this kind.
19. What Is Cross-File Analysis?
Modern applications do not consist of a single file.
There may be thousands of source code files.
A variable may be created in one file.
Processed in another.
Passed to a critical function in a third.
It is therefore not enough for SAST systems to examine a single file independently.
Cross-File Analysis lets the security engine analyse the relationships between multiple source code files.
This capability is particularly important in enterprise applications.
20. At Which Stage Should SAST Be Run?
One of SAST's most important advantages is that it can be run at many different points in the software development process.
For example:
IDE Level
The developer can receive a security warning while writing code.
This is one of the earliest feedback points.
Commit Level
Analysis can be performed as code is pushed to the repository.
Merge Request / Pull Request
A security check can be carried out before the code is merged into the main branch.
Build Stage
SAST can be run automatically inside the CI/CD pipeline.
Before Release
A more comprehensive security analysis can be applied.
In a modern DevSecOps approach, feedback as fast as possible is preferred.
Because a security warning is easier to fix while the developer is still working on the code in question.
21. How Is SAST Used Within CI/CD?
In modern software development environments, SAST is mostly automated inside the CI/CD pipeline.
The process might look like this:
Developer Commit
↓
Secret Scanning
↓
SAST
↓
SCA
↓
Unit Test
↓
Build
↓
Security Quality Gate
↓
Deployment
If a critical security problem is found during SAST analysis, the pipeline can be stopped.
Insecure code is thereby prevented from reaching production.
This approach is one of the basic principles of DevSecOps.
But the Quality Gate policy must be designed correctly here.
A pipeline stopping for every low-severity warning can make development teams want to disable security controls.
Risk-based policies should therefore be applied.
22. What Is an Incremental Scan?
In large software projects, re-analysing all the source code after every commit can take a long time.
Modern SAST systems can therefore use an incremental scan approach.
An incremental scan tries to analyse only the changed code sections or the areas affected by the change.
This approach gives the developer faster feedback.
A full scan can take a long time in a project with millions of lines of code, for example.
But if the developer has changed only 50 lines, a fast incremental scan can be performed.
A more comprehensive full scan can then be run overnight or at set times.
This model provides a more balanced approach between performance and security.
23. What Is a False Positive?
One of the most important topics in SAST technology is the false positive problem.
A false positive is when a security tool reports as a vulnerability something that is not actually exploitable.
The SAST system may see that user input reaches an SQL query, for example.
But automatic parameterization may be applied by the framework in between.
If the system cannot understand that correctly, it may raise an SQL Injection finding.
Yet no real vulnerability may exist.
That situation is assessed as a false positive.
SAST systems producing too many false positives can create a serious problem for developers.
Because finding the real critical vulnerabilities among hundreds of false alarms becomes difficult.
24. What Is a False Negative?
A false negative is a more dangerous situation.
The system fails to detect a real vulnerability.
There may be a serious authorisation problem in the application, for example.
But the SAST engine may not see that vulnerability.
In that case the tool's report shows no problem.
Yet the application really is insecure.
No SAST solution should therefore be assessed like this:
"The tool gave a clean report, so the application is completely secure."
SAST is an important security layer.
But it is not the Application Security programme itself.
25. Why Is Manual Validation Necessary?
Automated SAST tools can analyse large code bases very quickly.
That is an important advantage.
But the findings the tool detects must be assessed in context.
A security specialist may ask questions such as:
- Is the data really controllable by the user?
- Is the function reachable from outside?
- Is there a security control in between?
- Can the finding be exploited in the real environment?
- Is authorisation applied in a different layer?
- What is the real business impact of the vulnerability?
In professional source code security analysis, therefore:
SAST output = final security report
should not be the assumption.
The correct model should be:
SAST → Triaging → Manual Validation → Risk Assessment → Remediation
26. How Should SAST Findings Be Prioritised?
A SAST scan can produce hundreds or even thousands of findings.
Fixing them all at once is not realistic.
Findings must therefore be prioritised on the basis of risk.
The following factors can be assessed, for example:
Severity
The technical importance level of the finding.
Exploitability
How easily the vulnerability can be exploited.
Reachability
Is the code in question actually reachable?
Data Sensitivity
Does the finding give access to sensitive data?
Internet Exposure
Is the application reachable over the internet?
Business Criticality
How critical is the application to the organisation?
Used together, these criteria let security teams prioritise real risks.
27. What Is Reachability Analysis?
One of the concepts gaining importance in modern Application Security systems is Reachability Analysis.
There may be a risky function inside the code, for example.
But that function may never be reachable by a user.
In that case the theoretical security risk may not exist on the real attack surface.
Reachability Analysis tries to answer this question:
Can an attacker actually reach this vulnerability?
This approach is particularly important in reducing the number of false positives.
28. What Should a SAST Report Contain?
A professional SAST report should not be merely an exported version of the tool's output.
Every security finding must be understandable to the developer.
An ideal finding might contain the following information:
- Finding name
- Severity
- Affected file
- Affected line of code
- Source point
- Sink point
- Data flow
- CWE category
- OWASP relationship
- Risk explanation
- Exploitation scenario
- Remediation recommendation
- Secure code example
- Validation status
This structure helps the developer understand the problem more quickly.
29. The Relationship Between SAST and CWE
Classifying SAST findings within a common security language matters.
Findings are therefore mostly mapped to CWE – Common Weakness Enumeration categories.
For example:
SQL Injection,
Cross-Site Scripting,
Command Injection,
Path Traversal,
Improper Authorization
all have CWE equivalents.
This mapping makes it easier for organisations to build long-term security metrics.
At year end an organisation can carry out this analysis, for instance:
"Which CWE category do we encounter most?"
If the same security errors are seen repeatedly, developer training and Secure Coding standards can be updated for that area.
30. The Relationship Between SAST and OWASP
The OWASP Top 10 is one of the best-known risk classifications in application security.
Many of the security problems detected by SAST tools can be linked to OWASP categories.
But it is not right to limit SAST's scope to the OWASP Top 10 alone.
Hundreds of different security weaknesses can exist within source code.
In comprehensive Application Security programmes, therefore:
CWE + OWASP + Secure Coding Standard + Enterprise Risk Model
can be assessed together.
31. Which Programming Languages Does SAST Support?
The languages supported vary by SAST solution.
Modern SAST products can generally support many programming languages and frameworks.
For example, technologies such as:
- Java
- C#
- JavaScript
- TypeScript
- Python
- PHP
- C
- C++
- Go
- Kotlin
- Swift
- Ruby
can be supported.
But supporting the programming language alone is not enough.
Framework knowledge matters too.
For Java, for example:
Spring,
Spring Boot,
Jakarta EE
must be analysed correctly.
The same applies to .NET, PHP, JavaScript and other ecosystems.
32. What Should Be Considered When Choosing a SAST Tool?
When selecting a SAST product, the number of programming languages supported should not be the only consideration.
The main criteria to assess are:
- Programming language support
- Framework support
- False positive rate
- Scan performance
- CI/CD integration
- IDE integration
- Git platform integration
- Incremental scan support
- API support
- Reporting features
- CWE and OWASP mapping
- Ability to write custom rules
- On-premise or cloud deployment options
- Data privacy requirements
In critical or regulated sectors in particular, whether source code leaves the organisation should also be assessed.
33. Does SAST Send Source Code Outside?
This depends on the product and deployment model used.
In some cloud-based solutions, source code may be sent to the provider's infrastructure for analysis.
In on-premise solutions, analysis can be performed entirely within the organisation's own environment.
This matters especially for critical source code, defence industry projects, financial applications or software sensitive in terms of intellectual property.
When choosing a SAST solution, therefore, these questions must be assessed:
Where is the source code analysed?
Is the code stored?
Which data is sent to the provider?
In which country is the data held?
These questions matter not only technically but from a GRC and data security perspective too.
34. Does SAST Slow Developers Down?
If configured wrongly, yes.
Configured correctly, it can actually help security problems be resolved faster.
If a 45-minute scan runs after every commit, for example, the developer experience can be seriously damaged.
Instead, different analysis levels can be used:
a fast check at IDE level,
an incremental scan at pull request stage,
a full scan overnight.
Likewise, the pipeline should not be stopped for every low-severity finding.
The Quality Gate should be configured only around security problems that create real risk.
In a DevSecOps approach, the aim of security is not to stop development;
it is to let development accelerate securely.
35. Is SAST Enough on Its Own?
No.
SAST is a strong security control but provides visibility only from the source code perspective.
Different testing methods must be used together in a modern Application Security programme.
For example:
SAST → analyses source code.
SCA → analyses third-party libraries.
Secret Scanning → detects sensitive information.
DAST → analyses the running application from outside.
API Security Testing → assesses the API attack surface.
Pentest → simulates real attacker behaviour.
Manual Code Review → examines business logic and complex code problems.
Used together, these controls provide far stronger security visibility.
36. Where Does SAST's Real Value Emerge?
SAST's real value emerges not in a one-off security scan but when it is integrated into the software development process.
An organisation may carry out a source code scan once a year.
That is useful.
But if SAST runs automatically every time a developer pushes new code, security has come into play at a far earlier stage.
In the ideal model the developer learns about the security error not months later in a pentest report but
on the day the code is written.
That matters a great deal for building a secure software development culture.
The SecureSys Approach to SAST and Source Code Analysis
At SecureSys we do not treat SAST merely as an automated security scanning tool.
Our core goal in source code security is not to report the highest possible number of findings the tool produces;
it is to surface the real security risks correctly.
Depending on project scope, therefore:
SAST, manual source code analysis, SCA, Secret Scanning, API security testing, DAST and penetration testing
can be assessed together.
SAST findings should be evaluated in terms of:
- source-sink relationships,
- data flows,
- CWE categories,
- real reachability,
- exploitability,
- the application's business criticality.
Security findings must also be conveyed to development teams with actionable remediation recommendations.
Because a good Application Security process does not merely show the vulnerability.
It also tells the developer why it arose and how to prevent it arising again.
Frequently Asked Questions
What is SAST?
SAST is short for Static Application Security Testing. It enables source code or related software components to be analysed for security without running the application.
How does SAST work?
SAST tools analyse the functions, variables, control flows and data flows within source code. They try to determine whether user-controlled data reaches security-critical functions.
What are source and sink?
A source is the point at which data controllable by a user or external system enters the application. A sink is a security-critical function that data reaches, such as an SQL query, an operating system command or HTML output.
What is taint analysis?
Taint analysis is a static analysis method that tracks how untrusted data moves within an application.
Can SAST find SQL Injection?
Yes. It can raise potential SQL Injection findings by detecting data flows in which user-controlled data is passed insecurely into SQL queries.
Can SAST find every vulnerability?
No. Business logic, complex authorisation problems and some vulnerabilities specific to the runtime environment may not be detected by SAST.
What is the difference between SAST and pentest?
SAST analyses source code statically. A pentest tests the running application from a real attacker's perspective. They are complementary, not alternatives.
Can SAST be integrated into a CI/CD pipeline?
Yes. SAST can be run automatically at commit, pull request, build and release stages.
What is a false positive?
It is when a SAST system reports as a vulnerability something that is not actually exploitable.
What is a false negative?
It is when a real vulnerability is not detected by the analysis system.
Conclusion: SAST Is the First Automated Checkpoint Between Code and Security
Given the amount of code modern software teams produce every day, performing all security analysis manually is not possible.
Security has to move at the same pace as software development.
SAST is one of the most important Application Security technologies answering that need.
It analyses source code without running the application.
It tries to understand where data comes from and where it goes.
It assesses source, sink and sanitizer relationships.
It performs control flow and data flow analysis.
It can show potential security problems to the developer far earlier than the production environment.
But the critical point to remember is this:
SAST is not the whole of a security programme.
SAST's real value emerges when it is used together with
Secure Coding,
SCA,
Secret Scanning,
manual source code analysis,
DAST,
pentesting
and DevSecOps processes.
Because secure software development is achieved not with a single tool but
with complementary layers of security.
Related Articles
Source Code Analysis (Code Security)

What Is Source Code Analysis? A Guide to SAST and Code Security
What is source code analysis, how does SAST work and why does code security come before infrastructure? Concepts, methods and enterprise approach.

Vulnerabilities Start While Code Is Written: Secure Coding and Secure SDLC
Vulnerabilities are not born in production; they are created in design and code. A guide to Secure Coding, Shift Left, DevSecOps and Secure SDLC.

Is SAST Enough on Its Own? Automated Scanning and Manual Source Code Review
What automated SAST can and cannot see: business logic flaws, false positives and negatives, and the role of manual code review.

Critical Vulnerabilities in Code: A CWE and OWASP Perspective
The most critical vulnerabilities in source code — injection, XSS, broken access control, SSRF and more — through the CWE and OWASP lens.

Secrets, API Keys and Sensitive Data Leaks: The Hidden Danger in Code Repositories
The invisible danger in code repositories: secret, API key and credential leaks — detection, rotation and secrets management.

Open Source Libraries and Software Supply Chain Security: An SCA and SBOM Guide
Open source dependencies are part of your attack surface: SCA, SBOM, transitive dependencies and supply chain attacks.
Looking for professional support on this topic?
Our expert team will reach out for a free consultation as soon as possible.