Skip to content

Commit 331697a

Browse files
[StepSecurity] ci: Harden GitHub Actions (#319)
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
1 parent fa6db0a commit 331697a

File tree

9 files changed

+31
-31
lines changed

9 files changed

+31
-31
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
runs-on: ubuntu-22.04
3131
steps:
3232
- name: Checkout Repository
33-
uses: actions/checkout@v3
33+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
3434
- name: Setup Golang Environment
35-
uses: actions/setup-go@v3
35+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
3636
with:
3737
go-version-file: go.mod
3838
cache: true
@@ -45,11 +45,11 @@ jobs:
4545
needs: [unit-tests]
4646
steps:
4747
- name: Checkout Repository
48-
uses: actions/checkout@v3
48+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
4949
with:
5050
fetch-depth: 0
5151
- name: Setup Golang Environment
52-
uses: actions/setup-go@v3
52+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
5353
with:
5454
go-version-file: go.mod
5555
cache: true
@@ -58,42 +58,42 @@ jobs:
5858
run: |
5959
echo "::set-output name=go_path::$(go env GOPATH)"
6060
- name: Setup QEMU
61-
uses: docker/setup-qemu-action@v2
61+
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
6262
with:
6363
platforms: arm,arm64,ppc64le,s390x,mips64le,386
6464
if: github.event_name != 'pull_request'
6565
- name: Docker Buildx
66-
uses: docker/setup-buildx-action@v2
66+
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
6767
- name: DockerHub Login
68-
uses: docker/login-action@v2
68+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
6969
with:
7070
username: ${{ secrets.DOCKER_USERNAME }}
7171
password: ${{ secrets.DOCKER_PASSWORD }}
7272
if: github.event_name != 'pull_request'
7373
- name: Login to GitHub Container Registry
74-
uses: docker/login-action@v2
74+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
7575
with:
7676
registry: ghcr.io
7777
username: ${{ github.repository_owner }}
7878
password: ${{ secrets.GITHUB_TOKEN }}
7979
if: github.event_name != 'pull_request'
8080
- name: Login to Public ECR
81-
uses: docker/login-action@v2
81+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
8282
with:
8383
registry: public.ecr.aws
8484
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
8585
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8686
if: github.event_name != 'pull_request'
8787
- name: Login to Quay.io
88-
uses: docker/login-action@v2
88+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
8989
with:
9090
registry: quay.io
9191
username: ${{ secrets.QUAY_USERNAME }}
9292
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
9393
if: github.event_name != 'pull_request'
9494
- name: Docker meta
9595
id: meta
96-
uses: docker/metadata-action@v4
96+
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea # v4.1.1
9797
with:
9898
images: |
9999
nginx/nginx-prometheus-exporter
@@ -109,16 +109,16 @@ jobs:
109109
labels: |
110110
org.opencontainers.image.vendor=NGINX Inc <integrations@nginx.com>
111111
- name: Publish Release Notes
112-
uses: release-drafter/release-drafter@v5
112+
uses: release-drafter/release-drafter@6df64e4ba4842c203c604c1f45246c5863410adb # v5.21.1
113113
with:
114114
publish: true
115115
env:
116116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117117
if: ${{ startsWith(github.ref, 'refs/tags/') }}
118118
- name: Download Syft
119-
uses: anchore/sbom-action/download-syft@v0.13.1
119+
uses: anchore/sbom-action/download-syft@06e109483e6aa305a2b2395eabae554e51530e1d # v0.13.1
120120
- name: Run GoReleaser
121-
uses: goreleaser/goreleaser-action@v3
121+
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3.2.0
122122
with:
123123
version: latest
124124
args: ${{ !startsWith(github.ref, 'refs/tags/') && 'build --snapshot' || 'release' }} ${{ github.event_name == 'pull_request' && '--single-target' || '' }} --rm-dist
@@ -128,7 +128,7 @@ jobs:
128128
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.NGINX_PAT }}
129129
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_COMMUNITY }}
130130
- name: Push to Dockerhub
131-
uses: docker/build-push-action@v3
131+
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0
132132
with:
133133
file: build/Dockerfile
134134
context: '.'

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242

4343
steps:
4444
- name: Checkout repository
45-
uses: actions/checkout@v3
45+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@v2
49+
uses: github/codeql-action/init@678fc3afe258fb2e0cdc165ccf77b85719de7b3c # v2.1.33
5050
with:
5151
languages: ${{ matrix.language }}
5252
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -57,7 +57,7 @@ jobs:
5757
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5858
# If this step fails, then you should remove it and run the build manually (see below)
5959
- name: Autobuild
60-
uses: github/codeql-action/autobuild@v2
60+
uses: github/codeql-action/autobuild@678fc3afe258fb2e0cdc165ccf77b85719de7b3c # v2.1.33
6161

6262
# ℹ️ Command-line programs to run using the OS shell.
6363
# 📚 https://git.io/JvXDl
@@ -71,4 +71,4 @@ jobs:
7171
# make release
7272

7373
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v2
74+
uses: github/codeql-action/analyze@678fc3afe258fb2e0cdc165ccf77b85719de7b3c # v2.1.33

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
steps:
1111
- name: Dependabot metadata
1212
id: dependabot-metadata
13-
uses: dependabot/fetch-metadata@v1.3.5
13+
uses: dependabot/fetch-metadata@5ef00187930bafb52d529e0b9c3dff045dfa9851 # v1.3.5
1414
- name: Enable auto-merge for Dependabot PRs
1515
run: gh pr merge --auto --squash "$PR_URL"
1616
env:

.github/workflows/dockerhub-description.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
dockerHubDescription:
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
1414

1515
- name: Modify readme for DockerHub
1616
run: |
1717
sed -i '1,2d' README.md
1818
sed -i 's/(LICENSE)/(https:\/\/github.com\/nginxinc\/nginx-prometheus-exporter\/blob\/main\/LICENSE)/' README.md
1919
2020
- name: Docker Hub Description
21-
uses: peter-evans/dockerhub-description@v3
21+
uses: peter-evans/dockerhub-description@93b93397c27ed52b4055b8c6b2f8d92456ab3c56 # v3.1.2
2222
with:
2323
username: ${{ secrets.DOCKER_USERNAME }}
2424
password: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/fossa.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
runs-on: ubuntu-22.04
1919
steps:
2020
- name: Checkout Repository
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
2222
- name: Scan
23-
uses: fossas/fossa-action@v1
23+
uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # v1.3.1
2424
with:
2525
api-key: ${{ secrets.FOSSA_TOKEN }}

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ jobs:
2929
runs-on: ubuntu-22.04
3030
steps:
3131
- name: Checkout Repository
32-
uses: actions/checkout@v3
32+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
3333
- name: Output Variables
3434
id: vars
3535
run: echo "::set-output name=go_version::$(grep "go 1." go.mod | cut -d " " -f 2)"
3636
- name: Setup Golang Environment
37-
uses: actions/setup-go@v3
37+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
3838
with:
3939
go-version: ${{ steps.vars.outputs.go_version }}
4040
- name: Lint Code
41-
uses: golangci/golangci-lint-action@v3
41+
uses: golangci/golangci-lint-action@07db5389c99593f11ad7b44463c2d4233066a9b1 # v3.3.0

.github/workflows/notifications.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
1818
steps:
1919
- name: Data
20-
uses: actions/github-script@v6
20+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
2121
continue-on-error: true
2222
id: data
2323
with:
@@ -38,7 +38,7 @@ jobs:
3838
}
3939
4040
- name: Send Notification
41-
uses: 8398a7/action-slack@v3
41+
uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435 # v3.14.0
4242
with:
4343
status: custom
4444
custom_payload: |

.github/workflows/release-drafter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
contents: write
1616
pull-requests: read
1717
steps:
18-
- uses: release-drafter/release-drafter@v5
18+
- uses: release-drafter/release-drafter@6df64e4ba4842c203c604c1f45246c5863410adb # v5.21.1
1919
with:
2020
disable-autolabeler: true
2121
env:

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pull-requests: write # for actions/stale to close stale PRs
1414
runs-on: ubuntu-22.04
1515
steps:
16-
- uses: actions/stale@v6
16+
- uses: actions/stale@5ebf00ea0e4c1561e9b43a292ed34424fb1d4578 # v6.0.1
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-issue-message: 'This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days.'

0 commit comments

Comments
 (0)