Skip to content

Commit a85bd9e

Browse files
committed
Added "Introduce a Security Vulnerability in a PR"
1 parent db41c0b commit a85bd9e

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ This tutorial with use CodeQL Analysis with Code Scanning in order to search for
1717
<p>
1818

1919
Begin by [forking this repo](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo).
20+
21+
Make sure you uncheck "Copy the main branch only"
22+
23+
<img src="images/17-fork-repo.png" width="70%"/>
24+
2025
</p>
26+
2127
</details>
2228

2329
<details>
@@ -198,6 +204,46 @@ Click on the security alert and notice that it details when the fix was made, by
198204

199205
</p>
200206
</details>
207+
208+
<details>
209+
<summary>Introduce a Security Vulnerability in a PR</summary>
210+
<p>
211+
212+
Now let's explore the typical developer view when introducing a vulnerability.
213+
214+
A branch called `new-feature` introduces a new feature but also security vulnerabilities. Open a Pull Request comparing `new-feature` to `main`:
215+
216+
1. Go to the Pull Request tab
217+
2. Select "New Pull Request"
218+
3. Create the PR with `base: main` and `compare: new-feature`
219+
220+
<img src="images/18-create-vulnerable-pr.png" width="80%"/>
221+
222+
#### Pull Request Status Check
223+
224+
In the Pull Request, you will notice that the CodeQL Analysis has started as a status check again. Wait until it completes.
225+
226+
#### Security Alert Details
227+
228+
After the Workflow has completed click on `Details` by the `Code Scanning Results / CodeQL` status check.
229+
230+
#### Security Alert
231+
232+
Notice that Code Scanning has detected that this Pull Request will introduce 2 medium-severity vulnerabilties
233+
234+
<img src="images/19-vulnerabiltliy-detail.png" width="80%"/>
235+
236+
### 'Files Changed' tab
237+
238+
Click on the "Files Changed" tab of the PR. Scroll down and notice the Advanced Security annotations for new vulnerabilities.
239+
240+
You have the ability to dismiss, dive deeper into, or comment on these alerts directly from here.
241+
242+
<img src="images/20-files-changed-vulnerabilities.png" width="80%"/>
243+
244+
As a developer, this is where you would be interacting with Code Scanning
245+
246+
</details>
201247

202248
## Next Steps
203249

images/17-fork-repo.png

58.5 KB
Loading

images/18-create-vulnerable-pr.png

108 KB
Loading

images/19-vulnerabiltliy-detail.png

1.18 MB
Loading
1.07 MB
Loading

0 commit comments

Comments
 (0)