Skip to content

Commit 5e5f323

Browse files
vdemeestertekton-robot
authored andcommitted
ci: fix GitHub Actions security issues found by zizmor
- Add persist-credentials: false to all actions/checkout steps - Fix template injection by using env vars instead of ${{ }} in run blocks - Convert ${{ env.* }} to shell env vars in run blocks - Add cooldown configuration to dependabot Fixes auto-fixable findings from zizmor v1.23.1 static analysis. Remaining findings (secrets-outside-env, excessive-permissions, secrets-inherit) require manual review and are tracked separately. Related: #3300 Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
1 parent 65eda6c commit 5e5f323

File tree

9 files changed

+44
-11
lines changed

9 files changed

+44
-11
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ updates:
1010
- "github_action"
1111
- "kind/misc"
1212
- "release-note-none"
13+
cooldown:
14+
default-days: 7
1315
- package-ecosystem: "gomod" # See documentation for possible values
1416
directory: "/" # Location of package manifests
1517
schedule:
@@ -23,3 +25,5 @@ updates:
2325
- dependency-name: "k8s.io/*"
2426
update-types: ["version-update:semver-major", "version-update:semver-minor"]
2527
- dependency-name: "github.com/openshift/client-go"
28+
cooldown:
29+
default-days: 7

.github/workflows/bump-payload-on-main.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
if: github.repository_owner == 'tektoncd' # do not run this elsewhere
1414
steps:
1515
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
with:
17+
persist-credentials: false
1618
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
1719
with:
1820
go-version-file: "go.mod"

.github/workflows/bump-payload-on-releases.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3030
with:
3131
ref: ${{ matrix.branch }}
32+
persist-credentials: false
3233
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
3334
with:
3435
go-version-file: "go.mod"
@@ -57,13 +58,15 @@ jobs:
5758
else
5859
echo "commit_message=chore: bump payload versions" >> $GITHUB_OUTPUT
5960
echo "pr_title=chore: bump payload versions" >> $GITHUB_OUTPUT
60-
echo "pr_body=Automated component version bump for ${{ matrix.branch }}" >> $GITHUB_OUTPUT
61+
echo "pr_body=Automated component version bump for ${MATRIX_BRANCH}" >> $GITHUB_OUTPUT
6162
fi
6263
else
6364
echo "commit_message=chore: bump payload versions" >> $GITHUB_OUTPUT
6465
echo "pr_title=chore: bump payload versions" >> $GITHUB_OUTPUT
65-
echo "pr_body=Automated component version bump for ${{ matrix.branch }}" >> $GITHUB_OUTPUT
66+
echo "pr_body=Automated component version bump for ${MATRIX_BRANCH}" >> $GITHUB_OUTPUT
6667
fi
68+
env:
69+
MATRIX_BRANCH: ${{ matrix.branch }}
6770
- name: clean up temporary files
6871
run: |
6972
rm -f bump-output.txt commit-message.txt pr-body.txt

.github/workflows/ci.yaml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ jobs:
3333
with:
3434
ref: ${{ github.event.pull_request.head.sha }}
3535
fetch-depth: ${{ steps.base-depth.outputs.base-depth }}
36+
persist-credentials: false
3637
- name: detect
3738
id: detect
3839
run: |
39-
git fetch origin ${{ github.base_ref }}
40+
git fetch origin ${GITHUB_BASE_REF}
4041
4142
# Store git diff command for reuse
4243
GIT_DIFF_CMD="git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}"
@@ -71,6 +72,8 @@ jobs:
7172
if: ${{ needs.changes.outputs.non-docs == 'true' }}
7273
steps:
7374
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
with:
76+
persist-credentials: false
7477
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
7578
with:
7679
go-version-file: "go.mod"
@@ -85,6 +88,7 @@ jobs:
8588
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8689
with:
8790
fetch-depth: 0
91+
persist-credentials: false
8892
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
8993
with:
9094
go-version-file: "go.mod"
@@ -118,6 +122,8 @@ jobs:
118122
runs-on: ubuntu-latest
119123
steps:
120124
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
125+
with:
126+
persist-credentials: false
121127
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
122128
with:
123129
go-version-file: "go.mod"
@@ -130,6 +136,8 @@ jobs:
130136
runs-on: ubuntu-latest
131137
steps:
132138
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
139+
with:
140+
persist-credentials: false
133141
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
134142
with:
135143
go-version-file: "go.mod"
@@ -142,6 +150,8 @@ jobs:
142150
runs-on: ubuntu-latest
143151
steps:
144152
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
153+
with:
154+
persist-credentials: false
145155
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
146156
with:
147157
go-version-file: "go.mod"
@@ -171,12 +181,12 @@ jobs:
171181
- name: Check CI results
172182
run: |
173183
results=(
174-
"build=${{ needs.build.result }}"
175-
"linting=${{ needs.linting.result }}"
176-
"tests=${{ needs.tests.result }}"
177-
"generated=${{ needs.generated.result }}"
178-
"multi-arch-build=${{ needs.multi-arch-build.result }}"
179-
"e2e-tests=${{ needs.e2e-tests.result }}"
184+
"build=${NEEDS_BUILD_RESULT}"
185+
"linting=${NEEDS_LINTING_RESULT}"
186+
"tests=${NEEDS_TESTS_RESULT}"
187+
"generated=${NEEDS_GENERATED_RESULT}"
188+
"multi-arch-build=${NEEDS_MULTI_ARCH_BUILD_RESULT}"
189+
"e2e-tests=${NEEDS_E2E_TESTS_RESULT}"
180190
)
181191
failed=0
182192
for r in "${results[@]}"; do
@@ -192,3 +202,10 @@ jobs:
192202
echo "Some CI jobs failed or were cancelled"
193203
exit 1
194204
fi
205+
env:
206+
NEEDS_BUILD_RESULT: ${{ needs.build.result }}
207+
NEEDS_LINTING_RESULT: ${{ needs.linting.result }}
208+
NEEDS_TESTS_RESULT: ${{ needs.tests.result }}
209+
NEEDS_GENERATED_RESULT: ${{ needs.generated.result }}
210+
NEEDS_MULTI_ARCH_BUILD_RESULT: ${{ needs.multi-arch-build.result }}
211+
NEEDS_E2E_TESTS_RESULT: ${{ needs.e2e-tests.result }}

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
steps:
4242
- name: Checkout repository
4343
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
with:
45+
persist-credentials: false
4446

4547
# Initializes the CodeQL tools for scanning.
4648
- name: Initialize CodeQL

.github/workflows/e2e-matrix.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ jobs:
3434

3535
steps:
3636
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37+
with:
38+
persist-credentials: false
3739
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
3840
with:
3941
go-version-file: "go.mod"
@@ -76,8 +78,8 @@ jobs:
7678
- name: Dump Artifacts
7779
if: ${{ failure() }}
7880
run: |
79-
if [[ -d ${{ env.ARTIFACTS }} ]]; then
80-
cd ${{ env.ARTIFACTS }}
81+
if [[ -d ${ARTIFACTS} ]]; then
82+
cd ${ARTIFACTS}
8183
for x in $(find . -type f); do
8284
echo "::group:: artifact $x"
8385
cat $x

.github/workflows/go-coverage.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4141
with:
4242
path: ${{ github.workspace }}/src/github.com/tektoncd/operator
43+
persist-credentials: false
4344

4445
- name: Set up Go
4546
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0

.github/workflows/helm-release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1616
with:
1717
fetch-depth: 0
18+
persist-credentials: false
1819

1920
- name: Configure Git
2021
run: |

.github/workflows/update-tektoncd-task-versions.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1818
with:
1919
fetch-depth: 0
20+
persist-credentials: false
2021

2122
- name: Clone TektonCD Catalog (p branch)
2223
run: |

0 commit comments

Comments
 (0)