Skip to content

Commit 2276412

Browse files
bugerclaude
andauthored
security: complete supply-chain hardening (#443)
* security: pin all GitHub Actions to SHA, harden supply chain - Pin all `uses:` references to full SHA-256 commit hashes across workflows and Go templates (14 files, 30+ action references) - Pin TykTechnologies/github-actions refs to @42304edda365365e0a887cf018d8edc34b960b82 - Add dependency-guard reusable workflow to release.yml PR builds - Pin Dockerfile base image (debian:stable-slim) to digest - Replace npm ci with npm install --ignore-scripts (goreleaser.yml, ai-studio-frontend-build) - Add --no-deps to pip install commands (build-tat) - Flag curl|bash patterns with TODO(security) comments Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add inline SECURITY markers to curl|bash lines in smoke-tests The curl|bash invocations for packagecloud repo setup already had TODO comments on preceding lines, but the security check grep requires the marker on the same line. Added inline SECURITY annotations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6359758 commit 2276412

14 files changed

Lines changed: 100 additions & 91 deletions

File tree

.github/workflows/pages.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ jobs:
2626
runs-on: ubuntu-latest
2727
steps:
2828
- name: Checkout
29-
uses: actions/checkout@v4
30-
29+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
30+
3131
- name: Setup Go
32-
uses: actions/setup-go@v5
32+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
3333
with:
3434
go-version: '1.22'
35-
35+
3636
- name: Generate Static Site
3737
run: go run main.go policy generate-tui --config-dir config/tui --out-dir public
38-
38+
3939
- name: Setup Pages
40-
uses: actions/configure-pages@v5
41-
40+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
41+
4242
- name: Upload artifact
43-
uses: actions/upload-pages-artifact@v3
43+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
4444
with:
4545
path: './public'
46-
46+
4747
- name: Deploy to GitHub Pages
4848
id: deployment
49-
uses: actions/deploy-pages@v4
49+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4

.github/workflows/release.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,37 @@ on:
1111
- master
1212

1313
jobs:
14+
dep-guard:
15+
if: github.event_name == 'pull_request'
16+
uses: TykTechnologies/github-actions/.github/workflows/dependency-guard.yml@42304edda365365e0a887cf018d8edc34b960b82 # main
17+
1418
goreleaser:
19+
needs: [dep-guard]
20+
if: always() && (needs.dep-guard.result == 'success' || needs.dep-guard.result == 'skipped')
1521
runs-on: ${{ vars.DEFAULT_RUNNER }}
1622
permissions:
1723
id-token: write
1824

1925
steps:
2026
- name: Checkout
21-
uses: actions/checkout@v4
27+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
2228

2329
- name: Set up Go
24-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
2531
with:
2632
go-version: "1.22"
2733

28-
- uses: docker/setup-buildx-action@v3
34+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
2935

3036
- run: make test
3137

32-
- uses: docker/login-action@v3
38+
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
3339
if: startsWith(github.ref, 'refs/tags/')
3440
with:
3541
username: ${{ secrets.DOCKER_USERNAME }}
3642
password: ${{ secrets.DOCKER_PASSWORD }}
3743

38-
- uses: goreleaser/goreleaser-action@v6
44+
- uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
3945
with:
4046
version: "~> v2"
4147
args: release --clean ${{ !startsWith(github.ref, 'refs/tags/') && '--snapshot' || '' }}
@@ -48,7 +54,7 @@ jobs:
4854
path=$(jq -rc '.[] | select((.type=="Binary") and (.goos=="linux") and .goarch=="amd64") | .path' dist/artifacts.json)
4955
echo "path=${path}" >> $GITHUB_OUTPUT
5056
51-
- uses: actions/upload-artifact@v4
57+
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
5258
with:
5359
name: binary-amd64
5460
path: ${{ steps.binary.outputs.path }}
@@ -75,15 +81,15 @@ jobs:
7581

7682
steps:
7783
- name: checkout ${{matrix.repo}}/${{matrix.branch}}
78-
uses: actions/checkout@v4
84+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7985
with:
8086
repository: ${{ matrix.owner }}/${{ matrix.repo }}
8187
ref: ${{ matrix.branch }}
8288
token: ${{ secrets.ORG_GH_TOKEN }}
8389
path: ${{ matrix.repo }}
8490
fetch-depth: 1
8591

86-
- uses: actions/download-artifact@v4
92+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
8793
id: download
8894
with:
8995
name: binary-amd64

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
FROM debian:stable-slim
1+
FROM debian:stable-slim@sha256:99fc6d2a0882fcbcdc452948d2d54eab91faafc7db037df82425edcdcf950e1f
22
RUN apt-get update && apt-get dist-upgrade -y git curl
3+
# TODO(security): curl piped to shell - consider pre-downloading and verifying checksum
34
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg -o /usr/share/keyrings/githubcli-archive-keyring.gpg \
45
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
56
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \

policy/templates/nightly-e2e/.github/workflows/nightly-e2e-tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@ jobs:
4141
id-token: write # This is required for requesting the Github JWT
4242
contents: read # This is required for actions/checkout
4343
steps:
44-
- uses: aws-actions/configure-aws-credentials@v4
44+
- uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c # v4
4545
with:
4646
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
4747
role-session-name: cipush
4848
aws-region: eu-central-1
4949
- id: ecr
50-
uses: aws-actions/amazon-ecr-login@v2
50+
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
5151
with:
5252
mask-password: 'true'
5353
- name: Run Trivy vulnerability scanner for dashboard
5454
id: trivy_dashboard
55-
uses: aquasecurity/trivy-action@master
55+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # master
5656
with:
5757
image-ref: "754489498669.dkr.ecr.eu-central-1.amazonaws.com/tyk-analytics:{{`${{ github.event.inputs.dashboard_image_tag || 'master' }}`}}"
5858
format: 'table'
@@ -65,7 +65,7 @@ jobs:
6565
- name: Run Trivy vulnerability scanner for gateway
6666
if: always()
6767
id: trivy_gateway
68-
uses: aquasecurity/trivy-action@master
68+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # master
6969
with:
7070
image-ref: "754489498669.dkr.ecr.eu-central-1.amazonaws.com/tyk-ee:{{`${{ github.event.inputs.gateway_image_tag || 'master' }}`}}"
7171
format: 'table'
@@ -78,7 +78,7 @@ jobs:
7878
- name: Run Trivy vulnerability scanner for MDCB
7979
if: always()
8080
id: trivy_mdcb
81-
uses: aquasecurity/trivy-action@master
81+
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # master
8282
with:
8383
image-ref: "754489498669.dkr.ecr.eu-central-1.amazonaws.com/tyk-sink:{{`${{ github.event.inputs.mdcb_image_tag || 'master' }}`}}"
8484
format: 'table'
@@ -90,7 +90,7 @@ jobs:
9090
skip-update: false
9191
- name: Send Slack notification
9292
if: failure() && (steps.trivy_dashboard.outcome != 'success' || steps.trivy_gateway.outcome != 'success' || steps.trivy_mdcb.outcome != 'success')
93-
uses: slackapi/slack-github-action@v1.25.0
93+
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
9494
with:
9595
channel-id: '#team-ext-engineering-pr-notifications'
9696
slack-message: |
@@ -118,7 +118,7 @@ jobs:
118118
contents: read
119119
steps:
120120
- name: Upload failed job logs
121-
uses: TykTechnologies/github-actions/.github/actions/gh-logs-analyser@main
121+
uses: TykTechnologies/github-actions/.github/actions/gh-logs-analyser@42304edda365365e0a887cf018d8edc34b960b82 # main
122122
with:
123123
github_token: ${{`{{ secrets.GITHUB_TOKEN }}`}}
124124
gh_logs_analyser_token: ${{`{{ secrets.GH_LOGS_ANALYSER }}`}}

policy/templates/releng/.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161

6262
sbom:
6363
needs: goreleaser
64-
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@main
64+
uses: TykTechnologies/github-actions/.github/workflows/sbom.yaml@42304edda365365e0a887cf018d8edc34b960b82 # main
6565
secrets:
6666
DEPDASH_URL: ${{`{{ secrets.DEPDASH_URL }}`}}
6767
DEPDASH_KEY: ${{`{{ secrets.DEPDASH_KEY }}`}}
@@ -77,7 +77,7 @@ jobs:
7777
contents: read
7878
steps:
7979
- name: Upload failed job logs
80-
uses: TykTechnologies/github-actions/.github/actions/gh-logs-analyser@main
80+
uses: TykTechnologies/github-actions/.github/actions/gh-logs-analyser@42304edda365365e0a887cf018d8edc34b960b82 # main
8181
with:
8282
github_token: ${{`{{ secrets.GITHUB_TOKEN }}`}}
8383
gh_logs_analyser_token: ${{`{{ secrets.GH_LOGS_ANALYSER }}`}}

policy/templates/releng/.github/workflows/release.yml.d/ai-studio-frontend-build.gotmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
frontend_built: {{`${{ steps.build.outputs.frontend_built }}`}}
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v4
9+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1010
with:
1111
fetch-depth: 0
1212
{{- if eq .Name "tyk-analytics" }}
@@ -16,7 +16,7 @@
1616
{{- end }}
1717

1818
- name: Set up Node.js
19-
uses: actions/setup-node@v4
19+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
2020
with:
2121
node-version: '18'
2222
cache: 'npm'
@@ -28,12 +28,12 @@
2828
CI: false
2929
run: |
3030
cd ui/admin-frontend
31-
npm ci
31+
npm install --ignore-scripts
3232
npm run build
3333
echo "frontend_built=true" >> $GITHUB_OUTPUT
3434

3535
- name: Upload frontend build artifacts
36-
uses: actions/upload-artifact@v4
36+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
3737
with:
3838
name: frontend-build
3939
path: ui/admin-frontend/build

policy/templates/releng/.github/workflows/release.yml.d/aws.gotmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
steps:
1515
- name: Checkout {{ .Name }}
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1717
with:
1818
fetch-depth: 1
1919

20-
- uses: actions/download-artifact@v4
20+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
2121
with:
2222
name: rpm
2323
path: aws
@@ -48,11 +48,11 @@
4848

4949
steps:
5050
- name: Checkout {{ .Name }}
51-
uses: actions/checkout@v4
51+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5252
with:
5353
fetch-depth: 1
5454

55-
- uses: actions/download-artifact@v4
55+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
5656
with:
5757
name: payg
5858
path: aws

policy/templates/releng/.github/workflows/release.yml.d/goreleaser.gotmpl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
steps:
5454
- name: Checkout of {{ .Name }}
55-
uses: actions/checkout@v4
55+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5656
with:
5757
fetch-depth: 1
5858
{{- if eq .Name "tyk-analytics" }}
@@ -85,7 +85,7 @@
8585

8686
{{- if has "ai-studio-frontend-build" .Branchvals.Features }}
8787
- name: Download frontend build artifacts
88-
uses: actions/download-artifact@v4
88+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
8989
with:
9090
name: frontend-build
9191
path: ui/admin-frontend/build
@@ -106,40 +106,40 @@
106106
echo "commit_author=$(git show -s --format='%ae' HEAD)" >> $GITHUB_OUTPUT
107107
echo "branch=${HEAD_REF##*/}" >> $GITHUB_OUTPUT
108108

109-
- uses: docker/setup-qemu-action@v3
109+
- uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
110110

111-
- uses: docker/setup-buildx-action@v3
111+
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
112112

113113
- name: Login to DockerHub
114114
if: startsWith(github.ref, 'refs/tags')
115-
uses: docker/login-action@v3
115+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
116116
with:
117117
username: {{`${{ secrets.DOCKER_USERNAME }}`}}
118118
password: {{`${{ secrets.DOCKER_PASSWORD }}`}}
119119

120120
- name: Login to Cloudsmith
121121
if: startsWith(github.ref, 'refs/tags')
122-
uses: docker/login-action@v3
122+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
123123
with:
124124
registry: docker.tyk.io
125125
username: {{`${{ secrets.CLOUDSMITH_USERNAME }}`}}
126126
password: {{`${{ secrets.CLOUDSMITH_API_KEY }}`}}
127127

128-
- uses: aws-actions/configure-aws-credentials@v4
128+
- uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c # v4
129129
with:
130130
role-to-assume: arn:aws:iam::754489498669:role/ecr_rw_tyk
131131
role-session-name: cipush
132132
aws-region: eu-central-1
133133
# Don't mask to pass it across job boundaries
134134
mask-aws-account-id: false
135135

136-
- uses: aws-actions/amazon-ecr-login@v2
136+
- uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2
137137
id: ecr
138138
if: {{`${{ matrix.golang_cross == '` }}{{.Branchvals.Buildenv}}{{`' }}`}}
139139
with:
140140
mask-password: 'true'
141141

142-
- uses: WarpBuilds/cache@v1
142+
- uses: WarpBuilds/cache@f643a1ba29942d56621d07fc2d4284c7219868ad # v1
143143
with:
144144
path: |
145145
~/.cache/go-build
@@ -248,7 +248,7 @@
248248
- name: Docker metadata for {{ $b }} CI
249249
id: ci_metadata_{{ $b }}
250250
if: {{`${{ matrix.golang_cross == '` }}{{$r.Branchvals.Buildenv}}{{`' }}`}}
251-
uses: docker/metadata-action@v5
251+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
252252
with:
253253
images: |
254254
{{printf "%s/%s" `${{ steps.ecr.outputs.registry }}` $bv.CIRepo}}
@@ -264,7 +264,7 @@
264264
265265
- name: push {{ $b }} image to CI
266266
if: {{`${{ matrix.golang_cross == '` }}{{$r.Branchvals.Buildenv}}{{`' }}`}} {{/* push only main build variation */}}
267-
uses: docker/build-push-action@v6
267+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
268268
with:
269269
context: {{ if has "ai-studio-frontend-build" $r.Branchvals.Features }}"."{{ else }}"dist"{{ end }}
270270
platforms: {{ $bv.GetDockerPlatforms | join "," }}
@@ -285,7 +285,7 @@
285285

286286
- name: Docker metadata for {{ $b }} tag push
287287
id: tag_metadata_{{ $b }}
288-
uses: docker/metadata-action@v5
288+
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
289289
with:
290290
images: |
291291
{{- range $image := $bv.GetImages "DHRepo" "CSRepo" }}
@@ -305,7 +305,7 @@
305305

306306
- name: push {{ $b }} image to prod
307307
if: {{`${{ matrix.golang_cross == '` }}{{$r.Branchvals.Buildenv}}{{`' }}`}} {{/* push only main build variation */}}
308-
uses: docker/build-push-action@v6
308+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
309309
with:
310310
context: {{ if has "ai-studio-frontend-build" $r.Branchvals.Features }}"."{{ else }}"dist"{{ end }}
311311
platforms: {{ $bv.GetDockerPlatforms | join "," }}
@@ -326,7 +326,7 @@
326326
{{ end }} {{/* range getDockerBuilds */}}
327327

328328
- name: save deb
329-
uses: actions/upload-artifact@v4
329+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
330330
if: {{`${{ matrix.golang_cross == '` }}{{.Branchvals.Buildenv}}{{`' }}`}}
331331
with:
332332
name: deb
@@ -337,7 +337,7 @@
337337
!dist/*fips*.deb
338338
339339
- name: save rpm
340-
uses: actions/upload-artifact@v4
340+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
341341
if: {{`${{ matrix.golang_cross == '` }}{{.Branchvals.Buildenv}}{{`' }}`}}
342342
with:
343343
name: rpm

0 commit comments

Comments
 (0)