Skip to content

Commit 8d2e388

Browse files
committed
lab 4 updates
1 parent 60c4314 commit 8d2e388

File tree

4 files changed

+23
-34
lines changed

4 files changed

+23
-34
lines changed

_labs/images/lab-4-2-1.png

27.4 KB
Loading

_labs/images/lab-4-2-2.png

155 KB
Loading

_labs/images/lab-4-2-3.png

-206 KB
Binary file not shown.

_labs/lab4.md

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,80 +28,69 @@ First, let's add the dependency review action workflow.
2828
<img src="images/lab-4-1-2.png"/>
2929
</details>
3030

31-
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.
3232

3333
<details>
3434
<img src="images/lab-4-1-3.png"/>
3535
</details>
3636

3737
9. Click **Create pull request**.
3838
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.
4140

4241
<details>
4342
<img src="images/lab-4-1-4.png"/>
4443
</details>
4544

4645
11. Merge the PR once the code scanning completes.
4746
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**).
5252

5353
<details>
5454
<img src="images/lab-4-1-5.png"/>
5555
</details>
5656

57-
17. Save the changes to the ruleset.
57+
18. Save the changes to the ruleset.
5858

5959
## Exercise 2: Introduce a dependency vulnerability
6060

6161
Now, let's attempt to add a vulnerable dependency to the codebase and test out the dependency review feature.
6262

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-
<img src="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:
7568

7669
```
7770
"tar": "2.2.2",
7871
```
7972

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-
8773
<details>
88-
<img src="images/lab-4-2-2.png"/>
74+
<img src="images/lab-4-2-1.png"/>
8975
</details>
9076

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.
9481
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.
9683

9784
<details>
98-
<img src="images/lab-4-2-3.png"/>
85+
<img src="images/lab-4-2-2.png"/>
9986
</details>
10087

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.
10289

10390
## Summary
10491

10592
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.
10693

10794
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

Comments
 (0)