Code scanning is a feature that you use to analyze the code in a GitHub repository to find security vulnerabilities and coding errors. Any problems identified by the analysis are shown in GitHub. For information, see "About code scanning with CodeQL."
You can run CodeQL code scanning within GitHub using GitHub Actions. Alternatively, if you use a third-party continuous integration or continuous delivery/deployment (CI/CD) system, you can run CodeQL analysis in your existing system and upload the results to GitHub.com.
You add the CodeQL CLI to your third-party system, then call the tool to analyze code and upload the SARIF results to GitHub. The resulting code scanning alerts are shown alongside any alerts generated within GitHub.
If you run code scanning using multiple configurations, the same alert will sometimes be generated by more than one configuration. If an alert comes from multiple configurations, you can view the status of the alert for each configuration on the alert page. For more information, see "About code scanning alerts."
Note: Uploading SARIF data to display as code scanning results in GitHub is supported for organization-owned repositories with GitHub Advanced Security enabled, and public repositories on GitHub.com. For more information, see "Managing security and analysis settings for your repository."
The CodeQL CLI is a standalone, command-line tool that you can use to analyze code. Its main purpose is to generate a database representation of a codebase, a CodeQL database. Once the database is ready, you can query it interactively, or run a suite of queries to generate a set of results in SARIF format and upload the results to GitHub.com.
Use the CodeQL CLI to analyze:
- Compiled languages, for example, C/C++, C#, Go, and Java.
- Codebases written in a mixture of languages.
For more information, see "Installing CodeQL CLI in your CI system."
- The CodeQL CLI is free to use on public repositories. The CodeQL CLI is also available in private repositories owned by organizations that use GitHub Enterprise Cloud and have a license for GitHub Advanced Security. For information, see "GitHub CodeQL Terms and Conditions" and "CodeQL CLI."
- The CodeQL CLI is currently not compatible with non-glibc Linux distributions such as (musl-based) Alpine Linux.