|
2 | 2 |
|
3 | 3 | Now we will review the CodeQL scan results, triage an alert, and create a GitHub issue to track an alert.
|
4 | 4 |
|
5 |
| -### What is GitHub Actions |
6 |
| - |
7 |
| -GitHub Actions is the automation and CI/CD platform within GitHub. We use GitHub Actions to orchestrate and execute security scans with code scanning. GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. For more information on GitHub Actions, see "[Understanding GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)." |
8 |
| - |
9 | 5 | ### What is CWE
|
10 | 6 |
|
11 |
| -Common Weakness Enumeration (CWE) is a category system for hardware and software weaknesses and vulnerabilities. Think of it as a way to describe and categorize security issues in an application's source code. For more information on CWEs, see the Wikipedia article "[Common Weakness Enumeration](https://en.wikipedia.org/wiki/Common_Weakness_Enumeration)." |
| 7 | +Common Weakness Enumeration (CWE) is a category system for hardware and software weaknesses and vulnerabilities. Think of it as a way to describe and categorize security issues in an application's source code. For more information on CWEs, see the Wikipedia article [Common Weakness Enumeration](https://en.wikipedia.org/wiki/Common_Weakness_Enumeration). |
12 | 8 |
|
13 | 9 | ### ⌨️ Activity: View the status of a CodeQL scan
|
14 | 10 |
|
15 |
| -In this activity, we'll explore GitHub Actions to view the status of a CodeQL scan. |
16 |
| - |
17 |
| -1. In your new repository, go to your Actions page by selecting **Actions** from the top navigation bar. If the CodeQL Action run is still executing, you will see a yellow spinner indicating the scan is still in progress. This typically takes about 4 minutes to complete. |
18 |
| - |
19 |
| -1. Select the run by clicking on **CodeQL Setup**. |
| 11 | +1. In the top navigation, select the **Actions** tab. |
20 | 12 |
|
21 |
| - <img width="400" alt="codeql setup" src="https://github.com/user-attachments/assets/016a729e-3b41-466c-8edf-3d4b41a86b7d"/> |
| 13 | +1. If needed, wait a moment for the CodeQL run to finish (about 4 minutes). |
22 | 14 |
|
23 |
| - Notice that more information is available inside the Actions run. Feel free to explore this section to view information such as the CodeQL logs, duration, status, and artifacts generated by CodeQL. |
| 15 | +1. Click on the **CodeQL Setup** workflow run entry to open a page showing more details. |
24 | 16 |
|
25 |
| - Once the scan is complete, a green check will show next to the execution. |
| 17 | + <img width="500" alt="codeql setup" src="https://github.com/user-attachments/assets/016a729e-3b41-466c-8edf-3d4b41a86b7d"/> |
26 | 18 |
|
27 |
| -### ⌨️ Activity: View all CodeQL Alerts |
| 19 | + > 💡 Tip: The workflow run contains additional CodeQL information such as the run duration, logs, and analysis artifacts. |
28 | 20 |
|
29 |
| -In this activity, we will view the CodeQL findings in the Security page of your repository. The Security page is where all security related information is displayed. |
| 21 | +### ⌨️ Activity: Review an Alert |
30 | 22 |
|
31 |
| -1. Navigate to the **Security** tab in the top navigation bar of your repository. |
| 23 | +1. In the top navigation, select the **Security** tab. |
32 | 24 |
|
33 |
| -1. Select **Code scanning** under the "Vulnerability alerts" heading in left-side navigation bar. |
| 25 | +1. In the left navigation, find the **Vulnerability alerts** area and select the **Code scanning** option. |
34 | 26 |
|
35 |
| - This screen will contain all the vulnerabilities identified by CodeQL inside this repository's codebase. Explore the different filters and search capabilities in this page. These filtering capabilities become very helpful when you're working with many findings! |
| 27 | +1. (Optional) Use the filters and search bar to explore the open and closed security alerts, including from the CodeQL scan. |
36 | 28 |
|
37 |
| -### ⌨️ Activity 3: Review an Alert |
| 29 | +#### Alert status and location |
38 | 30 |
|
39 |
| -In this activity, we will explore the alert UI. We'll review the data flow of the vulnerability, identify what part of the code the alert impacts, and get more information about the alert. |
| 31 | +The main area of the alert provides the resolution status, affected branch, code location, and classification information like severity and [CVE identification number](https://docs.github.com/en/code-security/security-advisories/working-with-repository-security-advisories/about-repository-security-advisories#cve-identification-numbers). |
40 | 32 |
|
41 |
| -**Alert status:** This section displays the current alert status (open or closed), identifies the branch where the scan detected the alert, and shows the timestamp of the alert. |
| 33 | +> 💡 Tip: Clicking the **Show paths** link will provide additional insights about the alert's data flow from user input (source), through the application, and when it is acted on (sink). |
42 | 34 |
|
43 |
| -<img width="400" alt="alert status" src="https://github.com/user-attachments/assets/2fecc67d-52ef-44fc-ad89-1eb28ceb9437"> |
| 35 | +<img width="500" alt="alert status" src="https://github.com/user-attachments/assets/2fecc67d-52ef-44fc-ad89-1eb28ceb9437"> |
44 | 36 |
|
45 |
| -**Location information:** This section describes which part of the code is vulnerable. |
| 37 | +<img width="500" alt="location information" src="https://github.com/user-attachments/assets/1a450118-f200-436b-8433-04b7e5e4f1a8"/> |
46 | 38 |
|
47 |
| -<img width="400" alt="location information" src="https://github.com/user-attachments/assets/1a450118-f200-436b-8433-04b7e5e4f1a8"/> |
| 39 | +<img width="500" alt="additional information" src="https://github.com/user-attachments/assets/9a5aaf3f-e063-4d07-8cdd-6272eec8a411"/> |
48 | 40 |
|
49 |
| -**Paths:** Clicking on "Show paths" will give you additional insights into the alert's data flow. The modal shows us where the user input (we call that a "source") flows through the application until it's acted on (we call this the "sink"). This visualizes the flow of data through your application. |
| 41 | +#### Explanation and Recommendation |
50 | 42 |
|
51 |
| -**Recommendations:** This section provides a quick overview of the tool (CodeQL in this case), Rule ID, and even allows you to view the CodeQL query used to find this vulnerability. You can view the query by clicking **View source**. Additionally, this pane includes recommendations for fixing this vulnerability. Click **Show more** to view the full recommendation. |
| 43 | +This alert is further described, justified, and a recommended solution is provided when possible. |
52 | 44 |
|
53 |
| -<img width="400" alt="recommendations" src="https://github.com/user-attachments/assets/a5653b45-b66f-4e5b-8e03-a7b8cd3b91b4"/> |
| 45 | +- Click the **View source** link to view the CodeQL query that detected the alert. |
| 46 | +- Click the **Show more** link to view the full recommendation. |
54 | 47 |
|
55 |
| -**Audit trail:** The audit trail shows the history of the alert. This trail will show the status as users mark an alert as closed or fix an alert in the code. |
| 48 | +<img width="500" alt="recommendations" src="https://github.com/user-attachments/assets/a5653b45-b66f-4e5b-8e03-a7b8cd3b91b4"/> |
56 | 49 |
|
57 |
| -<img width="400" alt="audit trail" src="https://github.com/user-attachments/assets/25ec5256-20c7-4e9d-8160-ff40f3763872"/> |
| 50 | +#### Audit trail |
58 | 51 |
|
59 |
| -**Alert triage:** Use the buttons at the top right of the alert to triage or create a new issue for the alert. Don't do anything yet. We'll get into these buttons in a moment. 😄 |
| 52 | +The audit trail provides a secure history of the alert for future reference, like who marked the vulnerability as closed/fixed. |
60 | 53 |
|
61 |
| -**Additional info:** Finally, the right-side panel contains information such as tags, CWE information, and the severity of the alert |
62 |
| -<img width="400" alt="additional information" src="https://github.com/user-attachments/assets/9a5aaf3f-e063-4d07-8cdd-6272eec8a411"/> |
| 54 | +<img width="500" alt="audit trail" src="https://github.com/user-attachments/assets/25ec5256-20c7-4e9d-8160-ff40f3763872"/> |
63 | 55 |
|
64 | 56 | ### ⌨️ Activity: Dismiss an Alert
|
65 | 57 |
|
66 |
| -Now that we're familiar with the alert layout, let's work through the process of closing one. |
67 |
| - |
68 |
| -1. Inside this same alert, click **Dismiss alert**, choose any reason for dismissal, and add a short note. |
69 |
| - |
70 |
| -1. Click **Dismiss alert**. |
71 |
| - |
72 |
| -1. At this point, the alert will change its state to "Dismissed". You can now see the change you made in the audit trail at the bottom of the alert. |
73 |
| - |
74 |
| -1. Navigate back to **Security** > **Code scanning alerts**. You'll see that you only have 1 alert listed. |
75 |
| - |
76 |
| -1. Click **1 Closed**. This will bring you to the closed alerts where you can view the alert you just closed. |
77 |
| - |
78 |
| - <img width="400" alt="one closed alert" src="https://github.com/user-attachments/assets/b10005b6-9ef8-4d46-a160-4c9849d2c898"/> |
79 |
| - |
80 |
| -1. (Optional) You can also reopen the alert by opening it, then selecting **Reopen alert**. |
81 |
| - |
82 |
| -### ⌨️ Activity: Create a GitHub Issue for an Alert |
83 |
| - |
84 |
| -This last step will show you how to create a GitHub Issue to track the work that goes into resolving a vulnerability. Issues provide a space for collaboration for a security problem and can be assigned to people or teams. |
85 |
| - |
86 |
| -1. Open one of the open alerts that CodeQL identified from the scan. |
| 58 | +1. On the alert page, in the top right, click **Dismiss alert** dropdown. |
87 | 59 |
|
88 |
| -1. Click the green **Create issue** button at the top right of the alert. If you don't see this button, check the status of the alert to make sure it's an open alert. |
| 60 | +1. Select any reason and add a short explanation then click the **Dismiss alert** button. |
89 | 61 |
|
90 |
| -1. Add any details you would like to include in the new issue form. |
| 62 | + - The alert state will change to `Dismissed` and an audit trail entry will be added. |
91 | 63 |
|
92 |
| -1. Click **Submit new issue**. |
| 64 | +1. Navigate back to **Security** tab and **Code scanning alerts** area. |
93 | 65 |
|
94 |
| -1. To view the your issue, click **Issues** in the top navigation bar of your repository. |
| 66 | +1. Click the **1 Closed** text to switch to a view showing closed alerts. |
95 | 67 |
|
96 |
| -1. With the new issue opened for managing the fix, Mona will check your progress and share the next steps. |
| 68 | + <img width="500" alt="one closed alert" src="https://github.com/user-attachments/assets/b10005b6-9ef8-4d46-a160-4c9849d2c898"/> |
0 commit comments