Skip to content

Commit eb3ccf9

Browse files
Merge branch 'main' into update_bootcamp
2 parents a785607 + a0da1df commit eb3ccf9

File tree

5 files changed

+49
-50
lines changed

5 files changed

+49
-50
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,19 @@ We will go over the following topics:
7272

7373
## :books: Resources
7474
- [About code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning)
75-
- [About dependency scanning](https://docs.github.com/en/free-pro-team@latest/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)
75+
- [About Dependabot Alerts](https://docs.github.com/en/free-pro-team@latest/github/managing-security-vulnerabilities/about-alerts-for-vulnerable-dependencies)
7676
- [About secret scanning](https://docs.github.com/en/github/administering-a-repository/about-secret-scanning)
77-
- [Action events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
78-
- [Configuring builds for compiled languages](
77+
- [Events that trigger workflows](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows)
78+
- [Configuring the CodeQL workflow for compiled languages](
7979
https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-the-codeql-workflow-for-compiled-languages)
8080
- [Configuring code scanning](https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning)
81-
- [Configuring notifications for dependabot alerts](https://docs.github.com/en/free-pro-team@latest/github/managing-security-vulnerabilities/configuring-notifications-for-vulnerable-dependencies#configuring-notifications-for-dependabot-alerts)
81+
- [Configuring notifications for Dependabot alerts](https://docs.github.com/en/free-pro-team@latest/github/managing-security-vulnerabilities/configuring-notifications-for-vulnerable-dependencies#configuring-notifications-for-dependabot-alerts)
8282
- [Customizing dependency updates](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/customizing-dependency-updates)
83-
- [Dependency update configuration options](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates)
83+
- [Configuration options for the dependabot.yml file](https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates)
8484
- [Filter pattern cheat sheet](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet)
8585
- [Running additional queries](
8686
https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#running-additional-queries)
87-
- [Troubleshooting code scanning workflow](https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-the-codeql-workflow)
87+
- [Troubleshooting the CodeQL workflow](https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-the-codeql-workflow)
8888
- [Code scanning API](https://docs.github.com/en/free-pro-team@latest/rest/reference/code-scanning)
8989
- [Secret scanning API](https://docs.github.com/en/rest/reference/secret-scanning)
9090
- [GraphQL API](https://docs.github.com/en/free-pro-team@latest/graphql)

authn-service/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ entrypoints==0.3
77
Flask==1.1.2
88
Flask-Cors==3.0.8
99
idna==2.10
10+
django-two-factor-auth==1.12
1011
itsdangerous==1.1.0
1112
Jinja2==2.11.2
1213
keyring==17.1.1

exercises/lab 1 - dependabot.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,43 @@
88
- [Enabling Dependabot security updates](#enabling-dependabot-security-updates)
99
- [Configuring Dependabot security updates](#configuring-dependabot-security-updates)
1010

11-
### _**Practical Exercise 1**_
11+
### _**Lab 1**_
1212

1313
#### Enabling Dependabot alerts
1414
Dependabot can be enabled in the settings of an organization or a repository.
1515

16-
1. Go to the repository settings and enable Dependabot alerts in the *Security & analysis* section. You will be prompted to enable the Dependency Graph if it's not enabled already.
16+
- Go to the repository settings and enable Dependabot alerts in the `Code security and analysis` section. You will be prompted to enable the dependency graph if it's not enabled already.
1717

1818
#### Reviewing the dependency graph
1919
Dependabot uses the dependency graph to determine which dependencies are used by your project.
2020

21-
1. Verify in the dependency graph that it found dependencies for:
21+
- Verify in the dependency graph that it found dependencies for:
2222
- The frontend service.
2323
- The authentication service.
2424
- The gallery service.
2525
- The storage service.
2626

27-
The dependency graph can be access in the `Insights` tab in your repository.
27+
The dependency graph can be accessed from the `Insights` tab in your repository.
2828

2929
#### Viewing and managing results
3030

31-
After a few minutes, the security tab in the repository will indicate that there are new security alerts. You will see a "Create a security update" button; if this button is clicked, it will create a Pull Request to update the vulnerable dependency. The next section will show you how to enable security updates for all applicable Dependabot alerts.
31+
After a few minutes, the `Security` tab in the repository will indicate that there are new security alerts. You will see a **Create a security update** button; click this button to create a pull request (PR) to update the vulnerable dependency. The next section will show you how to enable security updates for all applicable Dependabot alerts.
3232

3333
**Note**: If this not the case, we can trigger an analysis by updating `authn-service/requirements.txt`
3434

3535
1. Go to the Dependabot alert section to view the detected dependency issues.
3636

3737
For each dependency alert, we have the option to create a security update or to dismiss the alert with a reason.
3838

39-
2. For one of the alerts create a dependency security update. If Dependabot can update the dependency automatically, it will create a PR.
39+
2. For one of the alerts, create a dependency security update. If Dependabot can update the dependency automatically, it will create a PR.
4040

41-
3. For one of the alerts dimiss the alert.
41+
3. For one of the alerts, dimiss the alert.
4242

4343
#### Enabling Dependabot security updates
4444

45-
Dependabot can automatically create PRs to upgrade vulnerable dependencies to non-vulnerable versions. Please note that there may be some Dependabot alerts that don't have patch; therefore, a security update is not available.
45+
Dependabot can automatically create PRs to upgrade vulnerable dependencies to non-vulnerable versions. Please note that there may be some Dependabot alerts that don't have patches. In those cases, a security update is not available.
4646

47-
1. Go to the repository settings and enable Dependabot security updates in the *Security & analysis* section.
47+
- Go to the repository settings and enable Dependabot security updates in the *Code security & analysis* section.
4848

4949
After a few minutes multiple PRs will be created that will upgrade vulnerable dependencies.
5050

@@ -55,18 +55,18 @@ You can enable Dependabot [*version updates*](https://docs.github.com/en/code-se
5555
- When version updates are created.
5656
- What labels are assigned to enable filtering options.
5757
- Who is assigned to the PR and who should review it.
58-
- Specify which dependencies are updated and how they are updated.
58+
- Which dependencies are updated and how they are updated.
5959

60-
Create the file `.github/dependabot.yml` in your repository and configure the `pip` dependency manager to:
61-
1. Look for dependency information in the directory `authn-service`.
60+
Create the `.github/dependabot.yml` file in your repository and configure the `pip` dependency manager to:
61+
1. Look for dependency information in the `authn-service` directory.
6262

6363
2. Schedule daily version updates.
6464

65-
3. Prefix the commit message with the package manager `pip`.
65+
3. Prefix the commit message with the `pip` package manager.
6666

67-
4. Assign the PR to yourself and a person from your workshop team as a reviewer. When specifying GitHub handles in the yml, do so without the `@` symbol. Please see below solution as an example.
67+
4. Assign the PR to yourself and a person from your workshop team as a reviewer. When specifying GitHub handles in the yml, do so without the `@` symbol. Please see the following solution as an example.
6868

69-
5. Add the custom label `triage-required` to enable filtering of the PRs (Make sure the label exists by adding it to `https://github.com/<owner>/<your repo>/labels`).
69+
5. Add the custom label `triage-required` to enable filtering of the PRs.
7070

7171
6. Verify your changes by adding a [vulnerable dependency](https://github.com/advisories?query=severity%3Ahigh+ecosystem%3Apip) to `auth-service/requirements.txt`. For example:
7272

@@ -79,7 +79,7 @@ How would you know if the configuration cannot be satisfied?
7979
8080
1. Add a non-existing label to the configuration.
8181
82-
2. Trigger a new dependabot security update by adding a vulnerable dependency to one of the projects
82+
2. Trigger a new dependabot security update by adding a vulnerable dependency to one of the projects.
8383
For example, we can add the dependency `django-two-factor-auth==1.11` to `auth-service/requirements.txt`
8484
8585
3. Look at the created PR to determine if the configuration has been satisfied.
@@ -109,15 +109,15 @@ updates:
109109

110110
#### Working with Dependency Review
111111

112-
If a Pull Request has dependency changes, you can [review](https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request) them and see if there are known vulnerabilities with the dependency changes.
112+
If a PR has dependency changes, you can [review](https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-dependency-changes-in-a-pull-request) them and see if there are known vulnerabilities with the dependency changes.
113113

114114
1. Add a vulnerable dependency to `auth-service/requirements.txt` and commit to a new branch. For example, here's a vulnerable dependency:
115115

116116
```requirements.txt
117117
...
118118
django-piston==0.2.0
119119
```
120-
2. Create a Pull Request, and click on `Files changed`.
120+
2. Create a PR, and click on `Files changed`.
121121
3. Click on the `Display the rich diff` button on the `requirements.txt` file to review dependency changes.
122122
123123
💡**Now that we're familiar with Dependabot, let's head over to the secret scanning section, and learn more about it! [Click here](lab%202%20-%20secret-scanning.md).** 💡

exercises/lab 2 - secret-scanning.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@
88
- [Excluding files from secret scanning](#excluding-files-from-secret-scanning)
99
- [Managing access to alerts](#managing-access-to-alerts)
1010

11-
### _**Practical Exercise 2**_
11+
### _**Lab 2**_
1212

1313
#### Enabling secret scanning
1414
Secret scanning can be enabled in the settings of an organization or a repository.
1515

16-
1. Go to the repository settings and enable secret scanning in the *Security & analysis* section.
16+
1. Go to the repository settings and enable secret scanning in the `Code security and analysis` section.
1717

1818
#### Viewing and managing results
19-
After a few minutes, the security tab in the repository will indicate that there are new security alerts.
19+
After a few minutes, the `Security` tab in the repository will indicate that there are new security alerts.
2020

21-
1. Go to the secret scanning section to view the detected secrets.
21+
- Go to the `Secret scanning` section to view the detected secrets.
2222

2323
For each secret, look at the options to close it and determine which one is most suitable.
2424

2525
#### Introducing a test secret
26-
When developing test cases it might be the case that secrets are introduced that cannot be abused when disclosed. Secret scanning will still detect and alert on these secrets.
26+
When developing test cases, you might find that secrets are introduced that cannot be abused when disclosed. Secret scanning will still detect and alert on these secrets.
2727

28-
1. In the GitHub repository file explorer create a test file that will contain a test secret.
28+
1. In the GitHub repository file explorer, create a test file that contains a test secret.
2929
- For example the file `storage-service/src/main/resources/application.dev.properties` with the secrets
3030
```
3131
AWS_ACCESS_KEY_ID="AKIAZBQE345LKPTEAHQD"
@@ -68,9 +68,9 @@ While we can close a detected secret as being used in a test, we can also config
6868
```
6969
7070
#### Custom patterns for secret scanning
71-
Secret scanning supports finding other [secret patterns](https://docs.github.com/en/code-security/secret-security/defining-custom-patterns-for-secret-scanning), which are specified by regex patterns and uses the Hyperscan library.
71+
Secret scanning supports finding other [secret patterns](https://docs.github.com/en/code-security/secret-security/defining-custom-patterns-for-secret-scanning), which are specified by regex patterns and use the Hyperscan library.
7272
73-
1. Add a custom secret pattern by going to the Security and Analysis settings and under the header "Custom patterns" click on `New pattern`.
73+
1. Add a custom secret pattern by going to the `Code security and analysis` settings and under the header "Custom patterns" click on `New pattern`.
7474
2. Add a custom pattern name, a secret format and test cases.
7575
7676
For example:
@@ -83,11 +83,11 @@ Secret scanning supports finding other [secret patterns](https://docs.github.com
8383
8484
#### Managing access to alerts
8585
Due to the nature of secrets, the alerts are only visible to organization and repository administrators.
86-
Access to other members and teams can be given in the `Security & analysis` setting.
86+
Access to other members and teams can be given in the `Code security and analysis` setting.
8787
88-
**Note:** The member or teams requires write privileges before access to alerts can be given.
88+
**Note:** The member or teams require write privileges before access to alerts can be given.
8989
90-
1. In the access to alerts section, add another team member or team to provide access to your repository alerts.
90+
- In the `Access to alerts` section, add another team member or team to provide access to your repository alerts.
9191
9292
93-
💡**Now that we're familiar with secret scanning, let's head over to the code scanning section, and learn more about it! [Click here](lab%203%20-%20code-scanning.md).** 💡
93+
💡**Now that we're familiar with secret scanning, let's head over to the code scanning section, and learn more about it!** 💡

exercises/lab 3 - code-scanning.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,30 @@ Code scanning enables developers to integrate security analysis tooling into the
44

55
### Contents
66

7-
- [Enabling code-scanning](#enabling-code-scanning)
7+
- [Enabling code scanning](#enabling-code-scanning)
88
- [Reviewing any failed analysis job](#reviewing-any-failed-analysis-job)
99
- [Using context and expressions to modify build](#using-context-and-expressions-to-modify-build)
1010
- [Reviewing and managing results](#reviewing-and-managing-results)
1111
- [Triaging a result in a PR](#triaging-a-result-in-a-pr)
1212
- [Customizing CodeQL configuration](#customizing-codeql-configuration)
1313
- [Adding your own code scanning suite to exclude rules](#adding-your-own-code-scanning-suite-to-exclude-rules)
1414

15-
### _**Practical Exercise 3**_
15+
### _**Lab 3**_
1616

1717
#### Enabling code scanning
1818

19-
1. Go to the `Code scanning alerts` section in the `Security` tab.
19+
1. On the `Security` tab, in the **Vulnerability alerts** section, click **Code scanning**, and then click the **Configure CodeQL alerts** button.
2020

21-
2. Start the `Set up this workflow` step in the `CodeQL Analysis` card.
21+
2. Review the created Action workflow file `codeql-analysis.yml` and choose `Start commit` to accept the default proposed workflow.
2222

23-
3. Review the created Action workflow file `codeql-analysis.yml` and choose `Start commit` to accept the default proposed workflow.
24-
25-
4. Head over to the `Actions` tab to see the created workflow in action. Click on the workflow to view details and status for each analysis job.
23+
3. Head over to the `Actions` tab to see the created workflow in action. Click on the workflow to view details and status for each analysis job.
2624

2725

2826
#### Reviewing any failed analysis job
2927

30-
CodeQL requires a build of compiled languages, and an analysis job can fail if our *autobuilder* is unable to build a program to extract an analysis database.
28+
CodeQL requires a build of compiled languages. An analysis job can fail if our *autobuilder* is unable to build a program to extract an analysis database.
3129

32-
1. Inside the workflow you'll see a list of jobs on the left. Click on the Java job to view the logging output and review any errors to determine if there's a build failure.
30+
1. Inside the workflow you'll see a list of jobs on the left. Click on the Java job to view the logging output and review any errors to determine if there's a build failure.
3331

3432
2. The build failure appears to be caused by a JDK version mismatch. Our project targets JDK version 15. How can we check the Java version that the GitHub hosted runner is using? Does the logging output provide any helpful information?
3533

@@ -76,7 +74,7 @@ How would you [modify](https://docs.github.com/en/free-pro-team@latest/actions/r
7674

7775
#### Reviewing and managing results
7876

79-
1. Go to the `Code scanning results` in the `Security` tab.
77+
1. On the `Security` tab, view the `Code scanning alerts`.
8078

8179
2. For a result, determine:
8280
1. The issue reported.
@@ -102,17 +100,17 @@ Follow the next steps to see it in action.
102100
```
103101
2. Is the vulnerability detected in your PR?
104102

105-
3. You can also configure the check failures for Code Scanning. Go into the `Security & Analysis` settings and modify the Check Failures. Set it to `Only critical/ Only errors` and see how that affects the code scanning status check for subsequent PR checks. In the next steps, you will be enabling additional query suites that have other severity types.
103+
3. You can also configure the check failures for code scanning. Go into the `Code security and analysis` settings and modify the Check Failures. Set it to `Only critical/ Only errors` and see how that affects the code scanning status check for subsequent PR checks. In the next steps, you will be enabling additional query suites that have other severity types.
106104

107105
#### _Stretch Exercise 1: Fixing false positive results_
108106

109107
If you have identified a false positive, how would you deal with that? What if this is a common pattern within your applications?
110108

111109
#### _Stretch Exercise 2: Enabling code scanning on your own repository_
112110

113-
So far you've learned how to enable secret scanning, Dependabot and code scanning. Try enabling this on your own repository, and see what kind of results you get!
111+
So far you've learned how to enable Dependabot, secret scanning, and code scanning. Try enabling this on your own repository, and see what kind of results you get!
114112

115-
### _**Practical Exercise 4**_
113+
### _**Lab 4**_
116114

117115
#### Customizing CodeQL Configuration
118116

@@ -211,7 +209,7 @@ queries:
211209
```
212210
</details>
213211

214-
5. Try specifying directories to scan or not to scan. Why would you include this in the configuration?
212+
5. Try specifying directories to scan or not to scan. Note that this is only supported for interpreted languages, such as javascript/typescript, python, ruby, etc. Why would you include this in the configuration?
215213

216214
<details>
217215
<summary>Solution</summary>

0 commit comments

Comments
 (0)