CodeQL is a query language and analysis engine that powers security scanning in GitHub Advanced Security and enables security researchers to write custom code analysis queries.
CodeQL addresses the problem of identifying security vulnerabilities and code quality issues across large codebases by treating code as queryable data. The approach works by converting source code into a relational database representation, which can then be queried using CodeQL's declarative language to find patterns indicative of bugs, vulnerabilities, or policy violations. This allows both automated scanning and custom analysis tailored to specific security concerns.
Developers should adopt CodeQL if they need to perform deep semantic code analysis beyond pattern matching, particularly for security scanning integrated into development workflows. It suits organizations using GitHub Advanced Security, security teams building custom vulnerability detectors, and researchers investigating code patterns across multiple languages. The tool works with Visual Studio Code through a dedicated extension providing syntax highlighting, IntelliSense, and unit testing support for queries. The repository contains the standard libraries and queries that ship with GitHub's security products, making it the authoritative source for the analysis rules used in those services.
The project maintains an active standard library with documented contribution pathways for new checks and query improvements. The repository includes comprehensive style guides and metadata documentation standards that contributors are expected to follow. Development activity centers on expanding and refining the query library through community contributions, with clear guidelines for pull requests and query help documentation. The project provides extensive learning resources including language documentation, CLI tooling guides, and integration documentation for the Visual Studio Code extension.