You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-codeql-code-scanning-in-your-ci-system.md
+21-5Lines changed: 21 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,16 @@ There are three versions of the {% data variables.product.prodname_codeql_runner
30
30
31
31
To customize the way the {% data variables.product.prodname_codeql_runner %} scans your code, you can use flags, such as `--languages` and `--queries`, or you can specify custom settings in a separate configuration file.
32
32
33
+
### Scanning pull requests
34
+
35
+
Scanning code whenever a pull request is created prevents developers from introducing new vulnerabilities and errors into the code.
36
+
37
+
To scan a pull request, run the `analyze` command and use the `--ref` flag to specify the pull request. The reference is `refs/pull/<pr-number>/head` or `refs/pull/<pr-number>/merge`, depending on whether you have checked out the HEAD commit of the pull request branch or a merge commit with the base branch.
The {% data variables.product.prodname_codeql_runner %} automatically detects and scans code written in the supported languages.
@@ -116,7 +126,7 @@ Initializes the {% data variables.product.prodname_codeql_runner %} and creates
116
126
|`--queries`|| Comma-separated list of additional queries to run, in addition to the default suite of security queries. |
117
127
|`--config-file`|| Path to custom configuration file. |
118
128
|`--codeql-path`|| Path to a copy of the {% data variables.product.prodname_codeql %} CLI executable to use. By default, the {% data variables.product.prodname_codeql_runner %} downloads a copy. |
119
-
|`--temp-dir`|| Directory where temporary files are stored. The default is _./codeql-runner_. |
129
+
|`--temp-dir`|| Directory where temporary files are stored. The default is `./codeql-runner`. |
120
130
|`--tools-dir`|| Directory where {% data variables.product.prodname_codeql %} tools and other files are stored between runs. The default is a subdirectory of the home directory. |
121
131
| <nobr>`--checkout-path`</nobr> || The path to the checkout of your repository. The default is the current working directory. |
122
132
|`--debug`|| None. Prints more verbose output. |
@@ -129,7 +139,7 @@ Attempts to build the code for the compiled languages C/C++, C#, and Java. For t
129
139
| Flag | Required | Input value |
130
140
| ---- |:--------:| ----------- |
131
141
|`--language`|| The language to build. By default, the {% data variables.product.prodname_codeql_runner %} builds the compiled language with the most files. |
132
-
| <nobr>`--temp-dir`</nobr> || Directory where temporary files are stored. The default is _./codeql-runner_. |
142
+
| <nobr>`--temp-dir`</nobr> || Directory where temporary files are stored. The default is `./codeql-runner`. |
133
143
|`--debug`|| None. Prints more verbose output. |
134
144
|`-h`, `--help`|| None. Displays help for the command. |
135
145
@@ -141,7 +151,7 @@ Analyzes the code in the {% data variables.product.prodname_codeql %} databases
141
151
| ---- |:--------:| ----------- |
142
152
|`--repository`| ✓ | Name of the repository to analyze. |
143
153
|`--commit`| ✓ | SHA of the commit to analyze. In Git and in Azure DevOps, this corresponds to the value of `git rev-parse HEAD`. In Jenkins, this corresponds to `$GIT_COMMIT`. |
144
-
|`--ref`| ✓ | Name of the reference to analyze, for example `refs/heads/main`. In Git and in Jenkins, this corresponds to the value of `git symbolic-ref HEAD`. In Azure DevOps, this corresponds to `$(Build.SourceBranch)`. |
154
+
|`--ref`| ✓ | Name of the reference to analyze, for example `refs/heads/main` or `refs/pull/42/merge`. In Git or in Jenkins, this corresponds to the value of `git symbolic-ref HEAD`. In Azure DevOps, this corresponds to `$(Build.SourceBranch)`. |
145
155
|`--github-url`| ✓ | URL of the {% data variables.product.prodname_dotcom %} instance where your repository is hosted. |
146
156
|`--github-auth`| ✓ | A {% data variables.product.prodname_github_apps %} token or personal access token. |
147
157
| <nobr>`--checkout-path`</nobr> || The path to the checkout of your repository. The default is the current working directory. |
@@ -150,20 +160,26 @@ Analyzes the code in the {% data variables.product.prodname_codeql %} databases
150
160
|`--ram`|| Amount of memory to use when running queries. The default is to use all available memory. |
151
161
| <nobr>`--no-add-snippets`</nobr> || None. Excludes code snippets from the SARIF output. |
152
162
|`--threads`|| Number of threads to use when running queries. The default is to use all available cores. |
153
-
|`--temp-dir`|| Directory where temporary files are stored. The default is _./codeql-runner_. |
163
+
|`--temp-dir`|| Directory where temporary files are stored. The default is `./codeql-runner`. |
154
164
|`--debug`|| None. Prints more verbose output. |
155
165
|`-h`, `--help`|| None. Displays help for the command. |
156
166
157
167
#### `upload`
158
168
159
169
Uploads SARIF files to {% data variables.product.product_location %}.
160
170
171
+
{% note %}
172
+
173
+
**Note**: If you analyze code with the CodeQL runner, the `analyze` command uploads SARIF results by default. You can use the `upload` command to upload SARIF results that were generated by other tools.
174
+
175
+
{% endnote %}
176
+
161
177
| Flag | Required | Input value |
162
178
| ---- |:--------:| ----------- |
163
179
|`--sarif-file`| ✓ | SARIF file to upload, or a directory containing multiple SARIF files. |
164
180
|`--repository`| ✓ | Name of the repository that was analyzed. |
165
181
|`--commit`| ✓ | SHA of the commit that was analyzed. In Git and in Azure DevOps, this corresponds to the value of `git rev-parse HEAD`. In Jenkins, this corresponds to `$GIT_COMMIT`. |
166
-
|`--ref`| ✓ | Name of the reference that was analyzed, for example `refs/heads/main`. In Git and in Jenkins, this corresponds to the value of `git symbolic-ref HEAD`. In Azure DevOps, this corresponds to `$(Build.SourceBranch)`. |
182
+
|`--ref`| ✓ | Name of the reference that was analyzed, for example `refs/heads/main` or `refs/pull/42/merge`. In Git or in Jenkins, this corresponds to the value of `git symbolic-ref HEAD`. In Azure DevOps, this corresponds to `$(Build.SourceBranch)`. |
167
183
|`--github-url`| ✓ | URL of the {% data variables.product.prodname_dotcom %} instance where your repository is hosted. |
168
184
|`--github-auth`| ✓ | A {% data variables.product.prodname_github_apps %} token or personal access token. |
169
185
| <nobr>`--checkout-path`</nobr> || The path to the checkout of your repository. The default is the current working directory. |
0 commit comments