Find and Triage Code Risks with Static Application Security Testing (SAST)
Static application security testing (SAST) analyzes source code or supported intermediate representations without running the program to find potential security defects. It can reveal risky data flows or API use before release, but a scanner finding is not automatically an exploitable vulnerability. Check language and framework coverage, validate findings against code and runtime context, and track both confirmed defects and analysis gaps.
How SAST analyzes code
SAST tools use rules, patterns, semantic analysis or data-flow analysis to identify risk signals. For example, a data-flow analyzer may follow untrusted input from a source, through functions and variables, to a sink such as a SQL execution function or HTML response. File formats, build requirements, framework models and analysis depth vary by tool. The OWASP Developer Guide describes SAST as analysis without running the application and stresses that its output is a set of findings to review, not automatically confirmed vulnerabilities. OWASP Developer Guide: SAST
The following is an illustrative example of the idea. It does not guarantee that a real tool will apply the same rule or produce the same result.
def search_products(request):
phrase = request.args["q"] # external input (source)
sql = "SELECT * FROM products WHERE name = '" + phrase + "'"
return database.execute(sql) # SQL execution (sink)If an analyzer recognizes the framework request object as an input source and traces the concatenated string to SQL execution, it may flag a possible SQL injection path. A developer still needs to check whether execute is a safe parameterized wrapper, whether the data was validated or transformed earlier, and whether the code is reachable. If the issue is real, separate data from SQL syntax with a parameterized query and add a regression check consistent with the SQL injection prevention guide.
What can SAST find, and what can it miss?
SAST can quickly point to code locations and certain defect patterns, and it can run repeatedly in an IDE, code review or CI workflow. Source-only analysis is less able to decide whether a business authorization rule is correct, whether a deployed configuration is safe, or whether a path is exploitable in production. OWASP describes false positives and false negatives, and reduced coverage from frameworks, reflection, generated code and dynamic configuration, among its limitations. OWASP Developer Guide: limitations and complementary testing, OWASP Source Code Analysis Tools
| Method | Main target | Useful question | Main boundary |
|---|---|---|---|
| SAST | Source code or supported compiled/intermediate representations | Does this code path contain a risky data flow or API use? | May not fully understand runtime reachability, environment or business logic |
| DAST | Requests and observed responses from a running application | How does the deployed service handle a particular input? | Limited visibility into unvisited code and internal implementation context |
| SCA | Direct and transitive dependencies and component versions | Do used third-party packages have known vulnerabilities or policy issues? | Does not replace data-flow analysis of custom code |
| Manual code review | Human-readable code and design context |
Teams combine these methods to complement one another. SAST has a different role from SCA, which checks known risks in libraries; DAST tests behavior while the application runs; and manual review considers business rules and design context. None alone proves that all application code is secure. NIST SSDF practice PW.7 recommends deciding when to use code review and analysis, then recording and triaging findings and recommended fixes in the team workflow. That is why scanning should connect to code review and other verification. NIST SP 800-218, PW.7
Introduce SAST in a workflow that fits the team
The goal is not to maximize scan counts; it is to deliver important findings when developers can fix them and track the result. Start by understanding the codebase and build conditions. Establish a baseline on a small scope, then expand after checking feedback speed and analysis coverage.
**Define the analysis scope.** Inventory repositories, languages and frameworks, build methods, generated code, tests and example directories. Choose a representative module to check whether the tool actually reads and analyzes the needed files.
**Check language support and prerequisites.** Confirm support for the languages, frameworks, versions and libraries in use. Determine whether dependency installation or a successful build is required for accurate results. A broken build or omitted input can create an apparently clean scan that missed code. OWASP's selection criteria also include language and framework support, buildability, accuracy, IDE and CI integration, and output interoperability.
**Set a baseline and result format.** Do not treat every result from existing code as a newly introduced defect. Preserve location, rule, severity and analysis status in a baseline. Where supported, connect structured output to the team's issue tracker or code review system. SARIF, for example, is a format for exchanging static analysis results; verify support in both the tool and receiving system.
**Separate fast feedback from full analysis.** Use IDE or pull-request checks focused on changed code during development. At a scheduled time, analyze the full repository to inspect existing code and paths across modules. Document the scope and schedule of each job; do not assume incremental analysis replaces a full scan.
**Set blocking criteria gradually.** Initially observe results and send them to a review queue. After validating rules and risk levels, set gates that block selected new changes; reduce the existing baseline separately. Blocking every finding can create alert fatigue from false positives and old items. Having no criteria lets new defects recur.
**Triage findings with accountable owners.** Check the input source, transformations and validation, sink, reachable path, user impact and deployment context—not just the line number. For a real defect, assign an owner, priority and due date. Rerun the analysis after remediation to check whether the path was removed. For a false positive or currently unreachable path, record the evidence and scope so it can be reconsidered after updates.
**Review coverage gaps and outcomes.** Check analysis failures, unsupported modules, exclusions, unresolved findings and recurrence of fixed defects. Use DAST, manual review or other security tests for authorization, configuration and runtime scenarios that SAST does not cover. NIST SSDF gives the example of a person reviewing tool findings and taking needed corrective action. [NIST SP 800-218, PW.7.2](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-218.pdf)
How should you judge an individual finding?
Illustrative scenario: a pull-request scan reports that “external input reaches HTML output.” First check that the reported source and sink correspond to the actual framework code. Then determine whether data passes through a suitable sanitizer, whether it is escaped for its output context, and whether the page is reachable by a signed-in user or an external request. If context-specific sanitization is missing or bypassed, treat it as a defect, fix it and add regression verification. If the analyzer modeled the wrong source or wrapper, record the code evidence and classify it as a false positive; also ensure the configuration change does not hide other paths.
Distinguish a finding from a confirmed vulnerability. A finding is code evidence that matches an analysis rule. Confirmation requires assessing reachability, input control, existing defenses, environmental conditions and impact. Do not dismiss a finding solely because of its severity label or perceived tool reliability. OWASP and NIST both describe automated analysis as something to combine with review, triage and human verification.
Compare SAST tools using relevant criteria
Choose based on analysis quality in the actual repositories and the team's handling cost, not popularity or raw issue counts. OWASP lists language and framework support, false positives and negatives, build prerequisites, IDE and CI integration, licensing, and result formats among selection criteria. OWASP Source Code Analysis Tools
**Language and frameworks:** Does the tool support the versions and model the request, sanitization and output functions of the web framework in use?
**Analysis scope:** Does it analyze source, compiled output, changed files or the full codebase? How does it handle generated or dynamic code and cross-module flows?
**Accuracy and explainability:** Does a report show the rule rationale, code path and trust boundary? Can you assess missed coverage as well as false positives?
**Developer workflow:** Can people review results in the IDE, code review and CI? What effect do scan delays and failures have on work?
**Result handling and data protection:** Are formats and retention compatible with issue tracking and dashboards? Does the service upload source or results, and do deployment region, on-premises options and access controls meet requirements?
**Operating cost:** Is the combined effort for rule tuning, baseline management, review and updates sustainable?
You can compare tools using test code or past cases that were manually verified, but one sample score does not guarantee detection rates in a real project. Document selection criteria and exclusions. After tool or rule updates, confirm that representative cases are still detected.
Common failures and safe recovery
**The result suddenly shows zero findings.** Check that analysis actually ran and that target paths, builds and language settings were not omitted. Distinguish “no findings” from “analysis completed successfully.”
**There are too many false positives.** Avoid a blanket suppression list. Review recurring rules, common wrappers and input paths to improve the model. Record suppression rationale, scope and reviewer, and set a review date.
**Pull requests take too long or are always blocked.** Separate changed-file checks from full analysis and prioritize important rules for fast feedback. Run full analysis on a schedule, routing failures and results to the security owner.
**The same defect appears in multiple files.** Look beyond line-by-line fixes to shared APIs, framework configuration, safe wrappers and training. A verified pattern can inform a new rule or template, but check representative code to avoid overblocking.
**A clean SAST run is treated as release approval.** Separately verify runtime configuration, authentication and authorization rules, dependencies and operational paths with methods suited to them. A scan is evidence that supports security testing and review, not proof that an application has no vulnerabilities.
SAST is most useful when it quickly narrows the code and evidence that people need to review, and repeatedly checks code that needs fixing within the development workflow. Reliable operation depends on managing analysis scope and gaps instead of treating tool output as an automatic verdict.