Nota: Escaneo de código se encuentra acutalmente en beta y está sujeto a cambios. To request access to the beta, join the waitlist.
You can set up escaneo de código 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. For more information, see "Setting up escaneo de código for a repository."
By default, escaneo de código analyzes your code periodically on the default branch and during pull requests. For information about managing alerts on a pull request, see "Triaging escaneo de código alerts in pull requests."
Note: SARIF upload supports a maximum of 1000 results per upload. Any results over this limit are ignored. If a tool generates too many results, you should update the configuration to focus on results for the most important rules or queries.
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 set up escaneo de código 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 escaneo de código reports data-flow alerts, GitHub shows you how data moves through the code. Escaneo de código 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.
Anyone with read permission for a repository can see escaneo de código annotations on pull requests. For more information, see "Triaging escaneo de código alerts in pull requests."
You need write permission to view a summary of all the alerts for a repository on the Security tab. By default, alerts are shown for the default branch.
- En GitHub, visita la página principal del repositorio.
- Debajo de tu nombre de repositorio, da clic en Seguridad.
- En la barra lateral izquierda, da clic en alertas de escaneo de código. Opcionalmente, selecciona la herramienta de escaneo de código que utilizaste.
- Under "Escaneo de código," click the alert you'd like to explore.
- 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.
- Alerts from CodeQL analysis include a description of the problem. Click Show more for guidance on how to fix your code.
Anyone with write permission for a repository can fix an alert by committing a correction to the code. If the repository has escaneo de código scheduled to run on pull requests, it's best to raise a pull request with your correction. This will trigger escaneo de código analysis of the changes and test that your fix doesn't introduce any new problems. For more information, see "Configuring escaneo de código" and "Triaging escaneo de código alerts in pull requests."
If you have write permission for a repository, you can view fixed alerts by viewing the summary of alerts and clicking Closed. For more information, see "Viewing the alerts for a repository." The "Closed" list shows fixed alerts and alerts that users have dismissed.
Alerts may be fixed in one branch but not in another. You can use the "Branch" drop-down menu, on the summary of alerts, to check whether an alert is fixed in a particular branch.
There are two ways of closing an alert. You can fix the problem in the code, or you can dismiss the alert. Alternatively, if you have admin permissions for the repository, you can delete alerts. Deleting alerts is useful in situations where you have set up a escaneo de código tool and then decided to remove it, or where you have configured CodeQL analysis with a larger set of queries than you want to continue using, and you've then removed some queries from the tool. In both cases, deleting alerts allows you to clean up your escaneo de código results. You can delete alerts from the summary list within the Security tab.
Dismissing an alert is a way of closing 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. You can dismiss alerts from escaneo de código annotations in code, or from the summary list within the Security tab.
When you dismiss an alert:
- It's dismissed in all branches.
- The alert is removed from the number of current alerts for your project.
- The alert is moved to the "Closed" list in the summary of alerts, from where you can reopen it, if required.
- The reason why you closed the alert is recorded.
- Next time escaneo de código runs, the same code won't generate an alert.
When you delete an alert:
- It's deleted in all branches.
- The alert is removed from the number of current alerts for your project.
- It is not added to the "Closed" list in the summary of alerts.
- If the code that generated the alert stays the same, and the same escaneo de código tool runs again without any configuration changes, the alert will be shown again in your analysis results.
To dismiss or delete alerts:
En GitHub, visita la página principal del repositorio.
Debajo de tu nombre de repositorio, da clic en Seguridad.
En la barra lateral izquierda, da clic en alertas de escaneo de código. Opcionalmente, selecciona la herramienta de escaneo de código que utilizaste.
If you have admin permissions for the repository, and you want to delete alerts for this escaneo de código tool, select some or all of the check boxes and click Delete.
Optionally, you can use the filters to display a subset of alerts and then delete all matching alerts at once. For example, if you have removed a query from CodeQL analysis, you can use the "Rule" filter to list just the alerts for that query and then select and delete all of those alerts.
If you want to dismiss an alert, it's important to explore the alert first, so that you can choose the correct dismissal reason. Click the alert you'd like to explore.
Review the alert, then click Dismiss and choose a reason for closing the alert.
It's important to choose the appropriate reason from the drop-down menu as this may affect whether a query continues to be included in future analysis.
If you dismiss 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."
If a project has multiple alerts that you want to dismiss for the same reason, you can bulk dismiss them from the summary of alerts. Typically, you'll want to filter the list and then dismiss all of the matching alerts. For example, you might want to dismiss all of the current alerts in the project that have been tagged for a particular Common Weakness Enumeration (CWE) vulnerability.