Skip to content

Commit d7fb93f

Browse files
authored
Add GitHub Actions security scanning with CodeQL and zizmor (#7)
* Setup Dependabot * Restrict workflow permissions to read-only * Pin GitHub Actions * Disable persist-credentials for actions/checkout * Setup CI Scanning via codeql / zizmor
1 parent 961065f commit d7fb93f

3 files changed

Lines changed: 74 additions & 2 deletions

File tree

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
cooldown:
8+
default-days: 7
9+
10+
- package-ecosystem: "mix"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
cooldown:
15+
default-days: 7

.github/workflows/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "29 8 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
analyze:
16+
name: Analyze (${{ matrix.language }})
17+
runs-on: "ubuntu-latest"
18+
permissions:
19+
security-events: write
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- language: actions
25+
build-mode: none
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
persist-credentials: false
31+
- name: Initialize CodeQL
32+
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
33+
with:
34+
languages: ${{ matrix.language }}
35+
build-mode: ${{ matrix.build-mode }}
36+
- name: Perform CodeQL Analysis
37+
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
38+
with:
39+
category: "/language:${{matrix.language}}"
40+
41+
zizmor:
42+
name: Zizmor
43+
runs-on: ubuntu-latest
44+
permissions:
45+
security-events: write
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49+
with:
50+
persist-credentials: false
51+
- name: Run zizmor
52+
uses: zizmorcore/zizmor-action@0dce2577a4760a2749d8cfb7a84b7d5585ebcb7d # v0.5.0

.github/workflows/main.yml

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

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
69
test:
710
name: Test
@@ -29,10 +32,12 @@ jobs:
2932
- erlang: "24.3.4"
3033
elixir: "1.12.3"
3134
steps:
32-
- uses: actions/checkout@v4
35+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
36+
with:
37+
persist-credentials: false
3338

3439
- name: Install OTP and Elixir
35-
uses: erlef/setup-beam@v1
40+
uses: erlef/setup-beam@ee09b1e59bb240681c382eb1f0abc6a04af72764 # v1.23.0
3641
with:
3742
otp-version: ${{matrix.erlang}}
3843
elixir-version: ${{matrix.elixir}}

0 commit comments

Comments
 (0)