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
8. On the next screen, use the Copilot icon to generate a pull request description. Use either outline or summary.
31
+
8. On the next screen, use the Copilot icon in the formatting bar to generate a pull request description.
32
32
33
33
<details>
34
34
<imgsrc="images/lab-4-1-3.png"/>
35
35
</details>
36
36
37
37
9. Click **Create pull request**.
38
38
10. Wait for the code scanning job to finish. It will take a few minutes to run.
39
-
40
-
- You will notice that the Dependency Review workflow ran against this PR and found nothing wrong.
39
+
- You will notice that the Dependency Review workflow ran against this PR and didn't report any issues.
41
40
42
41
<details>
43
42
<imgsrc="images/lab-4-1-4.png"/>
44
43
</details>
45
44
46
45
11. Merge the PR once the code scanning completes.
47
46
12. Navigate to **Settings** of the repo.
48
-
13. Navigate to **Rules --> Rulesets** again to modify the existing ruleset you created in lab 3.
49
-
14. Under the **Require status checks to pass**, click on the **Show additional settings** button.
50
-
15. Click on **Add checks**.
51
-
16. Search for `dependency-review` and add it (it should show up under **suggestions**).
47
+
13. Navigate to **Rules --> Rulesets**.
48
+
14. Click on the name of the ruleset you created in lab 3 to modify it.
49
+
15. Under the **Require status checks to pass**, click on the **Show additional settings** button.
50
+
16. Click on **Add checks**.
51
+
17. Search for `dependency-review` and add it (it should show up under **suggestions**).
52
52
53
53
<details>
54
54
<imgsrc="images/lab-4-1-5.png"/>
55
55
</details>
56
56
57
-
17. Save the changes to the ruleset.
57
+
18. Save the changes to the ruleset.
58
58
59
59
## Exercise 2: Introduce a dependency vulnerability
60
60
61
61
Now, let's attempt to add a vulnerable dependency to the codebase and test out the dependency review feature.
62
62
63
-
1. In the repository, navigate to the **Settings** page.
64
-
2. ❗️ Scroll down to under the **Pull requests** settings section and check the box for **Always suggest updating pull request branches**. ❗️
65
-
66
-
<details>
67
-
<imgsrc="images/lab-4-2-1.png"/>
68
-
</details>
69
-
70
-
3. Navigate back to the **Code** tab in the repo.
71
-
4. Click the **package.json** file to open it
72
-
5. Click the pencil icon at the top right of the file to go into edit mode
73
-
6. Go to the end of line 181 and hit Enter to create a blank line for line 182
74
-
7. Add the following code to line 182:
63
+
1. Navigate back to the **Code** tab in the repo.
64
+
2. Click the **package.json** file in the root of the repository to open it.
65
+
3. Click the **pencil** ✏️ icon at the top right of the file to go into edit mode.
66
+
4. Go to the end of line 181 and hit Enter to create a blank line for line 182.
67
+
5. Add the following code to line 182, making sure to include the comma at the end of the line:
75
68
76
69
```
77
70
"tar": "2.2.2",
78
71
```
79
72
80
-
8. Click the **Commit changes** button.
81
-
9. Change the branch name to **lab4/dependency-vulnerability** and click **Propose changes** to start a pull request
82
-
10. Switch to the `lab4/dependency-vulnerability` branch.
83
-
- You can change to this branch by selecting the **main** dropdown below the repository name when under the **Code** tab.
84
-
11. Open up the `package.json` file in the repository root.
85
-
12. Navigate to line 182 and review this line - this branch has a change to introduce the `"tar": "2.2.2"` package to the codebase - a package with a known vulnerability.
86
-
87
73
<details>
88
-
<imgsrc="images/lab-4-2-2.png"/>
74
+
<imgsrc="images/lab-4-2-1.png"/>
89
75
</details>
90
76
91
-
7. Create a pull request by navigating the the **Pull requests** tab and clicking on the **New pull request** button.
92
-
8. Use Copilot to generate a PR summary for you
93
-
9. Click the **Create pull request** button
77
+
6. Click the **Commit changes** button.
78
+
7. Change the branch name to **lab4/dependency-vulnerability** and click **Propose changes** to start a pull request.
79
+
8. Use the **Copilot** button in the formatting bar to generate a PR summary for you.
80
+
9. Click the **Create pull request** button.
94
81
10. Wait for the dependency review job to finish.
95
-
11. It should make a comment to the pull request with a note that it found a vulnerable package dependency. In fact, adding this one vulnerable package would introduce 3 new vulnerabilities to our codebase.
82
+
11. It should make a comment to the pull request with a note that it found a vulnerable package dependency. In fact, adding this one package would introduce 3 new vulnerabilities to our codebase.
96
83
97
84
<details>
98
-
<imgsrc="images/lab-4-2-3.png"/>
85
+
<imgsrc="images/lab-4-2-2.png"/>
99
86
</details>
100
87
101
-
13. Also, the status check will be marked as failed, preventing the pull request from being merged.
88
+
12. Also, the status check will be marked as failed, preventing the pull request from being merged.
102
89
103
90
## Summary
104
91
105
92
Celebrate 🎉! We just prevented a security vulnerability from entering our codebase! Without dependency review, if a pull request from this branch was opened to main, nothing would prevent the vulnerability from being introduced.
106
93
107
94
In the next lab, we are going to go hands-on with secret scanning, and see how we can use push protection to stop secrets from being pushed to GitHub.
95
+
96
+
➡️ Head back to the [labs](README.md) page to continue on to the next lab.
0 commit comments