Skip to content

Commit b5a7c4a

Browse files
authored
chore(actions): address zizmor findings (#13615)
This PR is an auto-generated attempt to address zizmor findings. It may not catch everything, and should be reviewed by repository owners. These changes were generated by running `zizmor --fix=all --gh-token=$(gh auth token) ./.github/workflows`, and then applying some fixes for any remaining issues reported by zizmor. See go/github-zizmor-help for instructions to install and run. Additionally, it updates renovate configuration (if present) to extend [best-practices](https://docs.renovatebot.com/presets-config/#configbest-practices), which includes pinning action digests and image digests, among other things. If this PR is unhelpful, feel free to close the PR and address separately. If it is helpful, feel free to approve and merge, or edit/modify as needed to get it to the right state. Repository owners must ultimately ensure compliance by 2026-07-13. The purpose of this PR is to provide some assistance with achieving that as a first pass. This will become a blocking check for new changes to github workflows on 2026-07-13 within the `googleapis` org. There may be some ignored findings (with the comment `# zizmor: ignore[...]`), which you may fix if feasible.
1 parent 8a72860 commit b5a7c4a

47 files changed

Lines changed: 809 additions & 351 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/changelog_generation.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
pull_request:
36
types:
@@ -23,9 +26,10 @@ jobs:
2326
github.event.sender.login == 'release-please[bot]' && github.head_ref == 'release-please--branches--main' &&
2427
contains(github.event.pull_request.labels.*.name, 'autorelease: pending')
2528
steps:
26-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
2730
with:
2831
ref: ${{ github.head_ref }}
32+
persist-credentials: false
2933
- name: Show status of the branch checked out
3034
run: |
3135
git status

.github/workflows/changelog_generation_test.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
name: CHANGELOG.md generation test
25

36
on:
@@ -11,7 +14,9 @@ jobs:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- name: Checkout code
14-
uses: actions/checkout@v3
17+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
18+
with:
19+
persist-credentials: false
1520
- name: Unit Test
1621
run: |
1722
python3 .github/release-note-generation/unit_test.py

.github/workflows/ci.yaml

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414
# Github action job to test core java library features on
1515
# downstream client libraries before they are released.
16+
permissions:
17+
contents: read
18+
1619
on:
1720
push:
1821
branches:
@@ -32,7 +35,9 @@ jobs:
3235
# runnable is true if there are changes outside the .github/workflows directory OR if ci.yaml itself (or kokoro scripts) is modified.
3336
runnable: ${{ fromJSON(steps.filter.outputs.all_count) > fromJSON(steps.filter.outputs.workflows_count) || fromJSON(steps.filter.outputs.ci_count) > 0 }}
3437
steps:
35-
- uses: actions/checkout@v6
38+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
39+
with:
40+
persist-credentials: false
3641
# Use this action, rather than a file filter so that we can make this
3742
# mandatory.
3843
# See https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#example-including-branches
@@ -65,16 +70,18 @@ jobs:
6570
id: date
6671
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
6772
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
68-
- uses: actions/checkout@v4
73+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
6974
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
70-
- uses: actions/setup-java@v4
75+
with:
76+
persist-credentials: false
77+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
7178
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7279
with:
7380
distribution: temurin
7481
java-version: ${{matrix.java}}
7582
- run: java -version
7683
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
77-
- uses: actions/cache@v4
84+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
7885
id: mvn-cache
7986
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
8087
with:
@@ -94,9 +101,11 @@ jobs:
94101
id: date
95102
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
96103
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
97-
- uses: actions/checkout@v4
104+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
98105
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
99-
- uses: actions/setup-java@v4
106+
with:
107+
persist-credentials: false
108+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
100109
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
101110
with:
102111
java-version: 8
@@ -107,13 +116,13 @@ jobs:
107116
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
108117
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
109118
shell: bash
110-
- uses: actions/setup-java@v4
119+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
111120
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
112121
with:
113122
java-version: 11
114123
distribution: temurin
115124
cache: maven
116-
- uses: actions/cache@v4
125+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
117126
id: mvn-cache
118127
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
119128
with:
@@ -135,7 +144,9 @@ jobs:
135144
outputs:
136145
packages: ${{ steps.filter.outputs.changes }}
137146
steps:
138-
- uses: actions/checkout@v6
147+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
148+
with:
149+
persist-credentials: false
139150
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
140151
id: filter
141152
with:
@@ -263,8 +274,10 @@ jobs:
263274
- name: Get current week within the year
264275
id: date
265276
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
266-
- uses: actions/checkout@v4
267-
- uses: actions/setup-java@v4
277+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
278+
with:
279+
persist-credentials: false
280+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
268281
with:
269282
distribution: temurin
270283
java-version: ${{matrix.java}}
@@ -286,14 +299,16 @@ jobs:
286299
- name: Get current week within the year
287300
id: date
288301
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
289-
- uses: actions/checkout@v4
290-
- uses: actions/setup-java@v4
302+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
303+
with:
304+
persist-credentials: false
305+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
291306
with:
292307
java-version: 11
293308
distribution: temurin
294309
cache: maven
295310
- run: java -version
296-
- uses: actions/cache@v4
311+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
297312
id: mvn-cache
298313
with:
299314
path: ~/.m2/repository
@@ -304,7 +319,7 @@ jobs:
304319
env:
305320
BUILD_SUBDIR: ${{matrix.package}}
306321
JOB_TYPE: install
307-
- uses: actions/setup-java@v4
322+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
308323
with:
309324
java-version: ${{matrix.java}}
310325
distribution: temurin
@@ -331,8 +346,10 @@ jobs:
331346
matrix:
332347
package: ${{ fromJSON(needs.changes.outputs.packages) }}
333348
steps:
334-
- uses: actions/checkout@v4
335-
- uses: actions/setup-java@v4
349+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
350+
with:
351+
persist-credentials: false
352+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
336353
with:
337354
distribution: temurin
338355
java-version: 11
@@ -348,8 +365,10 @@ jobs:
348365
matrix:
349366
package: ${{ fromJSON(needs.changes.outputs.packages) }}
350367
steps:
351-
- uses: actions/checkout@v4
352-
- uses: actions/setup-java@v4
368+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
369+
with:
370+
persist-credentials: false
371+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
353372
with:
354373
distribution: temurin
355374
java-version: 17
@@ -374,8 +393,10 @@ jobs:
374393
steps:
375394
- name: Support longpaths
376395
run: git config --system core.longpaths true
377-
- uses: actions/checkout@v4
378-
- uses: actions/setup-java@v4
396+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
397+
with:
398+
persist-credentials: false
399+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
379400
with:
380401
distribution: temurin
381402
java-version: 11
@@ -390,10 +411,11 @@ jobs:
390411
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
391412
runs-on: ubuntu-latest
392413
steps:
393-
- uses: actions/checkout@v4
414+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
394415
with:
395416
fetch-depth: 0
396-
- uses: actions/setup-java@v4
417+
persist-credentials: false
418+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
397419
with:
398420
distribution: temurin
399421
java-version: 17
@@ -411,8 +433,10 @@ jobs:
411433
- name: Get current week within the year
412434
id: date
413435
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
414-
- uses: actions/checkout@v4
415-
- uses: actions/setup-java@v4
436+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
437+
with:
438+
persist-credentials: false
439+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
416440
with:
417441
distribution: temurin
418442
java-version: 11
@@ -429,8 +453,10 @@ jobs:
429453
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
430454
runs-on: ubuntu-latest
431455
steps:
432-
- uses: actions/checkout@v4
433-
- uses: actions/setup-java@v4
456+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
457+
with:
458+
persist-credentials: false
459+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
434460
with:
435461
java-version: 11
436462
distribution: temurin
@@ -440,7 +466,7 @@ jobs:
440466
env:
441467
JOB_TYPE: install
442468
- name: Validate gapic-libraries-bom
443-
uses: googleapis/java-cloud-bom/tests/validate-bom@v26.79.0
469+
uses: googleapis/java-cloud-bom/tests/validate-bom@377c8d1fac6b1521dc52a10f4d02e5d371a0de67 # v26.79.0
444470
with:
445471
bom-path: gapic-libraries-bom/pom.xml
446472

.github/workflows/create_additional_release_tag.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
name: Create additional tags for each release
25

36
on:
@@ -13,9 +16,10 @@ jobs:
1316
contents: write
1417
steps:
1518
- name: Checkout code
16-
uses: actions/checkout@v4
19+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
1720
with:
1821
token: ${{ secrets.CLOUD_JAVA_BOT_GITHUB_TOKEN }}
22+
persist-credentials: false
1923
- name: Set up Git
2024
run: |
2125
git config --local user.email "action@github.com"

.github/workflows/google-auth-library-java-ci.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# limitations under the License.
1414
# GitHub action job to test core java library features on
1515
# downstream client libraries before they are released.
16+
permissions:
17+
contents: read
18+
1619
on:
1720
push:
1821
branches:
@@ -27,7 +30,9 @@ jobs:
2730
outputs:
2831
library: ${{ steps.filter.outputs.library }}
2932
steps:
30-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
34+
with:
35+
persist-credentials: false
3136
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
3237
id: filter
3338
with:
@@ -44,8 +49,10 @@ jobs:
4449
matrix:
4550
java: [11, 17, 21, 25, 26]
4651
steps:
47-
- uses: actions/checkout@v4
48-
- uses: actions/setup-java@v4
52+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
53+
with:
54+
persist-credentials: false
55+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
4956
with:
5057
distribution: temurin
5158
java-version: ${{matrix.java}}
@@ -60,8 +67,10 @@ jobs:
6067
if: ${{ needs.filter.outputs.library == 'true' }}
6168
runs-on: ubuntu-latest
6269
steps:
63-
- uses: actions/checkout@v3
64-
- uses: actions/setup-java@v3
70+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
71+
with:
72+
persist-credentials: false
73+
- uses: actions/setup-java@17f84c3641ba7b8f6deff6309fc4c864478f5d62 # v3
6574
with:
6675
distribution: temurin
6776
java-version: 11
@@ -75,8 +84,10 @@ jobs:
7584
if: ${{ needs.filter.outputs.library == 'true' }}
7685
runs-on: ubuntu-latest
7786
steps:
78-
- uses: actions/checkout@v4
79-
- uses: actions/setup-java@v4
87+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
88+
with:
89+
persist-credentials: false
90+
- uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
8091
with:
8192
distribution: temurin
8293
java-version: 17
@@ -92,4 +103,4 @@ jobs:
92103
if: ${{ contains(needs.*.result, 'failure') }}
93104
run: exit 1
94105
- name: Success otherwise
95-
run: echo "Success!"
106+
run: echo "Success!"

0 commit comments

Comments
 (0)