Skip to content

Commit 02b5896

Browse files
[StepSecurity] ci: Harden GitHub Actions (#3286)
Signed-off-by: StepSecurity Bot <[email protected]> Signed-off-by: StepSecurity Bot <[email protected]>
1 parent 7af22ba commit 02b5896

File tree

11 files changed

+59
-59
lines changed

11 files changed

+59
-59
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ jobs:
4040
k8s_latest: ${{ steps.vars.outputs.k8s_latest }}
4141
steps:
4242
- name: Checkout Repository
43-
uses: actions/checkout@v3
43+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
4444
- name: Output Variables
4545
id: vars
4646
run: |
4747
echo "k8s_latest=$(grep -m1 'FROM kindest/node' <tests/docker/Dockerfile | awk -F'[:v]' '{print $3}')" >> $GITHUB_OUTPUT
4848
- name: Setup Golang Environment
49-
uses: actions/setup-go@v3
49+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
5050
with:
5151
go-version-file: go.mod
5252
cache: true
@@ -71,16 +71,16 @@ jobs:
7171
needs: checks
7272
steps:
7373
- name: Checkout Repository
74-
uses: actions/checkout@v3
74+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
7575
with:
7676
fetch-depth: 0
7777
- name: Setup Golang Environment
78-
uses: actions/setup-go@v3
78+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
7979
with:
8080
go-version-file: go.mod
8181
cache: true
8282
- name: Build binary
83-
uses: goreleaser/goreleaser-action@v3
83+
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3.2.0
8484
with:
8585
version: latest
8686
args: build --snapshot --rm-dist --single-target --id kubernetes-ingress
@@ -89,7 +89,7 @@ jobs:
8989
GOPATH: ${{ needs.checks.outputs.go_path }}
9090

9191
- name: Store Artifacts in Cache
92-
uses: actions/cache@v3
92+
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
9393
with:
9494
path: ${{ github.workspace }}/dist
9595
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}-single
@@ -100,16 +100,16 @@ jobs:
100100
needs: checks
101101
steps:
102102
- name: Checkout Repository
103-
uses: actions/checkout@v3
103+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
104104
- name: Setup Golang Environment
105-
uses: actions/setup-go@v3
105+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
106106
with:
107107
go-version-file: go.mod
108108
cache: true
109109
- name: Run Tests
110110
run: make cover
111111
- name: Upload coverage to Codecov
112-
uses: codecov/codecov-action@v3
112+
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # v3.1.1
113113
with:
114114
files: ./coverage.txt
115115

@@ -126,16 +126,16 @@ jobs:
126126
type: plus
127127
steps:
128128
- name: Checkout Repository
129-
uses: actions/checkout@v3
129+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
130130
- name: Fetch Cached Artifacts
131-
uses: actions/cache@v3
131+
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
132132
with:
133133
path: ${{ github.workspace }}/dist
134134
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}-single
135135
- name: Docker Buildx
136-
uses: docker/setup-buildx-action@v2
136+
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # v2.2.1
137137
- name: Build Docker Image ${{ matrix.image }}
138-
uses: docker/build-push-action@v3
138+
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # v3.2.0
139139
with:
140140
file: build/Dockerfile
141141
context: '.'
@@ -230,7 +230,7 @@ jobs:
230230
matrix: ${{ fromJSON(needs.setup-matrix.outputs.matrix) }}
231231
steps:
232232
- name: Checkout Repository
233-
uses: actions/checkout@v3
233+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
234234
- name: Run Smoke Tests
235235
id: smoke-tests
236236
uses: ./.github/actions/smoke-tests
@@ -241,7 +241,7 @@ jobs:
241241
nginx-crt: ${{ contains(matrix.images.image, 'nap') && secrets.NGINX_AP_CRT || secrets.NGINX_CRT }}
242242
nginx-key: ${{ contains(matrix.images.image, 'nap') && secrets.NGINX_AP_KEY || secrets.NGINX_KEY }}
243243
- name: Upload Test Results
244-
uses: actions/upload-artifact@v3
244+
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
245245
with:
246246
name: ${{ steps.smoke-tests.outputs.test-results-name }}
247247
path: ${{ github.workspace }}/tests/${{ steps.smoke-tests.outputs.test-results-name }}.html
@@ -253,21 +253,21 @@ jobs:
253253
needs: [checks, smoke-tests, helm-tests]
254254
steps:
255255
- name: Checkout Repository
256-
uses: actions/checkout@v3
256+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
257257
with:
258258
fetch-depth: 0
259259
- name: Setup Golang Environment
260-
uses: actions/setup-go@v3
260+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
261261
with:
262262
go-version-file: go.mod
263263
cache: true
264264

265-
- uses: actions/setup-node@v3
265+
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
266266
- run: npm install js-yaml
267267
continue-on-error: true
268268
if: startsWith(github.ref, 'refs/tags/')
269269
- name: Publish release on tag
270-
uses: actions/github-script@v6
270+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
271271
continue-on-error: true
272272
with:
273273
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -306,10 +306,10 @@ jobs:
306306
if: startsWith(github.ref, 'refs/tags/')
307307

308308
- name: Download Syft
309-
uses: anchore/sbom-action/[email protected]
309+
uses: anchore/sbom-action/download-syft@06e109483e6aa305a2b2395eabae554e51530e1d # v0.13.1
310310

311311
- name: Build binaries
312-
uses: goreleaser/goreleaser-action@v3
312+
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # v3.2.0
313313
with:
314314
version: latest
315315
args: ${{ startsWith(github.ref, 'refs/tags/') && 'release' || 'build --snapshot' }} ${{ github.event_name == 'pull_request' && '--single-target' || '' }} --rm-dist
@@ -330,7 +330,7 @@ jobs:
330330
AZURE_BUCKET_NAME: ${{ secrets.AZURE_BUCKET_NAME }}
331331

332332
- name: Store Artifacts in Cache
333-
uses: actions/cache@v3
333+
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
334334
with:
335335
path: ${{ github.workspace }}/dist
336336
key: nginx-ingress-${{ github.run_id }}-${{ github.run_number }}-multi
@@ -400,7 +400,7 @@ jobs:
400400
if: ${{ github.event_name == 'push' }}
401401
steps:
402402
- name: Checkout Repository
403-
uses: actions/checkout@v3
403+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
404404
- name: Output Variables
405405
id: var
406406
run: |
@@ -418,7 +418,7 @@ jobs:
418418
- name: Package
419419
run: helm package --version ${{ steps.var.outputs.helm_version }} ${{ env.HELM_CHART_DIR }}
420420
- name: Upload Chart
421-
uses: actions/upload-artifact@v3
421+
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
422422
with:
423423
name: helm-chart
424424
path: ${{ github.workspace }}/nginx-ingress-${{ steps.var.outputs.helm_version }}.tgz
@@ -430,15 +430,15 @@ jobs:
430430
if: ${{ github.event_name == 'push' }}
431431
steps:
432432
- name: Checkout Repository
433-
uses: actions/checkout@v3
433+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
434434
with:
435435
repository: nginxinc/helm-charts
436436
fetch-depth: 1
437437
token: ${{ secrets.NGINX_PAT }}
438438
- name: Remove previous Chart
439439
run: rm -f ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}/nginx-ingress-${{ needs.package-helm.outputs.version }}.tgz
440440
- name: Retrieve latest Helm Chart
441-
uses: actions/download-artifact@v3
441+
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
442442
with:
443443
name: helm-chart
444444
path: ${{ github.workspace }}/${{ needs.package-helm.outputs.type }}

.github/workflows/codeql-analysis.yml

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

3333
steps:
3434
- name: Checkout repository
35-
uses: actions/checkout@v3
35+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
3636

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

5252
# ℹ️ Command-line programs to run using the OS shell.
5353
# 📚 https://git.io/JvXDl
@@ -61,4 +61,4 @@ jobs:
6161
# make release
6262

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

.github/workflows/dockerhub-description.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ jobs:
1717
runs-on: ubuntu-22.04
1818
if: ${{ github.event.repository.fork == false }}
1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
2121

2222
- name: Modify readme for DockerHub
2323
run: |
2424
sed -i '3,4d' README.md
2525
2626
- name: Docker Hub Description
27-
uses: peter-evans/dockerhub-description@v3
27+
uses: peter-evans/dockerhub-description@93b93397c27ed52b4055b8c6b2f8d92456ab3c56 # v3.1.2
2828
with:
2929
username: ${{ secrets.DOCKER_USERNAME }}
3030
password: ${{ secrets.DOCKER_PASSWORD }}

.github/workflows/fossa.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
if: ${{ github.event.repository.fork == false }}
2525
steps:
2626
- name: Checkout Repository
27-
uses: actions/checkout@v3
27+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
2828
- name: Scan
29-
uses: fossas/fossa-action@v1
29+
uses: fossas/fossa-action@f61a4c0c263690f2ddb54b9822a719c25a7b608f # v1.3.1
3030
with:
3131
api-key: ${{ secrets.FOSSA_TOKEN }}

.github/workflows/issues.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
echo "::set-output name=text::$text"
1919
- name: Check if Issue author is Org member
2020
id: membercheck
21-
uses: actions/github-script@v6
21+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
2222
with:
2323
github-token: ${{ secrets.GITHUB_TOKEN }}
2424
script: |
@@ -36,7 +36,7 @@ jobs:
3636
}
3737
return member
3838
- name: Send message
39-
uses: actions/github-script@v6
39+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
4040
if: steps.membercheck.outputs.result == 'false'
4141
with:
4242
github-token: ${{secrets.GITHUB_TOKEN}}

.github/workflows/lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
runs-on: ubuntu-22.04
2929
steps:
3030
- name: Checkout Repository
31-
uses: actions/checkout@v3
31+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
3232
- name: Setup Golang Environment
33-
uses: actions/setup-go@v3
33+
uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # v3.3.1
3434
with:
3535
go-version-file: go.mod
3636
cache: true
3737
- name: Lint Code
38-
uses: golangci/golangci-lint-action@v3
38+
uses: golangci/golangci-lint-action@07db5389c99593f11ad7b44463c2d4233066a9b1 # v3.3.0
3939
with:
4040
only-new-issues: true
4141

@@ -44,7 +44,7 @@ jobs:
4444
runs-on: ubuntu-22.04
4545
steps:
4646
- name: Checkout Repository
47-
uses: actions/checkout@v3
48-
- uses: reviewdog/action-actionlint@v1
47+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
48+
- uses: reviewdog/action-actionlint@5c714fa8ca7b5ea8d929d273ed5bb2e3a4a7c019 # v1.34.1
4949
with:
5050
actionlint_flags: -shellcheck ""

.github/workflows/notifications.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.repository.fork == false }}
2020
steps:
2121
- name: Data
22-
uses: actions/github-script@v6
22+
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
2323
continue-on-error: true
2424
id: data
2525
with:
@@ -40,7 +40,7 @@ jobs:
4040
}
4141
4242
- name: Send Notification
43-
uses: 8398a7/action-slack@v3
43+
uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435 # v3.14.0
4444
with:
4545
status: custom
4646
custom_payload: |

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
name: Create Draft Release
2626
runs-on: ubuntu-22.04
2727
steps:
28-
- uses: actions/setup-node@v3
28+
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
2929
- run: npm install semver
30-
- uses: actions/github-script@v6
30+
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
3131
continue-on-error: true
3232
with:
3333
script: |

.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.'

.github/workflows/sync.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
if: ${{ github.event.repository.fork == false }}
2020
steps:
2121
- name: Repo Sync
22-
uses: wei/git-sync@v3
22+
uses: wei/git-sync@55c6b63b4f21607da0e9877ca9b4d11a29fc6d83 # v3.0.0
2323
with:
2424
source_repo: "nginxinc/kubernetes-ingress"
2525
source_branch: "main"
@@ -43,9 +43,9 @@ jobs:
4343
if: ${{ github.event.repository.fork == false }}
4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
4747
- name: Sync Labels
48-
uses: micnncim/action-label-syncer@v1
48+
uses: micnncim/action-label-syncer@3abd5ab72fda571e69fffd97bd4e0033dd5f495c # v1.3.0
4949
with:
5050
repository: ${{ matrix.repo }}
5151
token: ${{ secrets.NGINX_PAT }}

0 commit comments

Comments
 (0)