Skip to content
This repository was archived by the owner on Sep 1, 2022. It is now read-only.

Commit 273b997

Browse files
authored
Merge pull request #4 from githubtraining/hectorsector-runthrough
Fixes from a full run-through
2 parents 252cbcf + 47c0ffb commit 273b997

11 files changed

+68
-103
lines changed

config.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ steps:
4848
with: 01_closed-issue.md
4949
data:
5050
url: '%actions.firstIssue.data.html_url%'
51-
pages: '%actions.pagesUrl.data.html_url%'
51+
pagesUrl: '%actions.pagesUrl.data.html_url%'
5252

5353
# Step 2
5454
# Learner comments on issue with the recommended updated version
@@ -82,7 +82,7 @@ steps:
8282
right: '%actions.fileContents%'
8383
else:
8484
- type: respond
85-
issue: 4
85+
issue: Update the vulnerable dependency
8686
with: 03_adding-bad-changes.md
8787
- type: removeBranchProtection
8888
- type: respond
@@ -111,7 +111,7 @@ steps:
111111
with: 04_accidental-close.md
112112
- type: updateBranchProtection
113113
- type: createIssue
114-
title: Add dependabot to your repository
114+
title: Add Dependabot to your repository
115115
body: 04_add-dependabot.md #dependabot issue body response
116116
action_id: dependabotIssue
117117
- type: respond
@@ -123,8 +123,8 @@ steps:
123123
# Learner installs dependabot on repository and closes the issue
124124
# Bot creates new issue about adding a security policy with suggested information about the security policy. Prompts learner to merge when ready
125125

126-
- title: Enable dependabot
127-
description: Install dependabot on your repository.
126+
- title: Enable Dependabot
127+
description: Install Dependabot on your repository.
128128
event: issues.closed
129129
link: '{{ repoUrl }}/issues/5'
130130
actions:
@@ -133,7 +133,7 @@ steps:
133133
body: 05_add-security-policy.md #security policy issue body (add branch name instructions and examples)
134134
action_id: securityIssue
135135
- type: respond
136-
issue: 5
136+
issue: Add Dependabot to your repository
137137
with: 05_successful-close.md #link to security issue
138138
data:
139139
url: '%actions.securityIssue.data.html_url%'
@@ -170,7 +170,7 @@ steps:
170170
head: add-wolverine-image
171171
action_id: addWolverine
172172
- type: respond
173-
issue: 8
173+
issue: '%actions.addWolverine.data.number%'
174174
with: 06_remove-sensitive-commit.md
175175
- type: respond
176176
with: 06_good-merge.md
@@ -196,14 +196,14 @@ steps:
196196
action_id: prFiles
197197
- type: gate
198198
left: '%actions.prFiles.data%'
199-
operator: includes
199+
operator: '!includes'
200200
right: 'filename:.env'
201201
required: false
202202
else:
203203
- type: respond
204-
with: 07_success-file-change.md #failed response to remove .env file
204+
with: 07_error-file-change.md #success response to remove .env file | Add note about contacting support for garbage collection
205205
- type: respond
206-
with: 07_error-file-change.md #success response to remove .env file | Add note about contacting support for garbage collection
206+
with: 07_success-file-change.md #failed response to remove .env file
207207

208208
# Step 9
209209
# Learner approves PR
@@ -229,7 +229,7 @@ steps:
229229
head: add-gitignore
230230
action_id: addGitignore
231231
- type: respond
232-
issue: 8
232+
issue: Add wolverine octocat to game
233233
with: 08_go-to-gitignore.md # Bot response to new PR
234234
data:
235235
url: '%actions.addGitignore.data.html_url%'
@@ -298,7 +298,7 @@ steps:
298298
link: '{{ repoUrl }}/issues/10'
299299
actions:
300300
- type: gate
301-
left: '848cd8c2043f6161a4f0043bffee212777281494'
301+
left: '848cd8'
302302
operator: test
303303
right: '%payload.comment.body%'
304304
else:
@@ -319,25 +319,25 @@ steps:
319319
link: '{{ repoUrl }}/issues/10'
320320
actions:
321321
- type: gate
322-
left: '848cd8c, 56d6fbb'
323-
operator: test
322+
left: '/(848cd8c)|(56d6fbb)/g'
323+
operator: '!test'
324324
right: '%payload.comment.body%'
325325
else:
326-
- type: octokit
327-
method: repos.getPages
328-
owner: '%payload.repository.owner.login%'
329-
repo: '%payload.repository.name%'
330-
action_id: pagesUrl
331-
- type: createIssue
332-
title: Congratulations!
333-
body: 12_final-issue.md
334-
data:
335-
url: '%actions.pagesUrl.data.html_url%'
336-
action_id: finalIssue
337-
- type: updateBranchProtection
338-
- type: respond
339-
with: 12_correct-references-removed.md # replace with nice job removing .env file response
340-
data:
341-
url: '%actions.finalIssue.data.html_url%'
326+
- type: respond
327+
with: 12_try-again-response.md
328+
- type: octokit
329+
method: repos.getPages
330+
owner: '%payload.repository.owner.login%'
331+
repo: '%payload.repository.name%'
332+
action_id: pagesUrl
333+
- type: createIssue
334+
title: Congratulations!
335+
body: 12_final-issue.md
336+
data:
337+
pagesUrl: '%actions.pagesUrl.data.html_url%'
338+
action_id: finalIssue
339+
- type: updateBranchProtection
342340
- type: respond
343-
with: 12_try-again-response.md
341+
with: 12_correct-references-removed.md # replace with nice job removing .env file response
342+
data:
343+
url: '%actions.finalIssue.data.html_url%'

responses/00_introduction-issue.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
## :tada: Welcome to Security strategy essentials!
1+
## :tada: Welcome to security strategy essentials!
22

3-
In this course, you'll learn how to build and host a secure repository in GitHub. A secure repository is important for many reasons.
3+
In this course, you'll learn how to build and host a secure repository in GitHub. A secure repository is important for many reasons, including:
44
- Prevents exposing sensitive data
55
- Enforces secure development best practices
6-
- Guards against unintended access rights permissions
6+
- Guards against unintended access rights and permissions
77

88
In this course you will learn how to:
99

10-
- Opt-in to vulnerability alerts for private repositories
11-
- _Note: These security settings are default for public repositories that are not forks._
12-
- Detect and fix vulnerable dependencies when notified by a vulnerability alert
13-
- Automate outdated dependency detection with dependabot
10+
- Opt-in to security alerts for private repositories
11+
- _Note: Vulnerability monitoring and security alerts are enabled by default for public repositories that are not forks._
12+
- Fix vulnerable dependencies when notified by a security alert
13+
- Automate security fixes with Dependabot
1414
- Follow security best practices to protect sensitive data by using a `.gitignore` file
1515
- Remove sensitive data and files committed to a repository
1616

responses/01_find-vulnerabilities.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
## Finding vulnerable dependencies
22

3-
Security vulnerabilities can cause a range of problems for your project or the people who use it. A vulnerability could affect the confidentiality, integrity, or availability of a project. Sometimes vulnerabilities aren't in the code you write, but in the code your project depends on. Staying up-to-date with the most recent versions is the best line of defense.
3+
Security vulnerabilities can cause a range of problems for your project or the people who use it. A vulnerability could affect the confidentiality, integrity, or availability of a project. Sometimes vulnerabilities aren't in the code you write, but in the code your project depends on. Staying up-to-date with the most recent versions is the best line of defense, but has the potential to cause integration issues, so GitHub alerts you of the safest next-version of a dependency.
44

55
This repository has some existing dependencies which will need updating to stay secure.
66

77
<details>
88
<summary>How can we identify dependencies and if they are vulnerable?</summary>
99
<hr>
1010

11-
This repository is a Node.js project utilizing NPM. Because of that, the `package.json` defines this repository's dependencies. For our time together, we'll be focusing on these JavaScript dependencies. Keep in mind that different programming languages may have different dependency files. You might work with a `Gemfile`, `Gemfile.lock`, `*.gemspec`, `requirements.txt`, `pipfile.lock`, or other files.
11+
This repository is a Node.js project utilizing NPM. Because of that, [`package.json`]({{ repoUrl }}/blob/master/package.json) defines this repository's dependencies. For our time together, we'll be focusing on these JavaScript dependencies. Keep in mind that different programming languages may have different dependency manifests. You might work with a `Gemfile`, `Gemfile.lock`, `*.gemspec`, `requirements.txt`, `pipfile.lock`, or other files.
1212

13-
How can we know these dependencies are secure? It's not always easy, but GitHub is watching out.
13+
How can we know these dependencies are secure? GitHub monitors a number of reputable [data sources](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies#data-sources-for-security-alerts) to track vulnerabilities across projects.
1414

1515
<hr>
1616
</details>
@@ -21,9 +21,9 @@ You may notice some alerts from GitHub about this repository. You may get an ema
2121

2222
![dependency vulnerability alert](https://user-images.githubusercontent.com/9906718/46882979-c275b680-ce50-11e8-9f47-2081daf20b98.png)
2323

24-
GitHub tracks public vulnerabilities in Ruby gems, NPM, Python, Java, and .Net packages.
24+
GitHub tracks vulnerabilities for a number of [supported languages](https://help.github.com/en/github/visualizing-repository-data-with-graphs/listing-the-packages-that-a-repository-depends-on#supported-languages) and their associated package managers, including RubyGems, NPM, Python PIP, Maven, and Nuget.
2525

26-
GitHub receives a notification of a newly-announced vulnerability. Next, we check for repositories that use the affected version of that dependency. We send security alerts to a set of people within those affected repositories. The owners are contacted by default. But, it's possible to configure specific teams or individuals to get these important notifications.
26+
GitHub receives a notification of a newly-announced vulnerability. Next, we check for repositories that use the affected version of that dependency. We send security alerts to a set of people within those affected repositories. The owners are contacted by default and it's possible to configure specific teams or individuals to get these important notifications.
2727

2828
**GitHub never publicly discloses identified vulnerabilities for any repository.**
2929

responses/03_good-pr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Great job, @{{ user.username }}, your pull request looks good. Thank you for fixing the vulnerable dependency!
44

5-
_Note: You might notice that this repository has a `package.json` file, but no `package-lock.json` file. We are doing all parts of this activity on GitHub.com. If you work with other repositories, you might notice some differences. Regardless of what dependency files you use, the main concepts of this course still apply._
5+
_Note: You might notice that this repository has a `package.json` file, but no `package-lock.json` file. In production code it's a good idea to have both files to avoid conflicts resolving the proper version of a dependency. For simplicity, we'll use only `package.json`, but GitHub monitors both files in addition to the gamut of supported languages and packages_
66

77
### :keyboard: Activity: Merge
88
1. Merge this pull request.

responses/03_update-dependency.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Next, we'll go through the GitHub Flow to make some changes. If you aren't sure how to do this, try the [Introduction to GitHub course](https://lab.github.com/githubtraining/introduction-to-github) and then come back to give it another try.
44

5-
> _Note: Before doing this with real world code, make sure that the upgraded package works with your code. Good unit tests and CI (continuous integration) will help you update with confidence._
5+
> _Note: For production code, it's a good idea to do some integration testing to make sure that the upgraded package works with your code. Good unit tests and Continuous Integration (CI) will help you update with confidence. The Learning Lab course [GitHub Actions: Continuous Integration](https://lab.github.com/githubtraining/github-actions:-continuous-integration) can teach you how to set up CI!_
66
77
## Step 4: Updating dependency versions
88

@@ -12,5 +12,5 @@ Now that you know the recommended version, it's time to edit the `package.json`
1212

1313
1. Within this pull request, go to **Files changed**.
1414
1. Click the ellipsis (`...`) in the right upper corner and click **Edit file** to edit the `package.json` file.
15-
1. Fix the vulnerability by updating to the latest version of the dependency that you took note of earlier.
15+
1. Fix the vulnerability by updating to the latest version of the dependency that you took note of earlier, version `2.6.9` of `debug`.
1616
1. Scroll down, and commit your change.

responses/04_add-dependabot.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
## Automated dependency Updates with Dependabot
1+
## Automated dependency updates with Dependabot
22

33
Manually going through your dependencies for alerts and outdated versions is tedious work. Let's automate this process!
44

5-
**Welcome to Dependabot**
5+
**Meet Dependabot**
66

77
![download](https://user-images.githubusercontent.com/6351798/67623352-53f86200-f7e1-11e9-957d-47bb009f030f.png)
88

99
Dependabot creates pull requests to keep your dependencies secure and up-to-date!
1010

1111
### How does Dependabot work?
1212

13-
1. Dependabot scans your repository and checks for updates or insecure requirements
13+
Dependabot is the actor for GitHub's automated security fixes.
14+
15+
1. GitHub uses the dependency graph and security alerts to scan your repository and notify you of potential dependency updates
1416
1. If any dependencies are out-of-date, Dependabot opens a pull request to update each one
1517
1. If tests pass, and the updated version looks good, you simply merge the pull request
1618

@@ -22,16 +24,16 @@ You can enable automated security fixes for any repository that uses security al
2224

2325
Here, we have a security alert on the **debug** dependency. Clicking on **debug** will show you the pull request created by Dependabot to update the dependency. We just updated to `2.6.9` but Dependabot noticed we are still outdated.
2426

25-
Feel free to [**approve and merge this pull request**]({{ repoUrl }}/pull/4).
27+
If you navigate to your [pull requests]({{ repoUrl }}/pulls), you'll notice Dependabot has done its job and is trying to bump, or update, the version of `debug`. Feel free to **approve and merge the pull request**.
2628

2729
<details>
2830
<summary>How to Install Dependabot if not enabled through automated security fixes</summary>
2931

30-
- Navigate to Dependabot on the [GitHub Marketplace](https://github.com/marketplace/dependabot-preview)
31-
- Click the "Install it for free" button
32-
- Follow on-screen instructions to add Dependabot to your GitHub profile
33-
- When installing Dependabot, choose `Only select repositories` and choose this repository, {{ repoUrl }}
34-
- On `app.dependabot.com`, under `repos you want to add`, select {{ repoUrl }} and click the `Add selected` button
32+
- Navigate to Dependabot on the [GitHub Marketplace](https://github.com/marketplace/dependabot-preview)
33+
- Click the "Install it for free" button
34+
- Follow on-screen instructions to add Dependabot to your GitHub profile
35+
- When installing Dependabot, choose `Only select repositories` and choose this repository, {{ repoUrl }}
36+
- On `app.dependabot.com`, under `repos you want to add`, select {{ repoUrl }} and click the `Add selected` button
3537

3638
</details>
3739

responses/05_add-security-policy.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ This gives collaborators the important security information they need, but it al
88

99
Just like a `README.md` file, it really depends on your repository and the requirements and workflows. Here are a few common topics that are documented in a security policy:
1010

11-
1. Supported versions
12-
1. How to responsibly report a security vulnerability
13-
1. Security related configuration
14-
1. Known security gaps and future enhancements
11+
- Supported versions
12+
- How to responsibly report a security vulnerability
13+
- Security related configuration
14+
- Known security gaps and future enhancements
1515

1616

1717
## Step 6: Add a SECURITY.md file
1818

1919
1. Navigate to the [Security]({{ repoUrl }}/network/alerts) tab
2020
1. Click on Policy located in the left sidebar
21-
1. Click the `Start Setup` button
21+
1. Click the **Start Setup** button
2222
1. Commit the template security policy to the new branch as selected `{{ user.username }}-patch-1`
2323
1. Commit the new file and create the pull request
2424

responses/06_remove-sensitive-commit.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## Removing sensitive information
22

3-
A contributor opened a pull request to add a new image to the memory game. However, it appears that this contributor also committed a sensitive `.env` file that shouldn't be included. Contributors may commit sensitive information by accident or by purpose without knowing the consequences of these actions.
3+
A contributor opened a pull request to add a new image to the memory game. However, it appears that this contributor also committed a sensitive `.env` file that shouldn't be included. Contributors may commit sensitive information by accident or on purpose without knowing the consequences of these actions.
44

55
Before we approve this pull request and merge it in, we need to remove this sensitive `.env` file from the pull request.
66

77
## Step 8: Remove sensitive data in a pull request
88

9-
We can do this by cloning down this repository to our local computer, and then running a few local Git commands before pushing up a fix on the contributor's branch on GitHub.
9+
We can do this by cloning this repository to our computer, and then running a few local Git commands before pushing up a fix on the contributor's branch on GitHub.
1010

1111
1. Clone this repository locally by running `git clone {{ repoUrl }}.git`
1212
1. CD into your newly cloned repository with `cd security-strategy-essentials`

responses/06_suggest-merge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Nice work opening this pull request. I went a head and approved it, go ahead and merge when ready.
1+
Nice work opening this pull request. I went ahead and approved it, go ahead and merge when ready.
22

33
### :keyboard: Activity: Merge
44
1. Merge this pull request.

responses/08_add-gitignore.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Removing the previous `.env` file from a random pull request is great, but how can we make sure other contributions don't include sensitive files by mistake? We can do this by adding a `.gitignore` file to our repository.
1+
Removing the previous `.env` file from the branch is great, but it's reactive. We need to ensure future contributions don't include sensitive files by mistake. We can do this by adding a `.gitignore` file to our repository.
22

33
## Taking advantage of the `.gitignore` file
44

@@ -8,7 +8,7 @@ From time to time, there are files you don't want Git to check in to GitHub. You
88

99
Git uses a file called `.gitignore` to decide which files and directories to ignore when committing. Keep files containing sensitive data, like configuration or `.env` files, out of your repositories. This is one way to promote security best practices.
1010

11-
The `.gitignore` file can, and should, be committed into your repository. By sharing this file and making it part of your code, it will also help others. Other users that contribute to the repository will also avoid committing sensitive data. There are many examples of `.gitignore` files available for you to use in your own repositories. You can find them in the [gitignore](https://github.com/github/gitignore) repository.
11+
The `.gitignore` file can, and should, be committed into your repository. By sharing this file and making it part of your code, future contributors to the repository will avoid committing sensitive data. There are many examples of `.gitignore` files available for you to use in your own repositories. You can find them in the [gitignore](https://github.com/github/gitignore) repository.
1212

1313
## Step 10: Add a `.gitignore` file
1414

0 commit comments

Comments
 (0)