SAST - Static Application Security Testing
Automated detection of security vulnerabilities directly in source code - find and fix issues before they reach production.

What is SAST?
SAST (Static Application Security Testing) is an application security testing method that analyzes source code, bytecode, or binary files without the need to run the application. SAST tools identify security vulnerabilities and issues in code during the development phase, so you can fix them before they reach production.
How SAST Works
SAST tools analyze source code using a combination of static analysis techniques. The process involves parsing the code, building an abstract syntax tree (AST), and then performing data flow analysis and pattern matching against known security patterns.
Source Code Analysis
The SAST tool parses the source code and builds an abstract syntax tree (AST) that represents the program structure.
Data Flow Analysis
The tool traces the flow of data through the application and identifies paths through which untrusted data can reach sensitive functions.
Pattern Matching
The code is compared against a database of known security patterns and anti-patterns (e.g., SQL injection, XSS, hardcoded secrets).
Report Generation
A detailed report is generated with discovered vulnerabilities, including severity, CWE classification, location in the code, and remediation recommendations.
Example: SQL Injection Detection
Popular SAST Tools
SonarQube
Code quality and security platform. According to the documentation, the free Community Build analyzes 22 languages; others (e.g. C/C++, COBOL) require the paid SonarQube Server and Cloud editions.
- Detailed dashboards and code quality metrics
- Quality Gates for automated blocking
- Integration with GitHub, GitLab, Azure DevOps
- Free SonarQube Community Build
Checkmarx SAST
Enterprise SAST, part of the Checkmarx One platform. CxSAST is available for on-premises deployment.
- Advanced data flow analysis
- Cloud (Checkmarx One) and on-premises (CxSAST)
- Java, C#, Go, Python, COBOL, PL/SQL and more
- SOC 2 Type II and ISO/IEC 27001 certified
Semgrep
Fast and flexible SAST tool with support for custom rules and IaC scanning. The open source engine is called Semgrep Community Edition (CE).
- Native GitLab SAST report output (
--gitlab-sast) - Easy custom rule creation
- Support for IaC security scanning
- Semgrep CE is free under the LGPL-2.1 license
GitHub CodeQL
Semantic analysis using QL queries with native GitHub Actions integration.
- Semantic analysis using QL queries
- Native integration with GitHub Actions
- Free for public repositories; private ones need GitHub Code Security (Team or Enterprise plan)
- Copilot Autofix suggests fixes for alerts
Veracode SAST
SAST service that scans both source code and compiled binaries, so it also covers third-party code without source files.
- Source, binary and hybrid scanning
- Policy-based reporting
- Policy checks directly in the CI/CD build
- AI remediation with Veracode Fix
Snyk Code
Scanning directly in the IDE with automatic fixes from Snyk Agent Fix (formerly DeepCode AI Fix).
- Plugins for VS Code, Visual Studio and JetBrains IDEs
- Snyk Agent Fix suggests fixes for findings
- Developer-friendly UX
- Integration with Snyk Open Source (SCA)
Integrating SAST into the CI/CD Pipeline
GitLab CI/CD Pipeline
GitHub Actions Workflow
Best Practice: Security Gates
Configure quality gates in your CI/CD pipeline that automatically block deployment when the SAST tool finds vulnerabilities above a certain severity threshold (e.g., Critical or High).
Benefits and Challenges of SAST
Benefits of SAST
- Early detection: Vulnerabilities are discovered during development, not in production
- Cheaper fixes: A bug found during development needs no hotfix, new release or incident response
- Full code coverage: SAST analyzes the entire codebase, not just commonly used paths
- Automation: Scanning runs automatically on every commit/merge
- Developer education: Developers learn secure coding practices from reports
- Compliance: Helps demonstrate secure development under NIST SSDF (practice PW.7, code review and analysis), PCI DSS 4.0.1 (requirement 6.2) and NIS2
Challenges and Limitations
- False positives: SAST may report vulnerabilities that are not actual threats; OWASP lists high numbers of false positives as the main weakness
- Configuration and tuning: Requires time to properly configure rules. SAST often misses environment misconfigurations because they are not in the code
- Runtime vulnerabilities: SAST cannot detect issues that only manifest at runtime (DAST covers this)
- Triage overhead: Developers must evaluate and prioritize findings
- Legacy code: In older codebases, SAST may discover thousands of issues at once
SAST vs DAST
SAST (White-box): Analyzes source code including rarely used paths, but generates more false positives.
DAST (Black-box): Tests the running application, finds runtime issues, but has limited coverage.
Best approach: Combining SAST + DAST + SCA = comprehensive security testing.
Implementation Guide
Phase 1: Tool Selection
Choose a SAST tool based on:
- Supported programming languages
- Integration with your CI/CD tools
- Licensing costs (open source vs commercial)
- False positive rate (trial test on your codebase)
Phase 2: Pilot Project
Start with a single project or team:
- Run a baseline scan
- Resolve critical and high severity issues
- Set up quality gates
- Measure metrics (number of findings, time to fix)
Phase 3: Scaling
Expand across the organization:
- Establish a central security team for triage
- Define SLAs for remediation (e.g., Critical: 7 days, High: 30 days)
- Integrate with your ticketing system (Jira)
- Regular reporting for management
Phase 4: Optimization
Continuous improvement:
- Rule tuning to reduce false positives
- Create custom rules
- Developer training on secure coding
- Automate remediation using auto-fix features
Sources
- MITRE: 2025 CWE Top 25 Most Dangerous Software Weaknesses (December 2025)
- OWASP: Source Code Analysis Tools (October 2026)
- NIST: SP 800-218, Secure Software Development Framework (SSDF) 1.1 (February 2022)
- Semgrep Docs: CLI reference (October 2026)
- GitLab Docs: Security scanner integration (October 2026)
- GitHub: github/codeql-action releases (v4.39.0) (October 2026)
- GitHub: actions/checkout releases (v7.0.1) (July 2026)
- GitHub Docs: Workflow configuration options for code scanning (October 2026)
- GitHub Docs: About GitHub Advanced Security (October 2026)
- Sonar Docs: SonarQube Community Build, Languages overview (October 2026)
- Snyk Docs: Fix code vulnerabilities automatically (October 2026)
- Checkmarx: Checkmarx SAST (October 2026)