SAST in CI/CD pipelines
Semgrep has a clear lead for SAST in CI/CD pipeline scanning.
Since Jul 6Updated Nov 10, 2026Based on 112 AI answers
Reviewed by Dimitry Apollonsky
Brands AI mentions
Lightweight, fast SAST with custom rules for pull requests.
Static analysis and security scanning with CI integrations and quality gates.
Code analysis in GitHub Actions with support for custom queries.
Enterprise static analysis with incremental scanning in CI/CD workflows.
Also mentioned rarely: Snyk Code, GitHub Advanced Security, GitHub Actions, GitLab CI, Veracode, Gitlab · gitlab.io, Checkmarx One, Jenkins, GitLab · gitlab.com, GitHub, Snyk, OpenText Fortify, Atlassian, Bitbucket Cloud, SonarCloud, Sonarsource, Azure DevOps, CircleCI, Bandit, Veracode Static Analysis, GitHub Gist, OWASP, Black Duck, Contrast Security, Black Duck Coverity, gosec, Slack, GitLab CI Security, Aikido, Jira Software, Bearer, Bitbucket, Buildkite, Checkmarx CxSAST, Visual Studio Code, Renovate, Fortinet, GitHub Issues, Semgrep GitHub Action, Dependabot, JetBrains, Kubernetes, OpenText Fortify Static Code Analyzer, OpenText, OX Security, pre-commit, SonarQube for IDE, Terraform
- SemgrepChatGPTGoogle AI Mode
- SonarQubeChatGPTGoogle AI Mode
- CodeQLChatGPTGoogle AI Mode
- CheckmarxChatGPTGoogle AI Mode
- GitLab SASTChatGPTGoogle AI Mode
It depends
- Asked in generalSemgrep
- For CI/CD integrationSonarsource
- For a DevOps engineerSemgrep
Questions and answers
Google AI ModeNov 2, 2026
Integrating Static Application Security Testing (SAST) into your CI/CD pipeline helps catch vulnerabilities early in the development lifecycle before they reach production. Modern implementations leverage hybrid approaches (
combining deterministic rules with AI-driven or LLM-based findings analysis to minimize false positives).Step-by-Step Integration Strategy
- Choose the Right Insertion Point
- Pre-commit / IDE Level (Shift-Left): Use local plugins or lightweight linters to catch syntax and basic security flaws before code is even committed.
- Pull Request / Commit Stage: Trigger incremental or differential scans on the specific files changed in a pull request for rapid developer feedback.
- Build / Post-Build Stage: Run deep, comprehensive full-codebase scans asynchronously or in parallel with other checks (like unit tests and software composition analysis) to avoid blocking the core build pipeline.
- Select and Configure Your SAST Tool
- Integrate an enterprise-grade platform (such as Checkmarx One or native GitHub/GitLab security scanners) via official CLI actions, plugins, or API integrations.
- Fine-tune the rulesets to match your technology stack, and leverage modern hybrid analysis engines that filter out false positives automatically before alerting developers.
- Define Pass/Fail Thresholds (Quality Gates)
- Avoid breaking builds for low-severity or unverified findings, which leads to alert fatigue.
- Set explicit threshold policies (e.g., fail the pipeline only on unmitigated Critical or High severity vulnerabilities verified as true positives).
- Handle Results and Feedback Loops
- Configure the pipeline to push vulnerability reports directly into developer dashboards, pull request comments, or issue-tracking tools (like Jira).
- Implement a clear triage workflow so developers can easily mark false positives or generate automated remediation guidance.
If you'd like to dive deeper, let me know:
- What CI/CD orchestration tool are you using (e.g., GitHub Actions, GitLab CI, Jenkins)?
- What is your primary programming language or tech stack?
I can provide a custom pipeline configuration template tailored to your environment.
Pages cited in this answer2
ChatGPTNov 2, 2026
How to integrate SAST into CI/CD pipelines
Static Application Security Testing (SAST) is a security testing technique that analyzes source code, bytecode, or application binaries without executing the application. Integrating SAST into your CI/CD pipeline helps detect security vulnerabilities early in the software development lifecycle (SDLC), ideally before code reaches production.
The recommended approach is to make SAST an automated part of your development workflow, with security checks running on every pull request and build.
1. Understand where SAST fits in CI/CD
A typical DevSecOps pipeline looks like this:
1. Developer commits code
Git push or pull request
2. Build and dependency checks
Compile, resolve dependencies
3. SAST security scanning
Analyze source code for vulnerabilities
4. Security policy evaluation
Evaluate severity and quality gates
5. Deploy or reject
Proceed if security requirements are satisfied
This approach catches vulnerabilities before they become part of a production release.
2. Choose a SAST tool
Popular tools include:
Tool Best suited for CI/CD integration GitHub CodeQL GitHub repositories and semantic code analysis GitHub Actions Semgrep Fast, customizable static analysis GitHub Actions, GitLab, Jenkins SonarQube Code quality and security analysis Jenkins, GitHub Actions, GitLab GitLab SAST GitLab-native security scanning GitLab CI/CD Checkmarx Enterprise application security Multiple CI/CD platforms Choose based on your programming languages, repository platform, licensing, reporting requirements, and desired scanning depth.
3. Integrate SAST into your pipeline
Here are two common implementation examples.
Option A: GitHub Actions with CodeQL
CodeQL can analyze supported programming languages and publish security findings through GitHub code scanning.
Example workflow:
yamlname: SAST Security Scan on: push: branches: [main] pull_request: branches: [main] permissions: contents: read security-events: write jobs: codeql: name: CodeQL Analysis runs-on: ubuntu-latest permissions: contents: read security-events: write steps: - name: Checkout source uses: actions/checkout@v4 - name: Initialize CodeQL uses: github/codeql-action/init@v4 with: languages: javascript, python - name: Build application run: | echo "Run your project build here" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4Replace the example languages with those supported and used by your application. Configure the build step appropriately for compiled languages.
The workflow runs analysis on pushes and pull requests, allowing security findings to be reviewed during development.
Option B: GitLab CI/CD
GitLab provides a built-in SAST template.
Add the following to your
.gitlab-ci.yml:yamlstages: - build - test - deploy include: - template: Jobs/SAST.gitlab-ci.yml build: stage: build script: - echo "Building application"GitLab automatically adds the relevant SAST jobs for supported source languages.
You can then review the findings through GitLab's security reporting features.
Source:
4. Configure security gates
One of the most important steps is deciding what happens when SAST identifies a vulnerability.
Avoid blocking every build for every finding. Instead, define severity-based policies.
A practical starting policy:
Finding severity Recommended action Critical Block merge or release High Block merge for new confirmed findings Medium Create remediation task Low Track and address through backlog You should also:
- Prioritize newly introduced vulnerabilities.
- Establish remediation deadlines.
- Allow documented exceptions with an owner and expiration date.
- Review false positives before suppressing findings.
This reduces alert fatigue while maintaining meaningful security controls. OWASP recommends risk-based gates and baselining existing findings.
5. Publish and manage scan results
SAST should not simply execute and disappear into pipeline logs.
Integrate findings into:
- Pull request or merge request comments.
- Security dashboards.
- Issue tracking systems such as Jira.
- Centralized vulnerability management platforms.
- Notifications to development and security teams.
Where supported, use SARIF (Static Analysis Results Interchange Format) to standardize security findings across tools.
docs.gitlab.comowasp.github.ioowasp.github.iocheatsheetseries.owasp.orgowasp.org
6. Follow SAST integration best practices
For a reliable implementation, consider these recommendations:
- Shift security left: Run lightweight scans during development and comprehensive scans in CI.
- Scan every pull request: Identify vulnerabilities before code is merged.
- Use incremental scanning: Focus on newly introduced findings while maintaining periodic full-codebase scans.
- Reduce false positives: Tune rules and validate important findings.
- Secure CI/CD credentials: Use secrets management and least-privilege pipeline permissions.
- Protect the pipeline itself: Review pipeline configuration, isolate build runners, and pin third-party actions or dependencies to trusted versions.
- Monitor continuously: Update scanning rules and periodically evaluate coverage.
OWASP also recommends combining SAST with software composition analysis (SCA), secret scanning, infrastructure-as-code scanning, and dynamic testing.
7. Recommended end-to-end implementation
A mature DevSecOps pipeline should look something like this:
Pipeline stage Security activity Developer workstation IDE security checks Pre-commit Lightweight SAST Pull request Automated SAST and secret scanning Build SAST and dependency scanning Staging DAST and container scanning Release Security policy validation Production Continuous security monitoring 8. How to measure success
Track these metrics to determine whether your integration is effective:
- Number of vulnerabilities detected per release.
- Mean time to remediate (MTTR).
- Percentage of repositories covered by SAST.
- Number of critical and high-severity findings.
- False-positive rate.
- Percentage of builds passing security gates.
Useful documentation
Here are some resources to help implement this:
- urlOWASP SAST Integration Guidelinesturn120149search3
- urlGitLab SAST Documentationturn120149search1
- urlOWASP Static Analysis Overviewturn120149search5
- urlOWASP CI/CD Security Cheat Sheetturn120149search9
- urlOWASP DevSecOps Guidelinesturn120149search4
My recommendation
If you're starting from scratch, I recommend this implementation strategy:
- Start with Semgrep or CodeQL.
- Integrate scanning into pull requests.
- Generate security reports automatically.
- Introduce blocking policies for new critical and high-severity findings.
- Expand to SCA, secret scanning, and DAST.
- Centralize security reporting.
One question: Which CI/CD platform are you currently using?
- GitHub Actions
- GitLab CI/CD
- Jenkins
- Azure DevOps
- Bitbucket Pipelines
- Other
I can provide a practical, step-by-step SAST integration example with pipeline configuration, security gates, and reporting for your platform.
Pages cited in this answer6
- docs.gitlab.comStatic application security testing (SAST) | GitLab Docs
- owasp.github.ioStatic Application Security Testing (SAST) - OWASP DevSecOps Guideline
- owasp.github.ioOverview - OWASP DevSecOps Guideline
- cheatsheetseries.owasp.orgCI CD Security - OWASP Cheat Sheet Series
- owasp.orgOWASP DevSecOps Guideline | OWASP Foundation
- devguide.owasp.orgOverview - OWASP Developer Guide
- Choose the Right Insertion Point
ChatGPTOct 12, 2026
How to integrate SAST into CI/CD
Static Application Security Testing (SAST) is a security practice that analyzes source code, bytecode, or intermediate representations for vulnerabilities without executing the application. Integrating SAST into your Continuous Integration and Continuous Deployment (CI/CD) pipeline helps you identify security issues early, prevent vulnerable code from reaching production, and make security part of everyday development.
The best approach is to run lightweight scans on every pull request, more comprehensive scans during builds, and enforce risk-based security gates before deployment.
1. Design your SAST-enabled pipeline
1. Developer commits code
Push branch or open pull request
2. Automated SAST scan
Analyze changed code and relevant dependencies/configuration
3. Evaluate findings
Severity, exploitability, confidence, and existing exceptions
Pass
Merge, build, and continue pipeline
Fail
Block merge or deployment; fix or approve a documented exception
4. Deploy and monitor
Publish artifacts, retain reports, and track remediation
A key principle: run security checks early, provide actionable feedback quickly, and make blocking rules proportional to risk.
2. Choose a SAST tool that fits your stack
The right choice depends on your programming languages, CI/CD platform, budget, and whether you need centralized reporting.
GitHub CodeQL
Best for GitHub-centric teams that want code analysis integrated into pull requests, security alerts, and branch protection. Supports customizable workflows and scheduled scanning.
Documentation:
GitLab SAST
Best if your repositories and pipelines already run in GitLab. It provides CI/CD templates, analyzer jobs, and downloadable security reports.
Documentation:
Semgrep
A good option for teams wanting customizable rules and fast feedback in code review. It can also be integrated into external CI systems.
Documentation:
SonarQube
Useful when you want code quality, maintainability, and security findings managed together, with quality gates in CI/CD.
Documentation:
Check each tool's current language support, licensing, and security features before standardizing on it.
3. Add SAST to your pipeline
Here are two practical implementations.
Option A: GitHub Actions with CodeQL
GitHub offers a default setup that automatically selects supported languages and runs scans on relevant pushes and pull requests. Use advanced setup when you need more control over builds, languages, queries, or schedules.
For a standard repository, enable code scanning through:
- Open your repository's Settings.
- Navigate to Security and quality or the code security settings.
- Enable CodeQL code scanning using default setup, or select advanced setup to generate a customizable workflow.
- Review the initial scan results.
- Configure branch protection to require the relevant checks before merging.
Official guide: Configure CodeQL advanced setup.
Option B: GitLab CI/CD
For an existing GitLab project, you can add the SAST template to
.gitlab-ci.yml:yamlstages: - build - test - deploy include: - template: Jobs/SAST.gitlab-ci.yml build: stage: build script: - echo "Replace with your build commands" # The included template defines SAST analyzer jobs. # Configure deployment separately and make it # depend on the required security checks.This is a starting point, not a complete production pipeline. Ensure your existing stages, build dependencies, and analyzer configuration are compatible with the template. GitLab's official documentation explains supported analyzers and customization.
4. Establish security gates
Not every finding should block every build. Start with a clear, documented policy.
Finding or condition Recommended response New critical or high-severity vulnerability Block merge or release until fixed or formally excepted Medium-severity finding Require remediation within a defined timeframe; block when risk warrants it Low-severity finding Track and address through normal remediation work Existing, previously accepted finding Track against a baseline and review its exception periodically Scanner failure or incomplete analysis Fail closed for high-risk release pipelines, or explicitly prevent release until scanning completes These are recommended starting policies, not universal severity rules. Adapt them to exploitability, exposure, application criticality, and your organization's risk tolerance.
Important: Distinguish a successful scan that found vulnerabilities from a scan that failed to run. A scanner crash, timeout, or missing report must not be treated as proof that the code is secure.
5. Make the scans fast and actionable
The biggest challenge in SAST adoption is often developer friction, rather than enabling the scanner itself.
Use these practices:
- Scan pull requests: Report findings alongside the changed lines so developers can fix them immediately.
- Baseline legacy findings: Initially focus blocking rules on new vulnerabilities, then progressively reduce the existing backlog.
- Tune rules carefully: Remove demonstrable false positives through documented, reviewed exceptions rather than disabling broad categories of checks.
- Optimize performance: Use incremental analysis or caching when supported, and reserve deeper scans for scheduled builds or release candidates.
- Secure the scanner environment: Pin third-party CI actions and scanner images to trusted versions, restrict token permissions, and avoid exposing secrets to untrusted pull-request code.
- Preserve reports: Retain scan results as artifacts or send them to a centralized vulnerability management system.
GitLab supports report artifacts and analyzer customization, while GitHub supports both integrated and external code scanning.
6. Combine SAST with other security controls
SAST is one part of a secure delivery process. It cannot detect every runtime or infrastructure vulnerability.
OWASP's DevSecOps guidance recommends progressively integrating these controls into the software delivery lifecycle, rather than relying on one scanner.
7. Roll out in stages
A phased rollout helps establish a useful baseline without overwhelming developers.
- Week 1 — Assess and baseline. Identify languages, repositories, build systems, critical applications, and the SAST tool that best fits.
- Week 2 — Integrate and observe. Run scans on pull requests and the main branch. Measure scan duration and validate findings without initially blocking all merges.
- Week 3 — Enforce gates. Require successful scans and block newly introduced critical or high-risk findings, with a documented exception process.
- Week 4 onward — Improve. Expand coverage, review exceptions, reduce legacy findings, and monitor remediation trends.
Track metrics such as repository coverage, time to remediate critical findings, false-positive rate, scan duration, and the number of newly introduced vulnerabilities.
For a broader secure-development framework, use the NIST Secure Software Development Framework as a reference: NIST SP 800-218.
Let's tailor this to your CI/CD environment
I can provide a more specific implementation, including a working pipeline configuration and security-gate rules. Which platform are you using?
CI/CD platform
GitHub Actions
GitLab CI/CD
Jenkins
Azure DevOps
Other
Primary programming language
JavaScript / TypeScript
Python
Java / Kotlin
C / C++ / C#
Go / Rust
Multiple languages
Security enforcement goal
Block new critical/high findings
Report findings without blocking initially
Enforce compliance and audit requirements
Deployment environment
Cloud / containers
On-premises
Hybrid
[Generate my implementation plan]
Pages cited in this answer12
- docs.github.comCode scanning with CodeQL - GitHub Docs
- docs.github.comConfiguring advanced setup for code scanning - GitHub Docs
- docs.github.comAbout setup types for code scanning - GitHub Docs
- docs.github.comFind and fix code vulnerabilities - GitHub Docs
- docs.gitlab.comStatic application security testing (SAST) | GitLab Docs
- docs.gitlab.comSAST analyzers | GitLab Docs
- semgrep.devSemgrep Docs - Semgrep
- docs.sonarsource.comHomepage | SonarQube Server | Sonar Documentation
- docs.github.comIntegration with code scanning - GitHub Docs
- docs.github.comSecure use reference - GitHub Docs
- owasp.orgOWASP DevSecOps Guideline | OWASP Foundation
- csrc.nist.govSP 800-218, Secure Software Development Framework (SSDF) Version 1.1: Recommendations for Mitigating the Risk of Software Vulnerabilities | CSRC
Google AI ModeOct 12, 2026
- Phase Selection : Choose the right stage in your pipeline. SAST is typically run early during the build or test phase, right after code is committed or a pull request is opened, to provide immediate feedback to developers.
- Tool Integration : Select a SAST tool that supports your programming languages and integrates natively with your CI/CD platform (such as GitHub Actions, GitLab CI, Jenkins, or Bitbucket Pipelines).
- Baseline and Configuration : Run an initial scan to establish a baseline. Tune the ruleset to filter out false positives and focus on critical or high-severity vulnerabilities to avoid developer fatigue.
- Build Gate Policy : Define thresholds for build failure. Decide whether the pipeline should fail automatically upon finding high-severity vulnerabilities or if it should merely log warnings for non-blocking reviews.
- Developer Feedback Loop : Ensure vulnerability reports are routed directly into developer workflows (like pull request comments, security dashboards, or issue trackers such as Jira) with clear remediation guidance.
If you'd like, let me know:
- Which CI/CD platform you are using (GitHub, GitLab, Jenkins, etc.)
- What programming languages your project uses
- Whether you want the scan to block builds or just report issues initially
I can provide a tailored setup guide or configuration example for your stack.
ChatGPTOct 13, 2026
If you need a Static Application Security Testing (SAST) tool that integrates into your CI/CD pipeline, I’d focus on tools that automatically scan source code during pull requests and builds, identify vulnerabilities before deployment, and let you enforce security gates.
The best choice depends on your programming languages, CI/CD platform, budget, and whether you want a managed commercial product or an open-source solution.
SAST tools worth evaluating
1. Semgrep
(Best starting point)
Good for teams that want fast scans, customizable security rules, and integration with multiple CI/CD platforms. Supports GitHub Actions, GitLab CI/CD, and Jenkins, including pull-request feedback. The open-source engine is available, while deeper security analysis is offered through the commercial platform.
Explore:
2. GitHub CodeQL
Best if your source code is hosted on GitHub and you want code scanning integrated into repository workflows. It identifies security vulnerabilities through semantic analysis and can report findings directly in GitHub. Access for private repositories depends on the applicable GitHub plan and security licensing.
Explore:
3. SonarQube
Best if you want code quality and security checks in the same pipeline. Supports GitHub Actions, GitLab CI/CD, Jenkins, Azure Pipelines, and Bitbucket Pipelines. Quality gates can fail a pipeline when configured thresholds are not met. Some pull-request features depend on edition.
Explore:
4. Snyk Code
Worth evaluating if developers need actionable vulnerability findings during coding and pull-request reviews, especially alongside dependency and container security in a broader developer security workflow.
Explore:
5. Checkmarx One
Worth evaluating for enterprise application security programs that need centralized policies, broad application security coverage, and governance across multiple teams and repositories.
Explore:
Quick comparison
Tool Best fit CI/CD integration Semgrep Fast, customizable SAST GitHub, GitLab, Jenkins CodeQL GitHub-centric security GitHub Actions, external CI SonarQube Quality plus security gates GitHub, GitLab, Jenkins, Azure, Bitbucket Snyk Code Developer-focused security CI workflows and pull requests Checkmarx One Enterprise security governance Enterprise CI/CD workflows The integrations above are supported by the vendors' documented workflows; verify specific language coverage, edition requirements, and licensing before selecting a tool.
How I would implement SAST in a CI/CD pipeline
A practical initial setup looks like this:
1. Developer opens a pull request
GitHub, GitLab, or Bitbucket
2. CI/CD runs SAST
Scan source code for security vulnerabilities
3. Evaluate findings
Report issues and prioritize severity
4. Enforce a security gate
Block merges for qualifying new critical or high-severity findings
My initial recommendation is Semgrep for flexibility, CodeQL for GitHub-native analysis, or SonarQube if code quality is also a priority.
Let me narrow it down
Which CI/CD platform are you using?
1. CI/CD platform
GitHub Actions
GitLab CI/CD
Jenkins
Azure DevOps
Bitbucket Pipelines
Other or multiple platforms
2. Budget preference
Open-source or free
Commercial
Compare both
3. Programming languages
Java
C# / .NET
JavaScript / TypeScript
Python
C / C++
Multiple languages
4. Deployment requirements
Cloud or SaaS is acceptable
Self-hosted or on-premises required
Either
[Compare the best-fit tools]
Pages cited in this answer11
- semgrep.devSample continuous integration (CI) configurations - Semgrep
- github.comGitHub - semgrep/semgrep: Lightweight static analysis for many languages. Find bug variants with patterns that look like source code. · GitHub
- docs.github.comAbout setup types for code scanning - GitHub Docs
- docs.github.comCode scanning with CodeQL - GitHub Docs
- docs.github.comFind and fix code vulnerabilities - GitHub Docs
- docs.sonarsource.comOverview | SonarQube Server 2025.3 | Sonar Documentation
- docs.sonarsource.comOverview | SonarQube Community Build | Sonar Documentation
- docs.sonarsource.comCI tools | SonarQube Server | Sonar Documentation
- snyk.ioSnyk Code | SAST Code Scanning Tool | Code Security Analysis & Fixes | Snyk
- checkmarx.comAgentic Application Security Testing Software Platform | Checkmarx
- graphnodesoftware.comSAST Tools: The Complete Buyer's Guide for 2026
Google AI ModeOct 11, 2026
Integrating a Static Application Security Testing (SAST) tool into your CI/CD pipeline
helps catch vulnerabilities before code merges. The right choice depends heavily on your pipeline speed requirements, language stack, and team size.Top options for CI/CD integration vary by their core strengths:
- Semgrep : Best for speed and lightweight pipeline scans. It features fast execution times, a massive community rule base, and simple YAML-based custom rules that plug easily into GitHub Actions, GitLab CI, or Jenkins in minutes.
- Snyk Code : Best for developer-first workflows. It provides rapid, semantic analysis with inline IDE feedback and actionable pull request checks that can block insecure merges.
- SonarQube : Best for balancing code quality and security metrics. It offers robust automated code reviews, an intuitive dashboard, and extensive language support embedded directly into DevOps platforms.
- Checkmarx One : Best for complex enterprise architectures. It provides uncompiled source code analysis, deep compliance coverage, and a comprehensive cloud-native AppSec suite.
- Aikido Security : Best for teams prioritizing low noise. It uses contextual filtering and AI triage to minimize false-positive alerts in fast-paced engineering environments.
If you'd like, let me know:
- Which CI/CD platform you are using (GitHub Actions, GitLab, Jenkins, Bitbucket, etc.)
- Your primary programming languages or frameworks
- Whether you prefer an open-source/lightweight tool or an enterprise platform
I can help you narrow down the selection or draft a sample pipeline configuration file.
Also asked as
- How do I incorporate static analysis security testing into existing CI/CD pipelines?
- What is the best CI/CD pipeline security scanner to integrate into an existing build pipeline for a DevOps engineer?
- which DevSecOps security provider should I use?