About alerts from code scanning
You can set up code scanning to check the code in a repository using the default 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 GitHub's default CodeQL analysis. The default code scanning workflow uses the on.push
event to trigger a code scan on every push to any branch containing the workflow file.
By default, 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 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 CodeQL analysis, you will also see information on how to fix the problem.
If you enable code scanning using 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 code scanning reports data-flow alerts, GitHub shows you how data moves through the code. Code scanning 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 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.
-
Navigiere in GitHub zur Hauptseite des Repository.
-
Klicke unter Deinem Repository-Namen auf Security (Sicherheit).
-
Klicke in der linken Seitenleiste auf Code scanning alerts (Code-Scan-Warnungen). Wähle optional das von Dir verwendete Code-Scan-Werkzeug aus.
-
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.
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 code scanning scheduled to run on pull requests, it's best to raise a pull request with your correction. This will trigger code scanning analysis of the changes and test that your fix doesn't introduce any new problems. For more information, see "Configuring code scanning" and "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. 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.
-
Navigiere in GitHub zur Hauptseite des Repository.
-
Klicke unter Deinem Repository-Namen auf Security (Sicherheit).
-
Klicke in der linken Seitenleiste auf Code scanning alerts (Code-Scan-Warnungen). Wähle optional das von Dir verwendete Code-Scan-Werkzeug aus.
-
Select the Close drop-down menu and click a reason for closing the alert.
If you close a CodeQL alert as a false positive result, for example because the code uses a sanitization library that isn't supported, consider contributing to the CodeQL repository and improving the analysis. For more information about CodeQL, see "Contributing to CodeQL."