CodeQL
CodeQL is a semantic code analysis engine that turns source code into queryable databases. It has a free edition, and its maintainer also sells a paid edition or commercial license. It runs on Linux, macOS, and Windows.
Updated
- Pricing
- Free / Commercial
- License
- MIT (queries); proprietary CLI
- Platforms
- Linux, macOS, Windows
- Category
- Application Security Tools
What Is CodeQL?
CodeQL is a semantic code analysis engine that turns source code into queryable databases. Security researchers and developers write QL queries to detect bugs, vulnerabilities, and anti-patterns. The CLI is free for open-source repositories and requires a commercial license for private code analysis.
Use Cases
Use CodeQL to perform static analysis of codebases, search for custom vulnerability patterns, and gate pull requests in GitHub.
Strengths and Limitations
Strengths
- +Turns source code into a queryable database for data-flow analysis.
- +QL queries are reusable and can be shared across projects and teams.
- +GitHub code scanning runs CodeQL on pull requests, free for public repositories and part of GitHub Code Security for private ones.
Limitations
- -Requires a paid GitHub license for private repositories and advanced features.
- -Database creation for compiled languages monitors the normal build process, except build mode none for C/C++, C#, Java, and Rust, which skips the build but does not analyze generated code.
Defensive Use
Use CodeQL to identify and fix complex data-flow vulnerabilities before attackers can exploit them.
CodeQL Alternatives
3 tools| Tool | License | Platforms | Pricing |
|---|---|---|---|
| Bandit Security linter from PyCQA that processes Python ASTs to find common vulnerability patterns and insecure library usages. | Apache-2.0 | Linux, macOS, Windows | Open Source |
| Semgrep Fast static analysis engine for codebases and CI/CD pipelines, matching semantic code patterns to find security vulnerabilities. | LGPL-2.1-only | Linux, macOS, Windows | Free / Commercial |
| SonarQube Multi-language static analysis and code quality platform with open-source Community Build and commercial Server and Cloud editions. | LGPL-3.0-or-later (source); Sonar Source-Available License v1.0 (bundled analyzers) | Linux, macOS, Windows | Free / Commercial |
Frequently Asked Questions
What is CodeQL?→
CodeQL is a semantic code analysis engine that turns source code into queryable databases. Security researchers and developers write QL queries to detect bugs, vulnerabilities, and anti-patterns. The CLI is free for open-source repositories and requires a commercial license for private code analysis.
What is CodeQL used for?→
Use CodeQL to perform static analysis of codebases, search for custom vulnerability patterns, and gate pull requests in GitHub.
What are the strengths of CodeQL?→
- +Turns source code into a queryable database for data-flow analysis.
- +QL queries are reusable and can be shared across projects and teams.
- +GitHub code scanning runs CodeQL on pull requests, free for public repositories and part of GitHub Code Security for private ones.
What are the limitations of CodeQL?→
- +Requires a paid GitHub license for private repositories and advanced features.
- +Database creation for compiled languages monitors the normal build process, except build mode none for C/C++, C#, Java, and Rust, which skips the build but does not analyze generated code.
How is CodeQL used defensively?→
Use CodeQL to identify and fix complex data-flow vulnerabilities before attackers can exploit them.