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/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts.md
+12-12
Original file line number
Diff line number
Diff line change
@@ -33,10 +33,12 @@ Each alert highlights a problem with the code and the name of the tool that iden
33
33
{% data reusables.code-scanning.alert-default-branch %}
34
34
{% endif %}
35
35
36
-
{% ifversion fpt or ghec or ghes > 3.4 or ghae > 3.4 %}
37
-

36
+
{% ifversion fpt or ghec %}
37
+

38
+
{% elsif ghes = 3.4 %}
39
+

38
40
{% else %}
39
-

41
+

40
42
{% endif %}
41
43
42
44
If you configure {% data variables.product.prodname_code_scanning %} using {% data variables.product.prodname_codeql %}, you can also find data-flow problems in your code. Data-flow analysis finds potential security issues in code, such as: using data insecurely, passing dangerous arguments to functions, and leaking sensitive information.
@@ -71,7 +73,7 @@ You can run multiple configurations of code analysis on a repository, using diff
71
73
72
74
If you use multiple configurations to analyze a file, any problems detected by the same query are reported as alerts with multiple analysis origins. If an alert has more than one analysis origin, a {% octicon "workflow" aria-label="The workflow icon" %} icon will appear next to any relevant branch in the **Affected branches** section on the right-hand side of the alert page. You can hover over the {% octicon "workflow" aria-label="The workflow icon" %} icon to see the names of each analysis origin and the status of the alert for that analysis origin. You can also view the history of when alerts appeared in each analysis origin in the timeline on the alert page. If an alert only has one analysis origin, no information about analysis origins is displayed on the alert page.
73
75
74
-

76
+

75
77
76
78
{% note %}
77
79
@@ -91,13 +93,13 @@ If you use multiple configurations to analyze a file, any problems detected by t
91
93
92
94
{% data variables.product.prodname_code_scanning_caps %} categorizes files by file path. You cannot manually categorize source files.
93
95
94
-
Here is an example from the {% data variables.product.prodname_code_scanning %} alert list of an alert marked as occurring in library code.
96
+
In this example, an alert is marked as in "Test" code in the {% data variables.product.prodname_code_scanning %} alert list.
95
97
96
-

98
+

97
99
98
-
On the alert page, you can see that the filepath is marked as library code (`Library` label).
100
+
When you click through to see details for the alert, you can see that the file path is marked as "Test" code.

101
103
102
104
{% ifversion codeql-ml-queries %}
103
105
@@ -107,7 +109,7 @@ On the alert page, you can see that the filepath is marked as library code (`Lib
107
109
108
110
In repositories that run {% data variables.product.prodname_code_scanning %} using the {% data variables.product.prodname_codeql %} action, you may see some alerts that are marked as experimental. These are alerts that were found using a machine learning model to extend the capabilities of an existing {% data variables.product.prodname_codeql %} query.
109
111
110
-

112
+

111
113
112
114
### Benefits of using machine learning models to extend queries
113
115
@@ -119,9 +121,7 @@ Each of the security queries for {% data variables.product.prodname_codeql %} id
119
121
120
122
### Alerts identified using machine learning
121
123
122
-
Alerts found using a machine learning model are tagged as "Experimental alerts" to show that the technology is under active development. These alerts have a higher rate of false positive results than the queries they are based on. The machine learning model will improve based on user actions such as marking a poor result as a false positive or fixing a good result.
Alerts found using a machine learning model are displayed with an "Experimental alerts" banner to show that the technology is under active development. These alerts have a higher rate of false positive results than the queries they are based on. The machine learning model will improve based on user actions such as marking a poor result as a false positive or fixing a good result.
Copy file name to clipboardExpand all lines: content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning-for-a-repository.md
+5-12
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ You decide how to generate {% data variables.product.prodname_code_scanning %} a
44
44
45
45
{% ifversion code-scanning-tool-status-page %}
46
46
47
-
The {% data variables.code-scanning.tool_status_page %} shows useful information about all of your code scanning tools. If code scanning is not working as you'd expect, the {% data variables.code-scanning.tool_status_page %} is a good starting point for debugging problems. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-the-tool-status-page)".
47
+
The {% data variables.code-scanning.tool_status_page %} shows useful information about all of your code scanning tools. If code scanning is not working as you'd expect, the {% data variables.code-scanning.tool_status_page %} is a good starting point for debugging problems. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-the-tool-status-page)."
48
48
49
49
{% endif %}
50
50
@@ -176,7 +176,8 @@ The `on:pull_request` and `on:push` triggers for code scanning are each useful f
176
176
{% data reusables.repositories.sidebar-security %}
177
177
1. To the right of "{% data variables.product.prodname_code_scanning_caps %} alerts", click **Set up {% data variables.product.prodname_code_scanning %}**.{% ifversion ghec or ghes or ghae %} If "{% data variables.product.prodname_code_scanning %} alerts" is missing, you need to ask an organization owner or repository administrator to enable {% data variables.product.prodname_GH_advanced_security %}.{% endif %} For more information, see "[AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization)" or "[AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository)."
178
178
1. Under "Get started with {% data variables.product.prodname_code_scanning %}", click **Set up this workflow** on the {% data variables.code-scanning.codeql_workflow %} or on a third-party workflow.
179
-
Workflows are only displayed if they are relevant for the programming languages detected in the repository. The {% data variables.code-scanning.codeql_workflow %} is always displayed, but the "Set up this workflow" button is only enabled if {% data variables.product.prodname_codeql %} analysis supports the languages present in the repository.
179
+
180
+
Workflows are only displayed if they are relevant for the programming languages detected in the repository. The {% data variables.code-scanning.codeql_workflow %} is always displayed, but the "Set up this workflow" button is only enabled if {% data variables.product.prodname_codeql %} analysis supports the languages present in the repository.
180
181
1. To customize how {% data variables.product.prodname_code_scanning %} scans your code, edit the workflow.
181
182
182
183
Generally, you can commit the {% data variables.code-scanning.codeql_workflow %} without making any changes to it. However, many of the third-party workflows require additional configuration, so read the comments in the workflow before committing.
@@ -227,14 +228,6 @@ After configuring {% data variables.product.prodname_code_scanning %} for your r
227
228
228
229
1. Once all jobs are complete, you can view the details of any {% data variables.product.prodname_code_scanning %} alerts that were identified. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/managing-code-scanning-alerts-for-your-repository#viewing-the-alerts-for-a-repository)."
229
230
230
-
{% note %}
231
-
232
-
**Note:** If you raised a pull request to add the {% data variables.product.prodname_code_scanning %} workflow to the repository, alerts from that pull request aren't displayed directly on the {% data variables.product.prodname_code_scanning_caps %} page until the pull request is merged. If any alerts were found you can view these, before the pull request is merged, by clicking the **NUMBER alerts found** link in the banner on the {% data variables.product.prodname_code_scanning_caps %} page.
233
-
234
-

235
-
236
-
{% endnote %}
237
-
238
231
## Understanding the pull request checks
239
232
240
233
Each {% data variables.product.prodname_code_scanning %} workflow you set to run on pull requests always has at least two entries listed in the checks section of a pull request. There is one entry for each of the analysis jobs in the workflow, and a final one for the results of the analysis.
@@ -245,10 +238,10 @@ The names of the {% data variables.product.prodname_code_scanning %} analysis ch
245
238
246
239
When the {% data variables.product.prodname_code_scanning %} jobs complete, {% data variables.product.prodname_dotcom %} works out whether any alerts were added by the pull request and adds the "{% data variables.product.prodname_code_scanning_caps %} results / TOOL NAME" entry to the list of checks. After {% data variables.product.prodname_code_scanning %} has been performed at least once, you can click **Details** to view the results of the analysis.
247
240
248
-
{% ifversion ghes < 3.5 or ghae %}
241
+
{% ifversion ghes < 3.5 %}
249
242
If you used a pull request to add {% data variables.product.prodname_code_scanning %} to the repository, you will initially see an "Analysis not found" message when you click **Details** on the "{% data variables.product.prodname_code_scanning_caps %} results / TOOL NAME" check.
250
243
251
-

244
+

252
245
253
246
The table lists one or more categories. Each category relates to specific analyses, for the same tool and commit, performed on a different language or a different part of the code. For each category, the table shows the two analyses that {% data variables.product.prodname_code_scanning %} attempted to compare to determine which alerts were introduced or fixed in the pull request.
Copy file name to clipboardExpand all lines: content/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning.md
+11-13
Original file line number
Diff line number
Diff line change
@@ -58,10 +58,8 @@ With the advanced setup, you can edit workflows like {% data variables.product.p
58
58
{% data variables.product.prodname_dotcom %} saves workflow files in the _.github/workflows_ directory of your repository. You can find a workflow you have added by searching for its file name. For example, by default, the workflow file for {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} is called _codeql-analysis.yml_.
59
59
60
60
1. In your repository, browse to the workflow file you want to edit.
61
-
1. In the upper right corner of the file view, to open the workflow editor, click {% octicon "pencil" aria-label="The edit icon" %}.
1. In the upper right corner of the file view, to open the workflow editor, click {% octicon "pencil" aria-label="Edit file" %}.
63
62
1. After you have edited the file, click **Start commit** and complete the "Commit changes" form. You can choose to commit directly to the current branch, or create a new branch and start a pull request.
64
-

65
63
66
64
For more information about editing workflow files, see "[AUTOTITLE](/actions/learn-github-actions)."
67
65
@@ -89,16 +87,6 @@ If you scan pull requests, then the results appear as alerts in a pull request c
89
87
90
88
Using the `pull_request` trigger, configured to scan the pull request's merge commit rather than the head commit, will produce more efficient and accurate results than scanning the head of the branch on each push. However, if you use a CI/CD system that cannot be configured to trigger on pull requests, you can still use the `on:push` trigger and {% data variables.product.prodname_code_scanning %} will map the results to open pull requests on the branch and add the alerts as annotations on the pull request. For more information, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning#scanning-on-push)."
91
89
92
-
### Defining the severities causing pull request check failure
93
-
94
-
By default, only alerts with the severity level of `Error` or security severity level of `Critical` or `High` will cause a pull request check failure, and a check will still succeed with alerts of lower severities. You can change the levels of alert severities and of security severities that will cause a pull request check failure in your repository settings. For more information about severity levels, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-alert-details)."
95
-
96
-
{% data reusables.repositories.navigate-to-repo %}
97
-
{% data reusables.repositories.sidebar-settings %}
98
-
{% data reusables.repositories.navigate-to-code-security-and-analysis %}
99
-
1. 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.
You might want to avoid a code scan being triggered on specific pull requests targeted against the default branch, irrespective of which files have been changed. You can configure this by specifying `on:pull_request:paths-ignore` or `on:pull_request:paths` in the {% data variables.product.prodname_code_scanning %} workflow. For example, if the only changes in a pull request are to files with the file extensions `.md` or `.txt` you can use the following `paths-ignore` array.
@@ -270,6 +258,16 @@ jobs:
270
258
```
271
259
{% endif %}
272
260
261
+
## Defining the alert severities that give a check failure for a pull request
262
+
263
+
By default, only alerts with the severity level of `Error` or security severity level of `Critical` or `High` will cause a pull request check failure, and a check will still succeed with alerts of lower severities. You can change the levels of alert severities and of security severities that will cause a pull request check failure in your repository settings. For more information about severity levels, see "[AUTOTITLE](/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning-alerts#about-alert-details)."
264
+
265
+
{% data reusables.repositories.navigate-to-repo %}
266
+
{% data reusables.repositories.sidebar-settings %}
267
+
{% data reusables.repositories.navigate-to-code-security-and-analysis %} {% ifversion fpt or ghec %}
268
+
1. Under "{% data variables.product.prodname_code_scanning_caps %}", in the "Protection rules" section, use the drop-down menu to define which alerts should cause a check failure. Choose one level for alerts of type "Security" and one level for all other alerts.{% else %}
269
+
1. Under "{% data variables.product.prodname_code_scanning_caps %}", 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.{% endif %}
270
+
273
271
## Configuring a category for the analysis
274
272
275
273
Use `category` to distinguish between multiple analyses for the same tool and commit, but performed on different languages or different parts of the code. The category you specify in your workflow will be included in the SARIF results file.
0 commit comments