DevOpsintermediate

Semgrep vs CodeQL

Semgrep vs CodeQL compared for 2026: Semgrep 1.186 with its LGPL Community Edition engine, code-like YAML rules and a free tier for 10 contributors vs CodeQL 2.27 as GitHub's semantic code analysis with a database-and-query model, free on public repos and $30 per active committer for private code. Includes a test we ran on the same Flask app, licence terms for the CLI and rules, build modes, language coverage, pricing at team scale and a clear pick per situation.

Quick Answer

Semgrep and CodeQL are both static analysis (SAST) tools that find injection bugs and insecure patterns, but they are built differently and licensed very differently. Semgrep matches rules that look like the code you write; its Community Edition engine is LGPL-2.1 and runs anywhere, and the paid Semgrep Code adds cross-file taint analysis and proprietary Pro rules (free for up to 10 contributors and 10 private repos, then $30 per contributor per month). CodeQL (CLI 2.27.4, 2 November 2026) extracts your code into a database and runs queries written in the QL language; the queries are MIT, but the CLI is free only for open-source code, research and demos, so private repositories need GitHub Code Security at $30 per active committer per month on a Team or Enterprise plan. In our test on a 3-file Flask app, CodeQL's default Python suite found all 3 planted injections with data-flow paths, including one across files; Semgrep CE with 371 community rules found 2 of the 3 plus an audit-level duplicate, and a 12-line custom rule caught the cross-file case in 1.7 seconds. Pick CodeQL on GitHub when you want deep default findings with no rule writing; pick Semgrep when you are not on GitHub, want to write your own rules fast, or need private-code scanning without GitHub's licence.

Last updated November 18, 2026. Covers Semgrep 1.186.0 (18 November 2026) with the current pricing page, docs (supported languages, Semgrep vs CE, CodeQL comparison, CI, Pro engine) and the Semgrep Rules License, against CodeQL CLI 2.27.4 (2 November 2026) with GitHub's supported languages, CodeQL Terms, build modes, default setup, Advanced Security and billing docs and the GitHub security plans page, all read on 18 November 2026, plus a test we ran on the same app the same day.

Feature comparison of Semgrep vs CodeQL
FeatureSemgrepCodeQL
Engine Licence
Semgrep CE engine: LGPL-2.1; Pro engine and platform: proprietary
CLI under GitHub CodeQL Terms (free for OSS, research, demos); not open source
Rules / Queries Licence
Registry rules: Semgrep Rules License v1.0 (internal use only); Pro rules proprietary
Standard queries and libraries in github/codeql: MIT
Analysis Model
Pattern matching on parsed source, with semantic and taint analysis
Code extracted to a database, then queried with QL
Writing Custom Rules
YAML rules with code-like patterns, metavariables and taint mode
QL, an object-oriented logic query language, organised in packs
Dataflow & Taint Depth
CE: single-function taint, single-file constant propagation; Semgrep Code: cross-file for C#, Go, Java, JS, TS, Kotlin, Python, C/C++
Interprocedural, cross-file dataflow and taint tracking in the standard libraries
Languages
35+ for Semgrep Code (GA and beta), plus experimental languages such as Bash, Dockerfile, Solidity, YAML
C/C++, C#, Go, Java, Kotlin, JavaScript/TypeScript, Python, Ruby, Rust, Swift, GitHub Actions workflows
Needs a Build?
No, scans source directly
none for C#, Java, JS/TS, Python, Ruby; autobuild or manual for C/C++, C#, Go, Java/Kotlin, Swift
Where It Runs
CLI, any CI, GitHub, GitLab, Bitbucket, Azure; managed scans; VS Code and JetBrains
GitHub code scanning (GitHub.com, GHE.com, GHES); CLI anywhere, with results uploaded as SARIF
CI Integration
semgrep scan (CE) or semgrep ci (platform) in any CI system
codeql-action on GitHub Actions or default setup; CLI in other CI with a licence
PR Feedback
PR/MR comments via the platform; CE outputs SARIF for your CI to surface
Native code scanning alerts and annotations in GitHub pull requests
Output Formats
Text, JSON, SARIF, JUnit XML, GitLab SAST and secrets, Emacs, Vim
SARIF 2.1.0, CSV, graph text
AI Triage & Fixes
Semgrep Assistant: AI detection, triage and autofix (60 credits free, 20 per developer per month on Teams)
Copilot Autofix; AI Scan and agentic autofix consume Code Security AI credits
Dependency Scanning (SCA)
Semgrep Supply Chain with reachability, 14 languages
Not in CodeQL; GitHub's dependency graph, Dependabot and dependency review
Secret Scanning
Semgrep Secrets with validation ($15 per contributor per month)
Not in CodeQL; GitHub Secret Protection ($19 per active committer per month)
Free Use
CE free for any use; platform free for up to 10 contributors and 10 private repos
Public repos on GitHub.com; OSI-licensed codebases; academic research and demos
Paid Price
Teams from $30 per contributor per month (Code); Enterprise custom
GitHub Code Security $30 per active committer per month (Team or Enterprise plan)
Where Code Is Processed
Locally or in your CI; managed scans clone the repo per scan; AI features send part of the file
GitHub Actions runners or wherever you run the CLI
Install Footprint
pip or Homebrew install, or the semgrep/semgrep Docker image
CodeQL bundle 696 MB download, about 1.4 GB unpacked (linux64, 2.27.4)
Forks & Alternatives
Opengrep, an LGPL-2.1 fork compatible with Semgrep rules (2.0.0, 13 November 2026)
Semgrep, Opengrep, SonarQube and others can upload SARIF to GitHub code scanning
Latest Release (Nov 2026)
1.186.0 (18 November 2026)
CLI 2.27.4 (2 November 2026); codeql-action v4.39.3 (4 November 2026)

Semgrep

Semgrep is a static analysis tool from Semgrep, Inc. Its open-source Community Edition (CE) engine parses 35+ languages and matches YAML rules written as code patterns, with metavariables and taint mode. The commercial Semgrep AppSec Platform adds Semgrep Code (cross-file and cross-function analysis with Pro rules), Supply Chain (SCA with reachability), Secrets, managed scans and AI triage.

Pros

  • Rules look like the code they match, so a developer can write and test a custom rule in minutes
  • CE engine is LGPL-2.1 and runs locally or in any CI on any Git host, with no build step
  • Free tier covers up to 10 contributors and 10 private repositories, including Pro rules and cross-file analysis
  • Fast feedback: our 12-line custom taint rule ran in 1.7 seconds on a small app
  • One platform for SAST, SCA with reachability and secrets with validation
  • When run locally or in your CI, source code stays there; only scan metadata goes to Semgrep

Cons

  • CE alone has single-function taint analysis; cross-file and cross-function taint is in the paid engine
  • Registry rules are under the Semgrep Rules License: internal business use only, no redistribution or offering as a service
  • Community rule packs can be noisy, including audit-level rules that flag a line more than once
  • Pro features beyond 10 contributors cost $30 per contributor per month per product (Secrets $15)
  • Pulling registry rule packs needs access to semgrep.dev; in our sandbox it was blocked and we used the rules repository instead

Best For

Teams on any Git host that want fast, developer-written rules and guardrails, organisations scanning private code without GitHub Advanced Security, and AppSec teams that want SAST, SCA and secrets from one vendor.

CodeQL

CodeQL is GitHub's semantic code analysis engine. It extracts a codebase into a relational database and runs queries written in QL against it, which lets the standard query packs follow data from sources to sinks across functions and files. It powers GitHub code scanning, where default setup configures it with no workflow file, and runs locally through the CodeQL CLI.

Pros

  • Deep interprocedural dataflow by default: in our test it reported all 3 injections with source-to-sink paths, including one across files
  • Large, maintained MIT query packs from GitHub and the security community; no rule writing needed to get value
  • Default setup on GitHub enables scanning in a few clicks, with alerts in pull requests and the Security tab
  • Free for public repositories on GitHub.com, including code scanning and Copilot Autofix
  • Build mode none now covers C#, Java, JavaScript/TypeScript, Python and Ruby, removing the build step for those

Cons

  • The CLI is not open source; using it on private code or in CI for non-OSS code requires a GitHub Code Security licence
  • Code Security costs $30 per active committer per month and requires a GitHub Team or Enterprise plan
  • QL is a separate language with a steep learning curve for custom queries
  • Heavy install: the bundle is a 696 MB download and about 1.4 GB unpacked
  • Compiled languages such as C/C++, Go and Swift still need autobuild or a manual build command

Best For

Projects hosted on GitHub, especially open-source repositories and organisations already paying for GitHub Code Security, that want deep default findings, Copilot Autofix and security alerts inside pull requests.

Two analysis models: patterns on source versus queries on a database

Semgrep parses each file into a generic syntax tree and matches rules written as code patterns. A rule for a SQL call looks like $CONN.execute($Q, ...), with metavariables, operators such as pattern-inside, and a taint mode that names sources, sinks and sanitizers. Because it works on source, it needs no build and can scan a partial checkout or a single file. The Community Edition engine does single-function taint analysis and single-file constant propagation; Semgrep Code, the paid engine, adds cross-function and cross-file dataflow for C#, Go, Java, JavaScript, TypeScript, Kotlin, Python and C/C++. CodeQL extracts the whole program into a relational database (an AST, control flow and type information), then runs queries in QL, a logic language with classes and predicates. Its standard libraries model frameworks and track data across functions and files by default, which is why its out-of-the-box findings tend to be deeper. The cost is setup: compiled languages need autobuild or a build command, although build mode none now handles C#, Java, JavaScript/TypeScript, Python and Ruby without a build. Semgrep's own comparison page sums this up as source-level speed versus a buildable environment.

Licensing: what you may run, where, and on whose code

This is the part teams most often get wrong. Semgrep CE's engine is LGPL-2.1, so you can run it on any code, anywhere, for free. The rules in the Semgrep Registry are a separate matter: they are under the Semgrep Rules License v1.0, which allows use for your own internal business purposes but not distributing them or making them available as a service. Pro rules and the Pro engine are proprietary and come with a Semgrep plan. Opengrep, a fork backed by several AppSec vendors, keeps an LGPL-2.1 engine with cross-file taint and reached 2.0.0 on 13 November 2026. CodeQL is split the other way. The query packs and libraries in github/codeql are MIT, but the CodeQL CLI is licensed under the GitHub CodeQL Terms: it may be used for academic research, demonstrations and testing OSI-licensed queries, and for analysis of OSI-licensed codebases, including automated CI analysis only when that codebase is hosted on GitHub.com. Using it on private code, or in CI for non-open-source code, requires a paid GitHub Advanced Security licence, today sold as GitHub Code Security.

Pricing at team scale

Both bill per developer who commits, both look back 90 days, and both list $30 per month for the SAST product. Semgrep's Free edition covers up to 10 contributors and 10 private repositories with Code and Supply Chain at $0, Pro rules, cross-file analysis and 60 AI credits. Teams starts at $30 per contributor per month for Code, $30 for Supply Chain and $15 for Secrets, allows up to 500 private repositories and adds SAML or OIDC SSO; Enterprise is custom. A contributor is anyone who committed to a scanned private repository in the past 90 days. GitHub Code Security is $30 per active committer per month, where an active committer pushed to a repository with the feature enabled in the last 90 days; it can only be bought on GitHub Team or Enterprise, which carry their own per-seat price, and Secret Protection is a separate $19. Public repositories on GitHub.com get code scanning free. As a list-price example, a 25-developer team pays 25 x $30 = $750 per month for either Semgrep Code or GitHub Code Security; adding Semgrep Supply Chain doubles the Semgrep figure, whereas GitHub's dependency alerts and Dependabot come with every plan.

Day-to-day workflow: CI, pull requests, noise and AI

On GitHub, CodeQL is the path of least resistance: default setup needs no workflow file, picks languages and query suites, scans pull requests and pushes, and shows alerts as PR annotations and in the Security tab. If a repository sees no pushes or pull requests for 6 months, the weekly schedule is switched off to save Actions minutes. Advanced setup with codeql-action gives you control over query packs and build steps. Copilot Autofix proposes fixes, and newer AI Scan and agentic autofix features consume AI credits even on public repositories. Semgrep runs the same way on every CI: semgrep scan for CE, semgrep ci when connected to the platform, which adds PR and MR comments on GitHub, GitLab, Bitbucket and Azure, policies, Jira and Slack hooks, and Assistant for AI triage and fixes. Its outputs include SARIF, so results can also land in GitHub's Security tab. In both tools, noise is managed through rule or query selection. CodeQL's default suite is intentionally conservative; Semgrep's community packs vary, and audit-category rules are worth disabling in blocking CI jobs.

Worked example: the same Flask app through both

On 18 November 2026 we wrote a 3-file Flask app with three planted bugs: a SQL query built by concatenation in one function and executed in another (app.py line 15), a shell=True ping with user input (app.py line 26), and a SQL string built in helpers.py and executed in views.py (line 11). Semgrep CE 1.186.0 with the 337 Python rule files from the semgrep-rules repository (371 rules, commit a5ad171, 10 November) took 20.7 seconds including rule loading on 2 vCPUs and returned 4 findings: the line-15 query via a raw-query pattern rule, and three rules on line 26 including one audit rule. It missed the cross-file query in views.py. A 12-line custom taint rule flagged views.py line 11 in 1.7 seconds but not line 15, because its source and sink sit in different functions and CE taint is single-function. The CodeQL 2.27.4 bundle, checksum-verified against GitHub's digest, built a database with build mode none in 4.1 seconds and ran the 43-query Python code-scanning suite in 15.7 seconds: py/sql-injection on app.py 15 and views.py 11, and py/command-line-injection on app.py 26, each with a data-flow path. We used the CodeQL CLI only to demonstrate it, as its terms allow.

Verdict

Pick CodeQL when your code is on GitHub and either public or already covered by GitHub Code Security. Turn on default setup, let it run the standard query suite on pull requests and on a weekly schedule, and use Copilot Autofix on what it finds. You get deep, interprocedural findings without writing a single rule, which is the main reason to choose it. Do not plan on using the CodeQL CLI for private code without that licence, and budget for slower scans on large compiled codebases. Pick Semgrep when you are on GitLab, Bitbucket or Azure, when you need to scan private code without buying GitHub Code Security, or when your team wants to encode its own guardrails: banned APIs, framework conventions, internal security patterns. Semgrep CE is a good free baseline for any repo; add the paid Semgrep Code engine (free for 10 contributors) if you need cross-file taint tracking. Running both is reasonable on GitHub: CodeQL default setup for depth, Semgrep with custom rules for fast, team-specific checks, both reporting SARIF into the same Security tab.

All Comparisons

Semgrep vs CodeQL — FAQ

Common questions answered from the comparison above

Is CodeQL free?

For open-source code, yes: code scanning with CodeQL is free on public GitHub.com repositories, and the CLI may be used on OSI-licensed codebases, for research and for demos. For private repositories you need GitHub Code Security at $30 per active committer per month, which requires a GitHub Team or Enterprise plan.

Is Semgrep open source?

The Semgrep Community Edition engine is open source under LGPL-2.1. The Pro engine, Pro rules and the AppSec Platform are proprietary, and the rules in the Semgrep Registry are under the Semgrep Rules License, which allows internal use but not redistribution or offering them as a service. Opengrep is an LGPL-2.1 fork that runs Semgrep-format rules.

Which finds more vulnerabilities, Semgrep or CodeQL?

There is no neutral, current benchmark we can point to. In our small test, CodeQL's default Python suite found all 3 planted injections while Semgrep CE with community rules found 2, missing a cross-file case. Paid Semgrep Code adds cross-file taint analysis that we did not test. Results depend heavily on language, framework and rule choice, so trial both on your own code.

Can I use Semgrep or CodeQL with GitLab?

Semgrep supports GitLab directly, including MR comments on the paid platform and GitLab SAST output from the CLI. CodeQL code scanning is a GitHub feature; the CLI can run in GitLab CI, but its licence only allows that for open-source code hosted on GitHub.com or with a GitHub Advanced Security licence.

Do I need to compile my code for CodeQL?

Not for C#, Java, JavaScript/TypeScript, Python and Ruby, which support build mode none. C/C++, Go, Kotlin and Swift use autobuild or a manual build command, and C# and Java can also use them. Semgrep never needs a build.

Can I run Semgrep and CodeQL together?

Yes. Both produce SARIF, so on GitHub you can keep CodeQL default setup for deep analysis and add a Semgrep job with your own rules; both appear in the Security tab as separate tools. Make Semgrep's job blocking only for high-confidence rules to keep pull requests moving.

Get the next comparison by email

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.