Skip to content

Commit 8976080

Browse files
Thomas De Meyerdemeyerthom
andauthored
Add pinact and zizmor workflow checks (#46)
* Add pinact and zizmor workflow checks * Add .pinact.yaml to ignore unpinnable actions * Add .github/zizmor.yml to ignore pre-existing findings * Update golangci-lint config to v2 * Use golangci-lint v2 in CI * Pin golangci-lint to v2.12.2 * Upgrade golangci-lint-action to v7 for golangci-lint v2 support * Remove .pinact.yaml ignore file * Fix cache-poisoning: disable setup-go caching * Delete .github/zizmor.yml * chore: fixed zizmor issues --------- Co-authored-by: Thomas de Meyer <demeyerthom@users.noreply.github.com>
1 parent c3655f2 commit 8976080

10 files changed

Lines changed: 140 additions & 44 deletions

File tree

.github/dependabot.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ updates:
1111
go:
1212
patterns:
1313
- "*"
14+
cooldown:
15+
default-days: 7
1416

1517
- package-ecosystem: "github-actions"
1618
directory: "/"
@@ -23,3 +25,5 @@ updates:
2325
github-actions:
2426
patterns:
2527
- "*"
28+
cooldown:
29+
default-days: 7

.github/workflows/codeql.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,18 @@ jobs:
4040

4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
44+
with:
45+
persist-credentials: false
4446

4547
- name: Set up Go
46-
uses: actions/setup-go@v5
48+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
4749
with:
4850
go-version-file: go.mod
4951

5052
# Initializes the CodeQL tools for scanning.
5153
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@v3
54+
uses: github/codeql-action/init@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
5355
with:
5456
languages: ${{ matrix.language }}
5557
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -63,7 +65,7 @@ jobs:
6365
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
6466
# If this step fails, then you should remove it and run the build manually (see below)
6567
- name: Autobuild
66-
uses: github/codeql-action/autobuild@v3
68+
uses: github/codeql-action/autobuild@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
6769

6870
# ℹ️ Command-line programs to run using the OS shell.
6971
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -76,6 +78,6 @@ jobs:
7678
# ./location_of_script_within_repo/buildscript.sh
7779

7880
- name: Perform CodeQL Analysis
79-
uses: github/codeql-action/analyze@v3
81+
uses: github/codeql-action/analyze@ce64ddcb0d8d890d2df4a9d1c04ff297367dea2a # v3.35.2
8082
with:
8183
category: "/language:${{matrix.language}}"

.github/workflows/dependabot-changie.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,26 @@ permissions:
1212
jobs:
1313
dependabot-changie:
1414
runs-on: ubuntu-latest
15-
if: github.actor == 'dependabot[bot]'
15+
if: github.event.pull_request.user.login == 'dependabot[bot]'
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
19+
with:
20+
persist-credentials: false
1921

2022
- name: Fetch Dependabot metadata
2123
id: dependabot-metadata
22-
uses: dependabot/fetch-metadata@v2
24+
uses: dependabot/fetch-metadata@21025c705c08248db411dc16f3619e6b5f9ea21a # v2.5.0
2325
with:
2426
github-token: "${{ secrets.GITHUB_TOKEN }}"
2527

2628
- name: Create change file
27-
uses: miniscruff/changie-action@v2
29+
uses: miniscruff/changie-action@6dcc2533cac0495148ed4046c438487e4dceaa23 # v2.0.0
2830
with:
2931
version: latest
3032
args: new --body "${{ github.event.pull_request.title }}" --kind Dependency
3133

32-
- uses: stefanzweifel/git-auto-commit-action@v7-next
34+
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
3335
with:
3436
commit_message: "chore(deps): add changelog for dependabot updates"
3537
commit_user_name: "dependabot[bot]"

.github/workflows/pinact.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Pinact
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
paths:
9+
- ".github/workflows/**"
10+
- ".github/actions/**"
11+
12+
permissions: {}
13+
14+
jobs:
15+
pinact:
16+
# Only run on pull requests from the same repository
17+
if: github.event.pull_request.head.repo.full_name == github.repository
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
persist-credentials: false
26+
27+
- name: Pin actions
28+
uses: suzuki-shunsuke/pinact-action@cf51507d80d4d6522a07348e3d58790290eaf0b6 # v2.0.0
29+
with:
30+
skip_push: true
31+
verify: true
32+
min_age: 7

.github/workflows/prepare-release.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1313
with:
1414
fetch-depth: 0
15+
persist-credentials: false
1516

1617
- name: Prepare release
17-
uses: labd/changie-release-action@v0.4.0
18+
uses: labd/changie-release-action@c3368fda69f814cd8b78d36834fb154254ea8c23 # v0.4.0
1819
with:
1920
github-token: ${{ secrets.GITHUB_TOKEN }}
2021
release-workflow: release.yaml

.github/workflows/pull-request.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@ jobs:
99

1010
steps:
1111
- name: Check out code
12-
uses: actions/checkout@v4
12+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1313
with:
1414
fetch-depth: 0
15+
persist-credentials: false
1516

1617
- name: Set up Go
17-
uses: actions/setup-go@v5
18+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
1819
with:
1920
go-version-file: "go.mod"
21+
cache: false
2022

2123
- name: Install dependencies
2224
run: go get ./...
2325

2426
- name: golangci-lint
25-
uses: golangci/golangci-lint-action@v6
27+
uses: golangci/golangci-lint-action@9fae48acfc02a90574d7c304a1758ef9895495fa # v7.0.1
2628
with:
29+
version: v2.12.2
2730
args: --issues-exit-code=0
2831

2932
- name: Run tests
@@ -36,12 +39,12 @@ jobs:
3639
AMPLIENCE_HUB_ID: ${{ secrets.AMPLIENCE_HUB_ID }}
3740

3841
- name: Upload to codecov
39-
uses: codecov/codecov-action@v4
42+
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
4043
with:
4144
verbose: true
4245

4346
- name: build binary
44-
uses: goreleaser/goreleaser-action@v6
47+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
4548
with:
4649
args: build --snapshot --clean --single-target
4750
env:
@@ -56,12 +59,13 @@ jobs:
5659
pull-requests: write
5760
actions: write
5861
steps:
59-
- uses: actions/checkout@v4
62+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
6063
with:
6164
fetch-depth: 0
65+
persist-credentials: false
6266

6367
- name: Prepare release
64-
uses: labd/changie-release-action@v0.4.0
68+
uses: labd/changie-release-action@c3368fda69f814cd8b78d36834fb154254ea8c23 # v0.4.0
6569
with:
6670
github-token: ${{ secrets.GITHUB_TOKEN }}
6771
release-workflow: 'release.yaml'

.github/workflows/release.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Check out code
10-
uses: actions/checkout@v4
10+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
1111
with:
1212
fetch-depth: 0
13+
persist-credentials: false
1314

1415
- name: Set up Go
15-
uses: actions/setup-go@v5
16+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
1617
with:
1718
go-version-file: "go.mod"
19+
cache: false
1820

1921
- name: Import GPG key
2022
id: import_gpg
21-
uses: paultyng/ghaction-import-gpg@v2.1.0
23+
uses: paultyng/ghaction-import-gpg@53deb67fe3b05af114ad9488a4da7b782455d588 # v2.1.0
2224
env:
2325
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
2426
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
2527

2628
- name: Run GoReleaser
27-
uses: goreleaser/goreleaser-action@v6
29+
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
2830
with:
2931
version: latest
3032
args: release --clean

.github/workflows/triage.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ jobs:
1515
steps:
1616
- name: get app token
1717
id: get-app-token
18-
uses: labd/action-gh-app-token@main
18+
uses: labd/action-gh-app-token@570381a08efe9c961806a3a3bc5882af5f50ef6a # v0.1.0
1919
with:
2020
app-id: ${{ secrets.RD_APP_ID }}
2121
private-key: ${{ secrets.RD_APP_PRIVATE_KEY }}
2222
installation-id: ${{ secrets.RD_APP_INSTALLATION_ID }}
2323
- name: set to project board
24-
uses: actions/add-to-project@v1.0.2
24+
uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
2525
with:
2626
project-url: https://github.com/orgs/labd/projects/3
2727
github-token: ${{ steps.get-app-token.outputs.app-token }}

.github/workflows/zizmor.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Zizmor
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
paths:
9+
- ".github/workflows/**"
10+
- ".github/actions/**"
11+
12+
permissions: {}
13+
14+
jobs:
15+
zizmor:
16+
name: Run zizmor
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
actions: read
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
persist-credentials: false
26+
27+
- name: Run zizmor
28+
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
29+
with:
30+
advanced-security: false
31+
annotations: true
32+
min-severity: high

.golangci.yml

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1+
version: "2"
12
linters:
2-
disable-all: true
3+
default: none
34
enable:
4-
- asciicheck
5-
- bodyclose
6-
- contextcheck
7-
- cyclop
8-
- errcheck
9-
- exhaustive
10-
- exportloopref
11-
- forcetypeassert
12-
- goimports
13-
- gosimple
14-
- govet
15-
- ineffassign
16-
- predeclared
17-
- staticcheck
18-
- tenv
19-
- typecheck
20-
- unused
21-
- whitespace
5+
- asciicheck
6+
- bodyclose
7+
- contextcheck
8+
- copyloopvar
9+
- errcheck
10+
- exhaustive
11+
- forcetypeassert
12+
- govet
13+
- ineffassign
14+
- predeclared
15+
- staticcheck
16+
- unused
17+
- usetesting
18+
- whitespace
19+
exclusions:
20+
generated: lax
21+
presets:
22+
- comments
23+
- common-false-positives
24+
- legacy
25+
- std-error-handling
26+
paths:
27+
- third_party$
28+
- builtin$
29+
- examples$
30+
formatters:
31+
enable:
32+
- goimports
33+
exclusions:
34+
generated: lax
35+
paths:
36+
- third_party$
37+
- builtin$
38+
- examples$

0 commit comments

Comments
 (0)