зеркало из https://github.com/github/docs.git
Add topic for developers who need to triage code scanning alerts in PRs (#15740)
This commit is contained in:
Родитель
461a74f293
Коммит
20790e724c
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 90 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 214 KiB |
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 75 KiB |
|
@ -18,7 +18,7 @@ versions:
|
|||
|
||||
You can use {{ site.data.variables.product.prodname_code_scanning }} to find, triage, and prioritize fixes for existing problems in your code. {{ site.data.variables.product.prodname_code_scanning_capc }} also prevents developers from introducing new problems. You can schedule scans for specific days and times, or trigger scans when a specific event occurs in the repository, such as a push.
|
||||
|
||||
If {{ site.data.variables.product.prodname_code_scanning }} finds a potential vulnerability or error in your code, {{ site.data.variables.product.prodname_dotcom }} displays an alert in the repository. After you fix the code that triggered the alert, {{ site.data.variables.product.prodname_dotcom }} closes the alert. For more information, see "[Managing alerts from {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
If {{ site.data.variables.product.prodname_code_scanning }} finds a potential vulnerability or error in your code, {{ site.data.variables.product.prodname_dotcom }} displays an alert in the repository. After you fix the code that triggered the alert, {{ site.data.variables.product.prodname_dotcom }} closes the alert. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
To monitor results from {{ site.data.variables.product.prodname_code_scanning }} across your repositories or your organization, you can use the {{ site.data.variables.product.prodname_code_scanning }} API.
|
||||
For more information about API endpoints, see "[{{ site.data.variables.product.prodname_code_scanning_capc }}](/v3/code-scanning)."
|
||||
|
|
|
@ -11,7 +11,7 @@ versions:
|
|||
{{ site.data.reusables.code-scanning.beta }}
|
||||
{{ site.data.reusables.code-scanning.enterprise-enable-code-scanning }}
|
||||
|
||||
As an alternative to running {{ site.data.variables.product.prodname_code_scanning }} within {{ site.data.variables.product.prodname_dotcom }}, you can perform analysis elsewhere and then upload the results. Alerts for {{ site.data.variables.product.prodname_code_scanning }} that you run externally are displayed in the same way as those for {{ site.data.variables.product.prodname_code_scanning }} that you run within {{ site.data.variables.product.prodname_dotcom }}. For more information, see "[Managing alerts from code scanning](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
As an alternative to running {{ site.data.variables.product.prodname_code_scanning }} within {{ site.data.variables.product.prodname_dotcom }}, you can perform analysis elsewhere and then upload the results. Alerts for {{ site.data.variables.product.prodname_code_scanning }} that you run externally are displayed in the same way as those for {{ site.data.variables.product.prodname_code_scanning }} that you run within {{ site.data.variables.product.prodname_dotcom }}. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
You can use your continuous integration or continuous delivery/deployment (CI/CD) system to run {{ site.data.variables.product.prodname_dotcom }}'s {{ site.data.variables.product.prodname_codeql }} analysis and upload the results to {{ site.data.variables.product.prodname_dotcom }}. This is an alternative to using {{ site.data.variables.product.prodname_actions }} to run {{ site.data.variables.product.prodname_codeql }} analysis. For more information, see "[Running code scanning in your CI system](/github/finding-security-vulnerabilities-and-errors-in-your-code/running-code-scanning-in-your-ci-system)."
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ If the `autobuild` command can't build your code, you can run the build steps yo
|
|||
|
||||
By default, the {{ site.data.variables.product.prodname_codeql_runner }} uploads results from {{ site.data.variables.product.prodname_code_scanning }} when you run the `analyze` command. You can also upload SARIF files separately, by using the `upload` command.
|
||||
|
||||
Once you've uploaded the data, {{ site.data.variables.product.prodname_dotcom }} displays the alerts in your repository. For more information, see "[Managing alerts from code scanning](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning#viewing-an-alert)."
|
||||
Once you've uploaded the data, {{ site.data.variables.product.prodname_dotcom }} displays the alerts in your repository. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository#viewing-an-alert)."
|
||||
|
||||
### {{ site.data.variables.product.prodname_codeql_runner }} command reference
|
||||
|
||||
|
|
|
@ -45,5 +45,5 @@ After you commit the workflow file or create a pull request, {{ site.data.variab
|
|||
After you enable {{ site.data.variables.product.prodname_code_scanning }}, you can monitor analysis, view results, and further customize how you scan your code.
|
||||
|
||||
- You can view the run status of {{ site.data.variables.product.prodname_code_scanning }} and get notifications for completed runs. For more information, see "[Managing a workflow run](/actions/configuring-and-managing-workflows/managing-a-workflow-run)" and "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-actions-notification-options)."
|
||||
- After a scan completes, you can view alerts from a completed scan. For more information, see "[Managing alerts from {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
- After a scan completes, you can view alerts from a completed scan. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
- You can customize how {{ site.data.variables.product.prodname_code_scanning }} scans the code in your repository. For more information, see "[Configuring code scanning](/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning)."
|
||||
|
|
|
@ -11,8 +11,9 @@ versions:
|
|||
|
||||
{% topic_link_in_list /automatically-scanning-your-code-for-vulnerabilities-and-errors %}
|
||||
{% link_in_list /about-code-scanning %}
|
||||
{% link_in_list /triaging-code-scanning-alerts-in-pull-requests %}
|
||||
{% link_in_list /enabling-code-scanning-for-a-repository %}
|
||||
{% link_in_list /managing-alerts-from-code-scanning %}
|
||||
{% link_in_list /managing-code-scanning-alerts-for-your-repository %}
|
||||
{% link_in_list /configuring-code-scanning %}
|
||||
{% link_in_list /configuring-the-codeql-workflow-for-compiled-languages %}
|
||||
{% link_in_list /troubleshooting-the-codeql-workflow %}
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
---
|
||||
title: Managing alerts from code scanning
|
||||
shortTitle: Managing alerts
|
||||
intro: 'You can view, fix, and close alerts for potential vulnerabilities or errors in your project''s code.'
|
||||
product: '{{ site.data.reusables.gated-features.code-scanning }}'
|
||||
permissions: 'People with write permissions to a repository can manage {{ site.data.variables.product.prodname_code_scanning }} alerts for the repository.'
|
||||
redirect_from:
|
||||
- /github/managing-security-vulnerabilities/managing-alerts-from-automated-code-scanning
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
---
|
||||
|
||||
{{ site.data.reusables.code-scanning.beta }}
|
||||
{{ site.data.reusables.code-scanning.enterprise-enable-code-scanning }}
|
||||
|
||||
### About alerts from {{ site.data.variables.product.prodname_code_scanning }}
|
||||
|
||||
After you enable {{ site.data.variables.product.prodname_code_scanning }}, {{ site.data.variables.product.prodname_dotcom }} displays {{ site.data.variables.product.prodname_code_scanning }} alerts in your repository. For more information, see "[Enabling {{ site.data.variables.product.prodname_code_scanning }} for a repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository)."
|
||||
|
||||
Each alert highlights a problem with the code and the name of the tool that identified it. You can see the line of code that triggered the alert, as well as properties of the alert, such as the severity and the nature of the problem. Alerts also tell you when the issue was first introduced. For alerts identified by {{ site.data.variables.product.prodname_codeql }} analysis, you will also see information on how to fix the problem.
|
||||
|
||||
![Example alert from {{ site.data.variables.product.prodname_code_scanning }}](/assets/images/help/repository/code-scanning-alert.png)
|
||||
|
||||
If you won't take the action that the alert recommends, you can close the alert manually. For example, you can close an alert for code that's used for testing, or if you believe the alert is a false positive. You might also want to close an alert if the effort of fixing the coding error is greater than the potential benefit of improving the code.
|
||||
|
||||
By default, {{ site.data.variables.product.prodname_dotcom }} displays alerts for the default branch and any protected branches. You can sort and filter the list of alerts to see only the alerts you're interested in.
|
||||
|
||||
You can see the alerts introduced in a pull request, and take immediate action. When {{ site.data.variables.product.prodname_code_scanning }} finds vulnerabilities or errors in a pull request, {{ site.data.variables.product.prodname_dotcom }} displays annotations in the timeline and the diff views of the pull request.
|
||||
|
||||
If you enable {{ site.data.variables.product.prodname_code_scanning }} using {{ site.data.variables.product.prodname_codeql }}, this can also detect 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.
|
||||
|
||||
When {{ site.data.variables.product.prodname_code_scanning }} reports data-flow alerts, {{ site.data.variables.product.prodname_dotcom }} shows you how data moves through the code. {{ site.data.variables.product.prodname_code_scanning_capc }} allows you to identify the areas of your code that leak sensitive information, and that could be the entry point for attacks by malicious users.
|
||||
|
||||
{{ site.data.reusables.code-scanning.you-can-upload-third-party-analysis }} {{ site.data.reusables.code-scanning.get-started-uploading-third-party-data }}
|
||||
|
||||
If you scan your code using a third-party tool or scan your code with custom {{ site.data.variables.product.prodname_codeql }} queries, {{ site.data.variables.product.prodname_dotcom }} will only use the supported SARIF 2.1.0 properties to display alerts. Results from third-party tools or custom queries may not include all of the properties that you see when you scan your code using {{ site.data.variables.product.company_short }}'s default {{ site.data.variables.product.prodname_codeql }} queries. For more information, see "[SARIF support for {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning)."
|
||||
|
||||
### Viewing an alert
|
||||
|
||||
{{ site.data.reusables.repositories.navigate-to-repo }}
|
||||
{{ site.data.reusables.repositories.sidebar-security }}
|
||||
{{ site.data.reusables.repositories.sidebar-code-scanning-alerts }}
|
||||
{{ site.data.reusables.code-scanning.click-alert-in-list }}
|
||||
5. Optionally, if the alert highlights a problem with data flow, click **Show paths** to review the data's path.
|
||||
![Example data-flow alert](/assets/images/help/repository/code-scanning-show-paths.png)
|
||||
|
||||
### Closing an alert
|
||||
|
||||
{{ site.data.reusables.repositories.navigate-to-repo }}
|
||||
{{ site.data.reusables.repositories.sidebar-security }}
|
||||
{{ site.data.reusables.repositories.sidebar-code-scanning-alerts }}
|
||||
{{ site.data.reusables.code-scanning.click-alert-in-list }}
|
||||
5. Use the "Close" drop-down, and click a reason for closing the alert.
|
||||
![Choosing reason for closing the alert via the "Close" drop-down](/assets/images/help/repository/code-scanning-alert-close-drop-down.png)
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Running code scanning in your CI system](/github/finding-security-vulnerabilities-and-errors-in-your-code/running-code-scanning-in-your-ci-system)"
|
||||
- "[{{ site.data.variables.product.prodname_code_scanning_capc }} API](/v3/code-scanning)"
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
title: Managing code scanning alerts for your repository
|
||||
shortTitle: Managing alerts
|
||||
intro: 'You can view, fix, and close alerts for potential vulnerabilities or errors in your project''s code.'
|
||||
product: '{{ site.data.reusables.gated-features.code-scanning }}'
|
||||
permissions: 'People with write permission to a repository can manage {{ site.data.variables.product.prodname_code_scanning }} alerts for the repository.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
redirect_from:
|
||||
- /github/managing-security-vulnerabilities/managing-alerts-from-automated-code-scanning
|
||||
- /github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning
|
||||
---
|
||||
|
||||
{{ site.data.reusables.code-scanning.beta }}
|
||||
{{ site.data.reusables.code-scanning.enterprise-enable-code-scanning }}
|
||||
|
||||
### About alerts from {{ site.data.variables.product.prodname_code_scanning }}
|
||||
|
||||
You can set up {{ site.data.variables.product.prodname_code_scanning }} to check the code in a repository using the default {{ site.data.variables.product.prodname_codeql }} analysis, a third-party analysis, or multiple types of analysis. When the analysis is complete, the resulting alerts are displayed alongside each other in the security view of the repository. Results from third-party tools or from custom queries may not include all of the properties that you see for alerts detected by {{ site.data.variables.product.company_short }}'s default {{ site.data.variables.product.prodname_codeql }} analysis. For more information, see "[Enabling {{ site.data.variables.product.prodname_code_scanning }} for a repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository)."
|
||||
|
||||
By default, {{ site.data.variables.product.prodname_code_scanning }} analyzes your code periodically on the default branch and during pull requests. For information about managing alerts on a pull request, see "[Triaging {{ site.data.variables.product.prodname_code_scanning }} alerts in pull requests](/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests)."
|
||||
|
||||
### About alerts details
|
||||
|
||||
Each alert highlights a problem with the code and the name of the tool that identified it. You can see the line of code that triggered the alert, as well as properties of the alert, such as the severity and the nature of the problem. Alerts also tell you when the issue was first introduced. For alerts identified by {{ site.data.variables.product.prodname_codeql }} analysis, you will also see information on how to fix the problem.
|
||||
|
||||
![Example alert from {{ site.data.variables.product.prodname_code_scanning }}](/assets/images/help/repository/code-scanning-alert.png)
|
||||
|
||||
If you enable {{ site.data.variables.product.prodname_code_scanning }} using {{ site.data.variables.product.prodname_codeql }}, this can also detect 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.
|
||||
|
||||
When {{ site.data.variables.product.prodname_code_scanning }} reports data-flow alerts, {{ site.data.variables.product.prodname_dotcom }} shows you how data moves through the code. {{ site.data.variables.product.prodname_code_scanning_capc }} allows you to identify the areas of your code that leak sensitive information, and that could be the entry point for attacks by malicious users.
|
||||
|
||||
### Viewing an alert
|
||||
|
||||
Anyone with read permission for a repository can see {{ site.data.variables.product.prodname_code_scanning }} alerts on pull requests. However, you need write permission to view a summary of alerts for repository on the **Security** tab. By default, alerts are shown for the default branch.
|
||||
|
||||
{{ site.data.reusables.repositories.navigate-to-repo }}
|
||||
{{ site.data.reusables.repositories.sidebar-security }}
|
||||
{{ site.data.reusables.repositories.sidebar-code-scanning-alerts }}
|
||||
{{ site.data.reusables.code-scanning.click-alert-in-list }}
|
||||
5. Optionally, if the alert highlights a problem with data flow, click **Show paths** to display the path from the data source to the sink where it's used.
|
||||
![Example data-flow alert](/assets/images/help/repository/code-scanning-show-paths.png)
|
||||
|
||||
### Fixing an alert
|
||||
|
||||
Anyone with write permission for a repository can fix an alert by committing a correction to the code. If the repository has {{ site.data.variables.product.prodname_code_scanning }} scheduled to run on pull requests, it's best to raise a pull request with your correction. This will trigger {{ site.data.variables.product.prodname_code_scanning }} analysis of the changes and test that your fix doesn't introduce any new problems. For more information, see "[Configuring {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning)" and "[Triaging {{ site.data.variables.product.prodname_code_scanning }} alerts in pull requests](/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests)."
|
||||
|
||||
### Closing an alert
|
||||
|
||||
Closing an alert is a way to resolve an alert that you don't think needs to be fixed. {{ site.data.reusables.code-scanning.close-alert-examples }}
|
||||
|
||||
{{ site.data.reusables.repositories.navigate-to-repo }}
|
||||
{{ site.data.reusables.repositories.sidebar-security }}
|
||||
{{ site.data.reusables.repositories.sidebar-code-scanning-alerts }}
|
||||
{{ site.data.reusables.code-scanning.click-alert-in-list }}
|
||||
5. Select the Close drop-down menu and click a reason for closing the alert.
|
||||
![Choosing reason for closing the alert via the Close drop-down](/assets/images/help/repository/code-scanning-alert-close-drop-down.png)
|
||||
|
||||
{{ site.data.reusables.code-scanning.false-positive-fix-codeql }}
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[Triaging {{ site.data.variables.product.prodname_code_scanning }} alerts in pull requests](/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests)"
|
||||
- "[Enabling {{ site.data.variables.product.prodname_code_scanning }} for a repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning-for-a-repository)"
|
||||
- "[About integration with {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-integration-with-code-scanning)"
|
|
@ -93,7 +93,7 @@ This example runs {{ site.data.variables.product.prodname_codeql }} analysis on
|
|||
> Successfully uploaded results
|
||||
```
|
||||
|
||||
The server has access to download the {{ site.data.variables.product.prodname_codeql }} bundle directly from the `github/codeql-action` repository on {{ site.data.variables.product.prodname_dotcom_the_website}}{% if currentVersion != "free-pro-team@latest" %} or mirrored on {{ site.data.variables.product.product_location }}{% endif %}, so there is no need to use the `--codeql-path` flag. When the analysis is complete, the {{ site.data.variables.product.prodname_codeql_runner }} uploads the results to the {{ site.data.variables.product.prodname_code_scanning }} view. For more information, see "[Managing alerts from {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
The server has access to download the {{ site.data.variables.product.prodname_codeql }} bundle directly from the `github/codeql-action` repository on {{ site.data.variables.product.prodname_dotcom_the_website}}{% if currentVersion != "free-pro-team@latest" %} or mirrored on {{ site.data.variables.product.product_location }}{% endif %}, so there is no need to use the `--codeql-path` flag. When the analysis is complete, the {{ site.data.variables.product.prodname_codeql_runner }} uploads the results to the {{ site.data.variables.product.prodname_code_scanning }} view. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
#### Compiled language example
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ To upload a SARIF file from a third-party static code analysis engine, you'll ne
|
|||
|
||||
If you're using {{ site.data.variables.product.prodname_actions}} with the {{ site.data.variables.product.prodname_codeql_workflow }} or using the {{ site.data.variables.product.prodname_codeql_runner }}, then the {{ site.data.variables.product.prodname_code_scanning }} results will automatically use the supported subset of SARIF 2.1.0. For more information, see "[Enabling {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/enabling-code-scanning)" or "[Running code scanning in your CI system](/github/finding-security-vulnerabilities-and-errors-in-your-code/running-code-scanning-in-your-ci-system)."
|
||||
|
||||
{{ site.data.variables.product.prodname_dotcom }} uses properties in the SARIF file to display alerts. For example, the `shortDescription` and `fullDescription` appear at the top of a {{ site.data.variables.product.prodname_code_scanning }} alert. The `location` allows {{ site.data.variables.product.prodname_dotcom }} to show annotations in your code file. For more information, see "[Managing alerts from {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
{{ site.data.variables.product.prodname_dotcom }} uses properties in the SARIF file to display alerts. For example, the `shortDescription` and `fullDescription` appear at the top of a {{ site.data.variables.product.prodname_code_scanning }} alert. The `location` allows {{ site.data.variables.product.prodname_dotcom }} to show annotations in your code file. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
If you're new to SARIF and want to learn more, see Microsoft's [`SARIF tutorials`](https://github.com/microsoft/sarif-tutorials) repository.
|
||||
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
---
|
||||
title: Triaging code scanning alerts in pull requests
|
||||
shortTitle: Triaging alerts
|
||||
intro: 'When {{ site.data.variables.product.prodname_code_scanning }} identifies a problem in a pull request, you can review the highlighted code and resolve the alert.'
|
||||
product: '{{ site.data.reusables.gated-features.code-scanning }}'
|
||||
permissions: 'People with write permission to a repository can resolve {{ site.data.variables.product.prodname_code_scanning }} alerts.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.22'
|
||||
---
|
||||
|
||||
{{ site.data.reusables.code-scanning.beta }}
|
||||
{{ site.data.reusables.code-scanning.enterprise-enable-code-scanning-actions }}
|
||||
|
||||
### About {{ site.data.variables.product.prodname_code_scanning }} results on pull requests
|
||||
|
||||
In repositories where {{ site.data.variables.product.prodname_code_scanning }} is configured as a pull request check, {{ site.data.variables.product.prodname_code_scanning }} checks the code in the pull request. By default, this is limited to pull requests that target the default branch or protected branches, but you can change this configuration within {{ site.data.variables.product.prodname_actions }} or in a third-party CI/CD system. If merging the changes would introduce new {{ site.data.variables.product.prodname_code_scanning }} alerts to the target branch, these are reported as check results in the pull request. The alerts are also shown as annotations in the **Files changed** tab of the pull request. If you have write permission for the repository, you can see any existing {{ site.data.variables.product.prodname_code_scanning }} alerts on the **Security** tab. For information about repository alerts, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
If {{ site.data.variables.product.prodname_code_scanning }} has any results with a severity of `error`, the check fails and the error is reported in the check results. If all the results found by {{ site.data.variables.product.prodname_code_scanning }} have lower severities, the alerts are treated as warnings or notices and the check succeeds. If your pull request targets a protected branch, and the repository owner has configured required status checks, then you must either fix or close any error alerts before the pull request can be merged. For more information, see "[About required status checks](/github/administering-a-repository/about-required-status-checks)."
|
||||
|
||||
![Example pull request check status with {{ site.data.variables.product.prodname_code_scanning }} alert](/assets/images/help/repository/code-scanning-check-failure.png)
|
||||
|
||||
### About {{ site.data.variables.product.prodname_code_scanning }} as a pull request check
|
||||
|
||||
There are many options for configuring {{ site.data.variables.product.prodname_code_scanning }} as a pull request check, so the exact setup of each repository will vary and some will have more than one check. The check that contains the results of {{ site.data.variables.product.prodname_code_scanning }} is: **Code scanning results**.
|
||||
|
||||
If the repository uses the {{ site.data.variables.product.prodname_codeql_workflow }} a **{{ site.data.variables.product.prodname_codeql }} / Analyze (LANGUAGE)** check is run for each language before the results check runs. The analysis check may fail if there are configuration problems, or if the pull request breaks the build for a language that the analysis needs to compile (for example, C/C++, C#, or Java). As with other pull request checks, you can see full details of the check failure on the **Checks** tab. For more information about configuring and troubleshooting, see "[Configuring {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning)" or "[Troubleshooting {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning)."
|
||||
|
||||
### Triaging an alert on your pull request
|
||||
|
||||
When you look at the **Files changed** tab for a pull request, you see annotations for any lines of code that triggered the alert.
|
||||
|
||||
![Example {{ site.data.variables.product.prodname_code_scanning }} alert shown as an annotation in the "Files changed" view of a pull request](/assets/images/help/repository/code-scanning-pr-annotation.png)
|
||||
|
||||
Some annotations contain links with extra context for the alert. In the example above, from {{ site.data.variables.product.prodname_codeql }} analysis, you can click **user-provided value** to see where the untrusted data enters the data flow (this is referred to as the source). In this case you can view the full path from the source to the code that uses the data (the sink) by clicking **Show paths**. This makes it easy to check whether the data is untrusted or if the analysis failed to recognize a data sanitization step between the source and the sink. For information about analyzing data flow using {{ site.data.variables.product.prodname_codeql }}, see "[About data flow analysis](https://help.semmle.com/QL/learn-ql/intro-to-data-flow.html)."
|
||||
|
||||
For more information about an alert, click **Show more details** on the annotation. This allows you to see all of the context and metadata provided by the tool in an alert view. In the example below, you can see tags showing the severity, type, and relevant common weakness enumerations (CWEs) for the problem. The view also shows which commit introduced the problem.
|
||||
|
||||
Alerts from some tools, like {{ site.data.variables.product.prodname_codeql }}, also include a description and a **Show more** link for guidance on how to fix the problem in the code.
|
||||
|
||||
![Example of "Show more details" for a {{ site.data.variables.product.prodname_code_scanning }} alert in a pull request](/assets/images/help/repository/code-scanning-pr-alert.png)
|
||||
|
||||
### Resolving an alert on your pull request
|
||||
|
||||
Anyone with write permission for a repository can resolve alerts on a pull request. If you commit changes to the pull request this triggers a new run of the pull request checks. If your changes fix the problem, the alert is resolved and the annotation removed.
|
||||
|
||||
If you don't think that an alert needs to be fixed, you can close the alert manually. {{ site.data.reusables.code-scanning.close-alert-examples }} The **Close** button is available in annotations and in the alerts view if you have write permission for the repository.
|
||||
|
||||
{{ site.data.reusables.code-scanning.false-positive-fix-codeql }}
|
|
@ -16,7 +16,7 @@ versions:
|
|||
|
||||
### About SARIF file uploads for {{ site.data.variables.product.prodname_code_scanning }}
|
||||
|
||||
{{ site.data.variables.product.prodname_dotcom }} creates {{ site.data.variables.product.prodname_code_scanning }} alerts in a repository using information from Static Analysis Results Interchange Format (SARIF) files. SARIF files can be uploaded to a repository using the API or {{ site.data.variables.product.prodname_actions }}. For more information, see "[Managing alerts from {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-alerts-from-code-scanning)."
|
||||
{{ site.data.variables.product.prodname_dotcom }} creates {{ site.data.variables.product.prodname_code_scanning }} alerts in a repository using information from Static Analysis Results Interchange Format (SARIF) files. SARIF files can be uploaded to a repository using the API or {{ site.data.variables.product.prodname_actions }}. For more information, see "[Managing {{ site.data.variables.product.prodname_code_scanning }} alerts for your repository](/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository)."
|
||||
|
||||
You can generate SARIF files using many static analysis security testing tools, including {{ site.data.variables.product.prodname_codeql }}. The results must use SARIF version 2.1.0. For more information, see "[About SARIF support for {{ site.data.variables.product.prodname_code_scanning }}](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-sarif-support-for-code-scanning)."
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
1. Under "Code scanning", click the alert you'd like to view.
|
||||
1. Under "Code scanning," click the alert you'd like to explore.
|
||||
![List of alerts from {{ site.data.variables.product.prodname_code_scanning }}](/assets/images/help/repository/code-scanning-click-alert.png)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
For example, an error in code that's used only for testing, or when the effort of fixing the error is greater than the potential benefit of improving the code.
|
|
@ -0,0 +1 @@
|
|||
If you close a {{ site.data.variables.product.prodname_codeql }} alert as a false positive result, for example because the code uses a sanitization library that isn't supported, consider contributing to the {{ site.data.variables.product.prodname_codeql }} repository and improving the analysis. For more information about {{ site.data.variables.product.prodname_codeql }}, see "[Contributing to {{ site.data.variables.product.prodname_codeql }}](https://github.com/github/codeql/blob/main/CONTRIBUTING.md)."
|
Загрузка…
Ссылка в новой задаче