About editing your configuration of default setup
After running an initial analysis of your code with default setup, you may need to make changes to your configuration to better meet your code security needs. For existing configurations of default setup, you can edit:
- Which languages default setup will analyze.
- The query suite run during analysis. For more information on the available query suites, see CodeQL query suites.
If your codebase depends on a library or framework that is not recognized by the standard libraries included with CodeQL, you can also extend the CodeQL coverage in default setup using CodeQL model packs. For more information, see Extending CodeQL coverage with CodeQL model packs in default setup.
If you need to change any other aspects of your code scanning configuration, consider configuring advanced setup. For more information, see Configuring advanced setup for code scanning.
Customizing your existing configuration of default setup
-
On GitHub, navigate to the main page of the repository.
-
Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.
-
In the "Security" section of the sidebar, click Code security and analysis.
-
In the "CodeQL analysis" row of the "Code scanning" section, select , then click View CodeQL configuration.
-
In the "CodeQL default configuration" window, click Edit.
-
Optionally, in the "Languages" section, select or deselect languages for analysis.
-
Optionally, in the "Query suite" row of the "Scan settings" section, select a different query suite to run against your code.
-
To update your configuration, as well as run an initial analysis of your code with the new configuration, click Save changes. All future analyses will use your new configuration.
Defining the alert severities that cause a check failure for a pull request
When you enable code scanning on pull requests, the check fails only if one or more alerts of severity error
, or security severity critical
or high
are detected. The check will succeed if alerts with lower severities or security severities are detected. For important codebases, you may want the code scanning check to fail if any alerts are detected, so that the alert must be fixed or dismissed before the code change is merged. For more information about severity levels, see "About alert severity and security severity levels."
-
On GitHub, navigate to the main page of the repository.
-
Under your repository name, click Settings. If you cannot see the "Settings" tab, select the dropdown menu, then click Settings.
-
In the "Security" section of the sidebar, click Code security and analysis.
-
Under "Code scanning", to the right of "Check Failure", use the drop-down menu to select the level of severity you would like to cause a pull request check failure.
Extending CodeQL coverage with CodeQL model packs in default setup
Note
CodeQL model packs and the CodeQL model editor are currently in beta and subject to change. Model packs are supported by Java/Kotlin analysis.
If you use frameworks and libraries that are not recognized by the standard libraries included with CodeQL, you can model your dependencies and extend code scanning analysis. For more information, see Supported languages and frameworks in the documentation for CodeQL.
For default setup, you need to define the models of your additional dependencies in CodeQL model packs. You can extend coverage in default setup with CodeQL model packs for individual repositories, or at scale for all repositories in an organization.
For more information about CodeQL model packs and writing your own, see Using the CodeQL model editor.
Extending coverage for a repository
- In the
.github/codeql/extensions
directory of the repository, copy the model pack directory which should include acodeql-pack.yml
file and any.yml
files containing additional models for the libraries or frameworks you wish to include in your analysis. - The model packs will be automatically detected and used in your code scanning analysis.
- If you later change your configuration to use advanced setup, any model packs in the
.github/codeql/extensions
directory will still be recognized and used.