Skip to content

Commit 85dda73

Browse files
authored
Merge pull request #1 from aleks-ivanov/feature/add-dependabot-codeql
Add CodeQL and Dependabot
2 parents 2cd256f + deed7dd commit 85dda73

11 files changed

+136
-0
lines changed

.github/dependabot.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
# default location of `.github/workflows`
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
- package-ecosystem: "nuget"
10+
# location of package manifests
11+
directory: "/"
12+
schedule:
13+
interval: "daily"
14+
15+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

.github/workflows/codeql-analysis.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
schedule:
8+
- cron: '0 8 * * *'
9+
10+
jobs:
11+
analyze:
12+
name: codeql-analysis
13+
runs-on: windows-latest
14+
steps:
15+
- name: Setup .NET
16+
id: setup_dotnet
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 5.0.x
20+
21+
- name: Checkout repository
22+
id: checkout_repo
23+
uses: actions/checkout@v2
24+
25+
- name: Clean .NET cache
26+
id: clean_dotnet_cache
27+
shell: pwsh
28+
run: |
29+
dotnet clean ./ModernWpf.sln --configuration Release
30+
dotnet nuget locals all --clear
31+
32+
- name: Install dependencies
33+
id: dotnet_restore
34+
shell: pwsh
35+
run: |
36+
dotnet restore
37+
38+
- name: Initialize CodeQL
39+
id: init_codeql
40+
uses: github/codeql-action/init@v1
41+
with:
42+
queries: security-and-quality
43+
44+
- name: Build
45+
id: dotnet_build
46+
shell: pwsh
47+
run: |
48+
dotnet build --configuration Release --no-restore
49+
50+
- name: Perform CodeQL Analysis
51+
id: analyze_codeql
52+
uses: github/codeql-action/analyze@v1
53+
54+
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

CI-CD_DOCUMENTATION.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# ModernWpf CI/CD documentation
2+
3+
## 1. Set up Dependabot
4+
5+
Dependabot is a GitHub native security tool that goes through the dependencies in the project and creates alerts, and PRs with updates when a new and/or non-vulnerable version is found.
6+
7+
- for PRs with version updates, this pipeline comes pre-configured for all current dependency sources in the project, so at "Insights" tab -> "Dependency graph" -> "Dependabot", you should be able to see all tracked sources of dependencies, when they have been checked last and view a full log of the last check
8+
9+
![Dependabot_tab](/CI-CD_DOCUMENTATION/Dependabot_tab.png)
10+
11+
![Dependabot_log_page](/CI-CD_DOCUMENTATION/Dependabot_log_page.png)
12+
13+
### Set up security alerts and updates
14+
##### - GitHub, through Dependabot, also natively offers a security check for vulnerable dependencies
15+
16+
1. Go to the project's GitHub repository and click on the **Settings** tab
17+
18+
2. Go to **Security & analysis** section
19+
20+
3. Click "Enable" for both "Dependabot alerts" and "Dependabot security updates"
21+
22+
- By enabling "Dependabot alerts", you would be notified for any vulnerable dependencies in the project. At "Security" tab -> "Dependabot alerts", you can manage all alerts. By clicking on an alert, you would be able to see a detailed explanation of the vulnerability and a viable solution.
23+
24+
![Dependabot_alerts_page](/CI-CD_DOCUMENTATION/Dependabot_alerts_page.png)
25+
26+
![Dependabot_alert_page](/CI-CD_DOCUMENTATION/Dependabot_alert_page.png)
27+
28+
- By enabling "Dependabot security updates", you authorize Dependabot to create PRs specifically for **security updates**
29+
30+
![Dependabot_PRs](/CI-CD_DOCUMENTATION/Dependabot_PRs.png)
31+
32+
### Set up Dependency graph
33+
##### - The "Dependency graph" option should be enabled by default for all public repos, but in case it isn't:
34+
35+
1. Go to the project's GitHub repository and click on the **Settings** tab
36+
37+
2. Go to **Security & analysis** section
38+
39+
3. Click "Enable" for the "Dependency graph" option
40+
41+
- this option enables the "Insights" tab -> "Dependency graph" section -> "Dependencies" tab, in which all the dependencies for the project are listed, under the different manifests they are included in
42+
43+
![Dependabot_dependency_graph](/CI-CD_DOCUMENTATION/Dependabot_dependency_graph.png)
44+
45+
NOTE: **screenshots are only exemplary**
46+
47+
<br>
48+
49+
## 2. CodeQL
50+
51+
CodeQL is GitHub's own industry-leading semantic code analysis engine. CodeQL requires no setup, because it comes fully pre-configured by us.
52+
53+
To activate it and see its results, only a push commit or a merge of a PR to the default branch of your repository, is required.
54+
55+
We've also configured CodeQL to run on schedule, so every day at 8:00AM UTC, it automatically tests the code.
56+
57+
- you can see the results here at **Security** tab -> **Code scanning alerts** -> **CodeQL**:
58+
59+
![CodeQL_results](/CI-CD_DOCUMENTATION/CodeQL_results.png)
60+
61+
- on the page of each result, you can see an explanation of what the problem is and also one or more solutions:
62+
63+
![CodeQL_alert_page](/CI-CD_DOCUMENTATION/CodeQL_alert_page.png)
64+
65+
#
66+
67+
Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)
54.1 KB
Loading
55.3 KB
Loading
63 KB
Loading
47.7 KB
Loading
24.5 KB
Loading
Loading
48.4 KB
Loading
41.9 KB
Loading

0 commit comments

Comments
 (0)