Skip to content

Commit 3df2e10

Browse files
authored
chore: Revert updates to honor maintenance mode (#85)
1 parent 4f14c40 commit 3df2e10

16 files changed

+353
-685
lines changed

.github/steps/-step.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

.github/steps/0-welcome.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- readme -->
Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Step 1: Review and add dependencies using dependency graph
22

3+
_Welcome to "Secure your repository's supply chain"! :wave:_
4+
35
**What's the big deal about securing your repository's supply chain?**: With the accelerated use of open source, most projects depend on hundreds of open-source dependencies. This poses a security problem: what if the dependencies you're using are vulnerable? You could be putting your users at risk of a supply chain attack. One of the most important things you can do to protect your supply chain is to patch your vulnerable dependencies and replace any malware.
46

57
GitHub offers a range of features to help you understand the dependencies in your environment, know about vulnerabilities in those dependencies, and patch them. The supply chain features on GitHub are:
@@ -20,32 +22,28 @@ GitHub offers a range of features to help you understand the dependencies in you
2022

2123
**We recommend opening another browser tab to work through the following activities so you can keep these instructions open for reference.**
2224

23-
>[!NOTE]
24-
> Dependency graph is enabled by default for all new public repositories.
25+
Dependency graph is enabled by default for all new public repositories. If you're working in a public repository, you can go straight to "Activity 1.2: Add a new dependency and view your dependency graph." For private or internal repositories, you'll need to enable Dependency graph.
2526

2627
1. Navigate to the **Settings** tab.
27-
1. Click **Advanced Security**.
28-
1. Verify **Dependency Graph** is **Enabled**
28+
1. Click **Code security and analysis**.
29+
1. **Enable** "Dependency graph."
2930

3031
### :keyboard: Activity 1.2: Add a new dependency and view your dependency graph
3132

3233
1. Navigate to the **Code** tab and locate the `code/src/AttendeeSite` folder.
33-
1. Commit the following content on the `main` branch to the `package-lock.json` file as the last item on the `dependencies` map _(after the third to last bracket `}` and before the last two brackets)_
34-
35-
> 🪧 **Note:** You can edit and commit the file on github.com directly or hit the `.` key to open the lightweight editor to edit and commit changes.
36-
37-
```json
38-
,
34+
1. Add the following content to the `package-lock.json` file after the third to last bracket `}` and before the last two brackets.
35+
```
36+
,
3937
"follow-redirects": {
4038
"version": "1.14.1",
4139
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
4240
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
4341
}
44-
```
45-
42+
```
4643
1. Navigate to the **Insights** tab.
4744
1. Select **Dependency graph** from the side navigation bar.
4845
1. Review all the dependencies on the **Dependencies** tab.
4946
1. Search for `follow-redirects` and review the new dependency you just added.
5047
![Screen Shot showing the "follow-redirects" dependency.](https://user-images.githubusercontent.com/6351798/196288729-734e3319-c5d7-4f35-a19c-676c12f0e27d.png)
51-
1. With the new dependency added, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
48+
49+
Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to display the next step.

.github/steps/2-dependabot-alerts.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ _Nice work! :tada: You added and viewed a dependency using Dependency graph!_
44

55
Given how many dependencies our repository uses, maintaining them needs to become an automated task. Keeping our code secure is a top priority, so the first thing we need to do is set up a way to be notified when a dependency we are using is vulnerable or malware. We can do this by enabling Dependabot alerts.
66

7-
**What are Dependabot alerts?**
8-
9-
Dependabot alerts tell you that your code depends on a package that is insecure. These Dependabot alerts reference the [GitHub Advisory Database](https://github.com/advisories), which contains a list of known security vulnerabilities and malware, grouped in two categories: **GitHub reviewed advisories** and **unreviewed advisories**.
7+
**What are Dependabot alerts?**: Dependabot alerts tell you that your code depends on a package that is insecure. These Dependabot alerts reference the [GitHub Advisory Database](https://github.com/advisories), which contains a list of known security vulnerabilities and malware, grouped in two categories: **GitHub reviewed advisories** and **unreviewed advisories**.
108

119
If your code depends on a package that has a security vulnerability, this can cause a range of problems for your project or the people who use it. You should upgrade to a secure version of the package as soon as possible. If your code uses malware, you need to replace the package with a secure alternative.
1210

@@ -26,7 +24,7 @@ Let's enable Dependabot alerts on our repository!
2624
### :keyboard: Activity 2.2: Enable Dependabot alerts
2725

2826
1. Navigate to the **Settings** tab.
29-
1. Display the settings for **Advanced Security**.
27+
1. Display the settings for **Code security and analysis**.
3028
1. **Enable** Dependabot alerts.
3129
1. **Wait about 60 seconds for Dependabot to check for alerts.**
3230
1. Navigate to the **Security** tab.
@@ -44,4 +42,5 @@ Let's see how this would work by using Dependabot to create a pull request for o
4442
1. Click the **Review security update** button to display the pull request.
4543
- You can view the pull request and **Files changed** tab to review the update.
4644
1. Navigate back to the **Conversation** tab and merge the pull request.
47-
1. With the pull request merged, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
45+
46+
Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to display the next step.

.github/steps/3-dependabot-security.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@ _Nice work enabling, viewing, and creating Dependabot alerts :sparkles:_
44

55
Enabling Dependabot alerts on our repository was a great step toward improving our code security, but we still had to manually select an alert and then manually select the option to create the pull request. It would be nice to further improve the automation and maintenance of our dependencies! Well, with Dependabot security updates, we can do just that.
66

7-
**What are Dependabot security updates?**
8-
9-
When this feature is enabled, Dependabot detects *and* fixes vulnerable dependencies for you by opening pull requests automatically to resolve Dependabot alerts.
7+
**What are Dependabot security updates?**: When this feature is enabled, Dependabot detects *and* fixes vulnerable dependencies for you by opening pull requests automatically to resolve Dependabot alerts.
108

119
We manually created a pull request to fix the "Prototype Pollution in minimist" alert, but let's enable Dependabot security updates to automate this process for future alerts!
1210

1311
### :keyboard: Activity 3.1: Enable and trigger Dependabot security updates
1412

15-
1. Navigate to the **Settings** tab and select **Advanced Security**.
16-
1. Enable **Dependabot security updates**. You may need to wait 30-60 seconds before you see any new pull requests.
17-
1. Navigate to the **Pull requests** repository tab to view the what Dependabot has found.
18-
1. Find the new pull request that requests to patch the **axios** dependency.
13+
1. Navigate to the **Settings** tab and select **Code security and analysis**.
14+
1. Enable Dependabot security updates. You may need to wait 30-60 seconds before you see any new pull requests.
15+
1. Navigate to the **Pull requests** repository tab and select the newly created pull request that updates axios from version 0.21.1 to a patched version.
1916
1. Review and merge the pull request.
20-
1. With the pull request merged, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
17+
18+
Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update this page to display the next step.

.github/steps/4-dependabot-versions.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ _Nicely done!_ :partying_face:
44

55
You now have automated the process for Dependabot to alert you to vulnerabilities with your dependencies and to create pull requests to update them to secure versions! At this point, you only need to review the pull request and then merge it to stay on top of security problems with Dependencies.
66

7-
> [!NOTE]
8-
> Did you notice that there were several pull requests suggested by Dependabot? You only merged the one related to the **axios** dependency, but the others disappeared from the **Pull requests** panel. That's because the upgrade of the axios dependency triggered changes of other transitive dependencies, that might be either removed or updated to other versions. Whenever there is a change in your dependency graph, Dependabot will automatically review the existing pull requests and close the ones that are no longer relevant. So don't merge everything at once, let Dependabot do the job for you!
9-
<img width="955" alt="Screenshot showing that the axios PR was merged and that the 2 others were closed" src="https://github.com/user-attachments/assets/6c97f90b-c6e2-4865-b1eb-dd7053383f07" />
10-
11-
127
The security updates feature helps automate the process to resolve alerts, but what about just keeping up-to-date with version updates? We can also automate pull request generation for updated versions of dependencies using the Dependabot version updates feature.
138

149
**What are Dependabot version updates?**: In addition to security alerts, Dependabot can also take the effort out of maintaining your dependencies. You can use it to ensure that your repository automatically keeps up with the latest releases of the packages and applications it depends on. Similar to security alerts, Dependabot will identify an outdated dependency and create a pull request to update the manifest to the latest version of the dependency.
@@ -17,11 +12,16 @@ Let's see how this works!
1712

1813
### :keyboard: Activity 4.1: Enable and trigger Dependabot version updates
1914

20-
1. Navigate to the **Settings** tab and select **Advanced Security**.
21-
1. Locate **Dependabot version updates** and click **Configure** to open a new file editor with pre-poplulated contents. The file is called `dependabot.yml`.
15+
1. Navigate to the **Settings** tab and select **Code security and analysis**.
16+
1. Locate "Dependabot version updates" and click **Configure** to open a new file editor with pre-poplulated contents. The file is called `dependabot.yml`.
2217
1. Notice that the file is prepopulated to update the GitHub actions in the repository, the `github-actions` package ecosystem.
23-
1. Edit your `dependabot.yml` configuration file to include another entry. It should look like:
24-
18+
1. Copy the lines that define the GitHub actions updates and append them to the file.
19+
1. Edit your copy of the content:
20+
- Change the `package-ecosystem` to `nuget`.
21+
- Change the `directory` to `/code/`.
22+
- Change the `interval` to `weekly`.
23+
24+
The `dependabot.yml` file should now look like this.
2525
```yaml
2626
version: 2
2727
updates:
@@ -33,14 +33,11 @@ Let's see how this works!
3333
directory: "/code/"
3434
schedule:
3535
interval: "weekly"
36-
```
37-
38-
> 💡 **Tip:** While, you can edit and commit a file directly on github.com, you can also press the period key `.` to open a lightweight VS Code editor directly in browser.
39-
36+
```
4037
1. Commit your changes directly to the `main` branch.
41-
1. With the configuration file updated, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson.
4238

4339
You have now configured Dependabot version updates to run and check for updates as follows:
44-
4540
- Check once a month for updates to GitHub Actions and create pull requests to update any that are out of date.
4641
- Check once a week for updates to .NET packages and create pull requests to update any that are out of date. By default, this check runs on a Monday, to run the check on a different day, see [schedule.day](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#scheduleday).
42+
43+
Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to display the next step.

.github/steps/x-review.md renamed to .github/steps/X-finish.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
## Review
1+
## Finish
22

3-
_Congratulations, you've completed this exercise and learned a lot securing your supply chain!_
3+
_Congratulations friend, you've completed this course!_
4+
5+
<img src="https://octodex.github.com/images/welcometocat.png" alt=celebrate width=300 align=right>
46

5-
<img src="https://octodex.github.com/images/jetpacktocat.png" alt="celebrate" width=200 align=right>
67
Here's a recap of all the tasks you've accomplished in your repository:
78

89
- You've learned how to view and use dependency graph.
@@ -21,6 +22,7 @@ Here's a recap of all the tasks you've accomplished in your repository:
2122
### What's next?
2223

2324
- Learn more about securing your supply chain by reading: [Securing your supply chain](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-supply-chain-security).
24-
- Check out other security focused [GitHub Skills exercises](https://skills.github.com/#code-security-and-analysis).
25+
- [We'd love to hear what you thought of this course](https://github.com/skills/.github/discussions).
26+
- [Learn another GitHub skill](https://github.com/skills).
2527
- [Read the Get started with GitHub docs](https://docs.github.com/en/get-started).
2628
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).

.github/workflows/0-start-exercise.yml

Lines changed: 0 additions & 89 deletions
This file was deleted.

.github/workflows/0-welcome.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Step 0, Welcome
2+
3+
# This step triggers after the learner creates a new repository from the template.
4+
# This workflow updates from step 0 to step 1.
5+
6+
# This will run every time we create push a commit to `main`.
7+
# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
8+
on:
9+
workflow_dispatch:
10+
push:
11+
branches:
12+
- main
13+
14+
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
15+
permissions:
16+
# Need `contents: read` to checkout the repository.
17+
# Need `contents: write` to update the step metadata.
18+
contents: write
19+
20+
jobs:
21+
# Get the current step to only run the main job when the learner is on the same step.
22+
get_current_step:
23+
name: Check current step number
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- id: get_step
29+
run: |
30+
echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
31+
outputs:
32+
current_step: ${{ steps.get_step.outputs.current_step }}
33+
34+
on_start:
35+
name: On start
36+
needs: get_current_step
37+
38+
# We will only run this action when:
39+
# 1. This repository isn't the template repository.
40+
# 2. The step is currently 0.
41+
# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
42+
# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
43+
if: >-
44+
${{ !github.event.repository.is_template
45+
&& needs.get_current_step.outputs.current_step == 0 }}
46+
47+
# We'll run Ubuntu for performance instead of Mac or Windows.
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
# We'll need to check out the repository so that we can edit the README.
52+
- name: Checkout
53+
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0 # Let's get all the branches.
56+
57+
# In README.md, switch step 0 for step 1.
58+
- name: Update to step 1
59+
uses: skills/action-update-step@v2
60+
with:
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
from_step: 0
63+
to_step: 1

0 commit comments

Comments
 (0)