Skip to content

Commit 6ee5e71

Browse files
authored
ci: fix zizmor security findings (#2290)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> Relates to apache/iceberg#15742 Follow up to #2289 ## What changes are included in this PR? Fix github workflow based on zizmor recommendation for security best practice <!-- Provide a summary of the modifications in this PR. List the main changes such as new features, bug fixes, refactoring, or any other updates. --> ## Are these changes tested? <!-- Specify what test covers (unit test, integration test, etc.). If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> Yes ``` ➜ iceberg-rust git:(kevinjqliu/zizmor-fix) uvx --from zizmor zizmor --offline .github/ 🌈 zizmor v1.23.1 INFO audit: zizmor: 🌈 completed .github/actions/get-msrv/action.yml INFO audit: zizmor: 🌈 completed .github/actions/overwrite-package-version/action.yml INFO audit: zizmor: 🌈 completed .github/actions/setup-builder/action.yml INFO audit: zizmor: 🌈 completed .github/dependabot.yml INFO audit: zizmor: 🌈 completed .github/workflows/audit.yml INFO audit: zizmor: 🌈 completed .github/workflows/bindings_python_ci.yml INFO audit: zizmor: 🌈 completed .github/workflows/ci.yml INFO audit: zizmor: 🌈 completed .github/workflows/ci_typos.yml INFO audit: zizmor: 🌈 completed .github/workflows/codeql.yml INFO audit: zizmor: 🌈 completed .github/workflows/publish.yml INFO audit: zizmor: 🌈 completed .github/workflows/release_python.yml INFO audit: zizmor: 🌈 completed .github/workflows/release_python_nightly.yml INFO audit: zizmor: 🌈 completed .github/workflows/stale.yml INFO audit: zizmor: 🌈 completed .github/workflows/website.yml No findings to report. Good job! (1 ignored, 37 suppressed) ```
1 parent 3212c31 commit 6ee5e71

File tree

12 files changed

+160
-79
lines changed

12 files changed

+160
-79
lines changed

.github/actions/overwrite-package-version/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runs:
2525
using: "composite"
2626
steps:
2727
- name: Setup Python
28-
uses: actions/setup-python@v5
28+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
2929
with:
3030
python-version: '3.12'
3131

.github/workflows/audit.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ jobs:
4444
runs-on: ubuntu-latest
4545
if: github.repository == 'apache/iceberg-rust'
4646
steps:
47-
- uses: actions/checkout@v6
47+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
48+
with:
49+
persist-credentials: false
4850
- name: Setup Rust toolchain
4951
uses: ./.github/actions/setup-builder
5052
with:
5153
rust-version: stable
52-
- uses: rustsec/audit-check@v2.0.0
54+
- uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
5355
with:
5456
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/bindings_python_ci.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ jobs:
4747
check-rust:
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v6
50+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
51+
with:
52+
persist-credentials: false
5153
- name: Check format
5254
working-directory: "bindings/python"
5355
run: cargo fmt --all -- --check
@@ -58,8 +60,10 @@ jobs:
5860
check-python:
5961
runs-on: ubuntu-slim
6062
steps:
61-
- uses: actions/checkout@v6
62-
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098
63+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
64+
with:
65+
persist-credentials: false
66+
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
6367
with:
6468
version: "0.9.3"
6569
enable-cache: true
@@ -85,16 +89,18 @@ jobs:
8589
- macos-latest
8690
- windows-latest
8791
steps:
88-
- uses: actions/checkout@v6
89-
- uses: actions/setup-python@v6
92+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
93+
with:
94+
persist-credentials: false
95+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
9096
with:
9197
python-version: 3.12
92-
- uses: PyO3/maturin-action@v1
98+
- uses: PyO3/maturin-action@04ac600d27cdf7a9a280dadf7147097c42b757ad # v1
9399
with:
94100
working-directory: "bindings/python"
95101
command: build
96102
args: --out dist -i python3.12 # Explicitly set interpreter; manylinux containers have multiple Pythons and maturin may pick an older one
97-
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098
103+
- uses: astral-sh/setup-uv@5a095e7a2014a4212f075830d4f7277575a9d098 # v7.3.1
98104
with:
99105
version: "0.9.3"
100106
enable-cache: true

.github/workflows/ci.yml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,21 @@ jobs:
5353
- ubuntu-latest
5454
- macos-latest
5555
steps:
56-
- uses: actions/checkout@v6
56+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
57+
with:
58+
persist-credentials: false
5759

5860
- name: Setup Rust toolchain
5961
uses: ./.github/actions/setup-builder
6062

6163
- name: Check License Header
62-
uses: apache/skywalking-eyes/header@v0.8.0
64+
uses: apache/skywalking-eyes/header@61275cc80d0798a405cb070f7d3a8aaf7cf2c2c1 # v0.8.0
6365

6466
- name: Check toml format
6567
run: make check-toml
6668

6769
- name: Install protoc
68-
uses: arduino/setup-protoc@v3
70+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
6971
with:
7072
repo-token: ${{ secrets.GITHUB_TOKEN }}
7173

@@ -91,16 +93,18 @@ jobs:
9193
- macos-latest
9294
- windows-latest
9395
steps:
94-
- uses: actions/checkout@v6
96+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
97+
with:
98+
persist-credentials: false
9599

96100
- name: Setup Rust toolchain
97101
uses: ./.github/actions/setup-builder
98102

99103
- name: Cache Rust artifacts
100-
uses: swatinem/rust-cache@v2
104+
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
101105

102106
- name: Install protoc
103-
uses: arduino/setup-protoc@v3
107+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
104108
with:
105109
repo-token: ${{ secrets.GITHUB_TOKEN }}
106110

@@ -117,13 +121,15 @@ jobs:
117121
- macos-latest
118122
- windows-latest
119123
steps:
120-
- uses: actions/checkout@v6
124+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
125+
with:
126+
persist-credentials: false
121127

122128
- name: Setup Rust toolchain
123129
uses: ./.github/actions/setup-builder
124130

125131
- name: Cache Rust artifacts
126-
uses: swatinem/rust-cache@v2
132+
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
127133

128134
- name: Build
129135
run: cargo build -p iceberg --no-default-features
@@ -138,24 +144,26 @@ jobs:
138144
- { name: "doc", args: "--doc --all-features --workspace" }
139145
name: Tests (${{ matrix.test-suite.name }})
140146
steps:
141-
- uses: actions/checkout@v6
147+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
148+
with:
149+
persist-credentials: false
142150

143151
- name: Setup Rust toolchain
144152
uses: ./.github/actions/setup-builder
145153

146154
- name: Install protoc
147-
uses: arduino/setup-protoc@v3
155+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
148156
with:
149157
repo-token: ${{ secrets.GITHUB_TOKEN }}
150158

151159
- name: Cache Rust artifacts
152-
uses: swatinem/rust-cache@v2
160+
uses: swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
153161
with:
154162
key: ${{ matrix.test-suite.name }}
155163

156164
- name: Install cargo-nextest
157165
if: matrix.test-suite.name == 'default'
158-
uses: taiki-e/install-action@v2
166+
uses: taiki-e/install-action@0fde6d128a3d980ceac30be8c8b8739abd963b81 # v2.70.0
159167
with:
160168
tool: cargo-nextest
161169

@@ -182,9 +190,11 @@ jobs:
182190
name: Verify MSRV
183191
runs-on: ubuntu-latest
184192
steps:
185-
- uses: actions/checkout@v6
193+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
194+
with:
195+
persist-credentials: false
186196
- name: Install protoc
187-
uses: arduino/setup-protoc@v3
197+
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
188198
with:
189199
repo-token: ${{ secrets.GITHUB_TOKEN }}
190200
- name: Get MSRV

.github/workflows/ci_typos.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
env:
4444
FORCE_COLOR: 1
4545
steps:
46-
- uses: actions/checkout@v6
46+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
47+
with:
48+
persist-credentials: false
4749
- name: Check typos
48-
uses: crate-ci/typos@v1.44.0
50+
uses: crate-ci/typos@631208b7aac2daa8b707f55e7331f9112b0e062d # v1.44.0

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ jobs:
4646
persist-credentials: false
4747

4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@d4b3ca9fa7f69d38bfcd667bdc45bc373d16277e # v4
49+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4
5050
with:
5151
languages: actions
5252

5353
- name: Perform CodeQL Analysis
54-
uses: github/codeql-action/analyze@d4b3ca9fa7f69d38bfcd667bdc45bc373d16277e # v4
54+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4
5555
with:
5656
category: "/language:actions"

.github/workflows/publish.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ permissions:
3232
jobs:
3333
publish:
3434
runs-on: ubuntu-latest
35+
environment: publish
3536
strategy:
3637
max-parallel: 1 # Publish package one by one instead of flooding the registry
3738
matrix:
@@ -46,7 +47,9 @@ jobs:
4647
- "crates/catalog/sql"
4748
- "crates/integrations/datafusion"
4849
steps:
49-
- uses: actions/checkout@v6
50+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
51+
with:
52+
persist-credentials: false
5053

5154
- name: Get MSRV
5255
id: get-msrv
@@ -61,6 +64,18 @@ jobs:
6164
working-directory: ${{ matrix.package }}
6265
# Only publish if it's a tag and the tag is not a pre-release
6366
if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
64-
run: cargo publish --all-features
67+
run: cargo publish --all-features # zizmor: ignore[use-trusted-publishing] -- https://github.com/apache/iceberg-rust/issues/1539
6568
env:
6669
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
70+
71+
# Trigger Python release after crate publishing completes.
72+
# Only runs for tag pushes; for manual Python releases, use workflow_dispatch on release_python.yml directly.
73+
release-python:
74+
needs: [publish]
75+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
76+
permissions:
77+
contents: read
78+
id-token: write # Required for PyPI trusted publishing in the called workflow
79+
uses: ./.github/workflows/release_python.yml
80+
with:
81+
release_tag: ${{ github.ref_name }}

0 commit comments

Comments
 (0)