Skip to content

Commit 01ab2ce

Browse files
authored
Merge pull request #4 from Ignite-GHAS-Workshop/fix-images
Fix image markdown for labs
2 parents 15bef5a + 9771334 commit 01ab2ce

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

_labs/lab1.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Although Dependabot isn't part of the GitHub Advanced Security product suite, it
3838

3939
![image](./images/lab-1-1-1.png)
4040

41-
<img src="images/lab-1-1-1.png"/>
41+
![image](images/lab-1-1-1.png)
4242
</details>
4343

4444
### Exercise 2: Enable Code Scanning
@@ -50,19 +50,19 @@ Although Dependabot isn't part of the GitHub Advanced Security product suite, it
5050
- By default, it will scan the JavaScript code, use the default CodeQL queries (for highest precision), and scan the default branch on push, pull request, and on a weekly schedule.
5151

5252
<details>
53-
<img src="images/lab-1-2-1.png"/>
53+
![image](images/lab-1-2-1.png)
5454
</details>
5555

5656
4. Click the **Enable CodeQL** button to save the settings and enable Code Scanning.
5757

5858
<details>
59-
<img src="images/lab-1-2-2.png"/>
59+
![image](images/lab-1-2-2.png)
6060
</details>
6161

6262
5. Ensure that **Copilot Autofix** is enabled (in the **Code Scanning --> Tools** section).
6363

6464
<details>
65-
<img src="images/lab-1-2-3.png"/>
65+
![image](images/lab-1-2-3.png)
6666
</details>
6767

6868
> [!NOTE]
@@ -82,7 +82,7 @@ Although Dependabot isn't part of the GitHub Advanced Security product suite, it
8282
- In Private and internal repositories in organizations using GitHub Enterprise Cloud with GitHub Advanced Security enabled, you can change this to only allow select users/teams (or no one) to bypass secret scanning push protection.
8383

8484
<details>
85-
<img src="images/lab-1-3-1.png"/>
85+
![image](images/lab-1-3-1.png)
8686
</details>
8787

8888
## Summary

_labs/lab2.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ Now that we have all of the security feature enabled, let's review the security
88
2. Click **Dependabot** under the **Vulnerability alerts** heading.
99

1010
<details>
11-
<img src="images/lab-2-1-1.png"/>
11+
![image](images/lab-2-1-1.png)
1212
</details>
1313

1414
3. You should see a number of Dependabot alerts with various severities. Click on one of the alerts to see more information about it.
1515

1616
<details>
17-
<img src="images/lab-2-1-2.png"/>
17+
![image](images/lab-2-1-2.png)
1818
</details>
1919

2020
4. When reviewing a Dependabot alert, you can see the following information (see if you can locate this information in the alert you opened):
@@ -30,7 +30,7 @@ Now that we have all of the security feature enabled, let's review the security
3030
- The alert timeline (for example, it should show that Dependabot just recently opened the alert. Once you close an alert, it will show who and when closed it here too).
3131

3232
<details>
33-
<img src="images/lab-2-1-3.png"/>
33+
![image](images/lab-2-1-3.png)
3434
</details>
3535

3636
5. You can manually close an alert by clicking on the **Dismiss alert** button in the upper right hand corner. It's not recommended to close alerts manually, but there may be times where this is helpful (for example, the code that contains the alert is not used).
@@ -53,14 +53,14 @@ Now that we have all of the security feature enabled, let's review the security
5353
- Reviewing the **Critical** and **High** security alerts is another great place to start when prioritizing.
5454

5555
<details>
56-
<img src="images/lab-2-1-4.png"/>
56+
![image](images/lab-2-1-4.png)
5757
</details>
5858

5959
9. If you put your cursor in the search box (should have `is:open` by default), there are additional filter options. Some of the common filter options are **scope** (runtime or development) and **has** (for example, `has:patch`).
6060
10. Update the search query to `is:open has:patch`. This will filter out all of the alerts that don't have a patch available and only show alerts where there is a non-vulnerable version to upgrade to.
6161

6262
<details>
63-
<img src="images/lab-2-1-5.png"/>
63+
![image](images/lab-2-1-5.png)
6464
</details>
6565

6666

@@ -69,13 +69,13 @@ Now that we have all of the security feature enabled, let's review the security
6969
12. Add a rule to snooze any alerts that do not have a fix available. Choose the "gear" icon and select the `New rule` button. Name the rule `Snooze when no patch available`, add a target metadata for all npm packages: `ecosystem:npm` and ensure the `Dismiss Alerts` - `Until patch is available` is selected. Next, select `Create rule`.
7070

7171
<details>
72-
<img src="images/lab-2-1-6.png"/>
72+
![image](images/lab-2-1-6.png)
7373
</details>
7474

7575
13. Navigating back to the **Security** tab / **Dependabot** under the **Vulnerability alerts** heading. You will see `1 Closed` heading. Select this to find your alert `Command Injection in marsdb` without any fix has now been `Dismissed` as `auto-dismissed`. The audit log will note `Repository rule created and Snooze when no patch available was applied`
7676

7777
<details>
78-
<img src="images/lab-2-1-7.png"/>
78+
![image](images/lab-2-1-7.png)
7979
</details>
8080

8181
## Exercise 2: Reviewing Code Scanning alerts
@@ -84,15 +84,15 @@ Now that we have all of the security feature enabled, let's review the security
8484
2. We should have a number of alerts. If you don't see any alerts yet, skip ahead to the next exercise and come back to this one. More than likely, the code scanning workflow hasn't finished yet (it takes between 2-5 minutes to run).
8585

8686
<details>
87-
<img src="images/lab-2-2-1.png"/>
87+
![image](images/lab-2-2-1.png)
8888
</details>
8989

9090
3. If there are code scanning alerts, spend a few moments reviewing them. We can **filter/sort** by severity, tool, language, and a few other options, just like with Dependabot alerts.
9191
4. A common search/filter to use is **Autofilter** to filter out the alerts with a **test** tag (code scanning violations found in test files). This can help you focus on the alerts that are more likely to be real vulnerabilities.
9292
5. To use the autofilter filter, paste this into the search box: `is:open branch:main autofilter:true` (or type/select it by hand).
9393

9494
<details>
95-
<img src="images/lab-2-2-2.png"/>
95+
![image](images/lab-2-2-2.png)
9696
</details>
9797

9898
6. Scroll down and let's click on one of the SQL injection alerts. These can be found by searching for the title **Database query built from user-controlled sources**.
@@ -107,7 +107,7 @@ Now that we have all of the security feature enabled, let's review the security
107107
- The affected branch
108108

109109
<details>
110-
<img src="images/lab-2-2-3.png"/>
110+
![image](images/lab-2-2-3.png)
111111
</details>
112112

113113
8. Click on the **Show paths** link to review the vulnerability from the source to the sink.
@@ -125,7 +125,7 @@ Now that we have all of the security feature enabled, let's review the security
125125
- The nice thing with code scanning alerts (just like Dependabot alerts) is that once you merge the code that resolves an alert, the alert will be automatically closed. This is because the alert is no longer present in the code.
126126

127127
<details>
128-
<img src="images/lab-2-2-4.png"/>
128+
![image](images/lab-2-2-4.png)
129129
</details>
130130

131131
15. We will merge this in change in. But first, we have to wait for the CodeQL workflow to finish running to ensure we aren't introducing any *new* vulnerabilities into the codebase. The workflow run will take 2-5 minutes.
@@ -148,7 +148,7 @@ Now that we have all of the security feature enabled, let's review the security
148148
2. Under the **Security** tab in the repo, click on the **Secret scanning** view. This will show all of the secret scanning alerts. (This should be empty for you.)
149149

150150
<details>
151-
<img src="images/lab-2-3-1.png"/>
151+
![image](images/lab-2-3-1.png)
152152
</details>
153153

154154
3. Viewing a secret scanning alert shows details about the leak
@@ -158,14 +158,14 @@ Now that we have all of the security feature enabled, let's review the security
158158
- If you re-write history, the secret will still be valid and could be used by an attacker. Also, re-writing history modifies commit hashes and can make traceability more difficult.
159159

160160
<details>
161-
<img src="images/lab-2-3-4.png"/>
161+
![image](images/lab-2-3-4.png)
162162
</details>
163163

164164
4. If you view an alert and choose **Verify secret** and this time, it says **secret inactive**. This is a good candidate to **Close as** --> **Revoked**.
165165
- Unlike Dependabot alerts and Code Scanning alerts, secret scanning alerts are not automatically closed when the secret is removed from the code - whether by a new commit or by re-writing history. This is because the secret was exposed and you don't know who may have seen it. So, you have to manually close the alert once you revoke the token.
166166

167167
<details>
168-
<img src="images/lab-2-3-2.png"/>
168+
![image](images/lab-2-3-2.png)
169169
</details>
170170

171171

_labs/lab3.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ models.sequelize.query(`SELECT * FROM Users WHERE email = '${req.body.email || '
3939
13. After the pull request is created, the code scanning job will have been initiated. You can see the status of the job in the pull request checks. It will take a few minutes to run.
4040

4141
<details>
42-
<img src="images/lab-3-1-3.png"/>
42+
![image](images/lab-3-1-3.png)
4343
</details>
4444

4545
10. CodeQL should find the vulnerability, so the check will fail. Also, we should see Copilot create us an autofix on the PR that we can review.
4646
11. It might take Copilot a few moments to create the autofix.
4747
12. Review the autofix - we can prevent a vulnerability from entering the repository now with a click of a button! 🎉 ⚠️⚠️ **But don't commit the suggestion yet.** ⚠️⚠️
4848

4949
<details>
50-
<img src="images/lab-3-1-4.png"/>
50+
![image](images/lab-3-1-4.png)
5151
</details>
5252

5353
## Exercise 2: Creating a code scanning ruleset
@@ -61,7 +61,7 @@ Without a ruleset (GitHub's new version of branch protections), even though Code
6161
2. On the left hand list of options, click on **Rules --> Rulesets**.
6262

6363
<details>
64-
<img src="images/lab-3-2-1.png"/>
64+
![image](images/lab-3-2-1.png)
6565
</details>
6666

6767
3. Click on **New ruleset ▾ --> New branch ruleset**
@@ -74,14 +74,14 @@ Without a ruleset (GitHub's new version of branch protections), even though Code
7474
5. Scroll down and click the **Create** button.
7575

7676
<details>
77-
<img src="images/lab-3-2-2.png"/>
77+
![image](images/lab-3-2-2.png)
7878
</details>
7979

8080
7. With the ruleset created, both the JavaScript scan has to finish and no vulnerabilities found with CodeQL in order to merge the code.
8181
8. Navigate back to our open PR. The **Merge pull request** button should now be grayed out, preventing us from merging vulnerable code.
8282

8383
<details>
84-
<img src="images/lab-3-2-3.png"/>
84+
![image](images/lab-3-2-3.png)
8585
</details>
8686

8787
9. Review the **Copilot Autofix suggestion**.

_labs/lab4.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ First, let's add the dependency review action workflow.
1212
4. Under the **Dependency Review** workflow, click **Configure**.
1313

1414
<details>
15-
<img src="images/lab-4-1-1.png"/>
15+
![image](images/lab-4-1-1.png)
1616
</details>
1717

1818
5. Review the action and its defaults on line 32-39. This action can also block specific open source license types.
1919
6. In the upper right, click on **Commit changes...**
2020
7. Since we have a ruleset, we have to create a branch and merge this to main via pull request. Create a branch and commit (**Propose changes**) the changes.
2121

2222
<details>
23-
<img src="images/lab-4-1-2.png"/>
23+
![image](images/lab-4-1-2.png)
2424
</details>
2525

2626
8. On the next screen, use the Copilot icon in the formatting bar to generate a pull request description.
2727

2828
<details>
29-
<img src="images/lab-4-1-3.png"/>
29+
![image](images/lab-4-1-3.png)
3030
</details>
3131

3232
9. Click **Create pull request**.
3333
10. Wait for the code scanning job to finish. It will take a few minutes to run.
3434
- You will notice that the Dependency Review workflow ran against this PR and didn't report any issues.
3535

3636
<details>
37-
<img src="images/lab-4-1-4.png"/>
37+
![image](images/lab-4-1-4.png)
3838
</details>
3939

4040
11. Merge the PR once the code scanning completes.
@@ -46,7 +46,7 @@ First, let's add the dependency review action workflow.
4646
17. Search for `dependency-review` and add it (it should show up under **suggestions**).
4747

4848
<details>
49-
<img src="images/lab-4-1-5.png"/>
49+
![image](images/lab-4-1-5.png)
5050
</details>
5151

5252
18. Save the changes to the ruleset.
@@ -66,7 +66,7 @@ Now, let's attempt to add a vulnerable dependency to the codebase and test out t
6666
```
6767

6868
<details>
69-
<img src="images/lab-4-2-1.png"/>
69+
![image](images/lab-4-2-1.png)
7070
</details>
7171

7272
6. Click the **Commit changes** button.
@@ -77,7 +77,7 @@ Now, let's attempt to add a vulnerable dependency to the codebase and test out t
7777
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.
7878

7979
<details>
80-
<img src="images/lab-4-2-2.png"/>
80+
![image](images/lab-4-2-2.png)
8181
</details>
8282

8383
12. Also, the status check will be marked as failed, preventing the pull request from being merged.

_labs/lab5.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Let's use Secret Scanning with push protections to prevent secrets from entering
2020
13. Push protection should detect the GitHub personal access token and block the push - great!
2121

2222
<details>
23-
In the UI:</br><img src="images/lab-5-1-1.png"/></br></br>
23+
In the UI:</br>![image](images/lab-5-1-1.png)</br></br>
2424
</details>
2525

2626
14. Depending on how the settings are configured, we could bypass the push protection and push the secret to the repository. But, we don't want to do that! 🙅‍♂️ Repository admins and organization owners would receive an email notification if we did.

0 commit comments

Comments
 (0)