Skip to content

Commit 279d777

Browse files
SEC: enable security scans with zizmor and fix existing lints (#5344)
1 parent 9f5e942 commit 279d777

File tree

6 files changed

+61
-32
lines changed

6 files changed

+61
-32
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ updates:
44
directory: /.github/workflows
55
schedule:
66
interval: monthly
7+
cooldown:
8+
default-days: 7
79
groups:
8-
actions:
9-
patterns:
10-
- '*'
10+
gha-patches:
11+
update-types:
12+
- patch
1113

1214
- package-ecosystem: uv
1315
directory: /

.github/workflows/bleeding-edge.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ on:
1818
- cron: 0 3 * * 3
1919
workflow_dispatch:
2020

21+
permissions: {}
22+
2123
jobs:
2224
build:
2325
runs-on: ubuntu-latest
@@ -31,10 +33,12 @@ jobs:
3133

3234
steps:
3335
- name: Checkout repo
34-
uses: actions/checkout@v6
36+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
37+
with:
38+
persist-credentials: false
3539

3640
- name: Set up Python (newest testable version)
37-
uses: astral-sh/setup-uv@v7
41+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
3842
with:
3943
# this version should be upgraded as often as possible, typically once a year when
4044
# Cython, numpy and matplotlib are known to be compatible
@@ -74,7 +78,7 @@ jobs:
7478

7579
steps:
7680
- name: Create issue on failure
77-
uses: imjohnbo/issue-bot@v3
81+
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd # v3.4.4
7882
with:
7983
title: 'TST: Upcoming dependency test failures'
8084
body: |

.github/workflows/build-test.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ defaults:
1111
run:
1212
shell: bash
1313

14+
permissions: {}
15+
1416
jobs:
1517
check-lock-file:
1618
# validate uv.lock against requirements
@@ -22,9 +24,11 @@ jobs:
2224
runs-on: ubuntu-latest
2325
steps:
2426
- name: Checkout repo
25-
uses: actions/checkout@v6
27+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
with:
29+
persist-credentials: false
2630
- name: Set up uv
27-
uses: astral-sh/setup-uv@v7
31+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2832
with:
2933
version: ">=0.9.11,<0.10.0" # pin uv to avoid the lock file format going out-of-sync
3034
python-version: 3.14
@@ -95,18 +99,21 @@ jobs:
9599
steps:
96100
- name: Checkout repo (bare)
97101
if: matrix.tests-type != 'answer'
98-
uses: actions/checkout@v6
102+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
103+
with:
104+
persist-credentials: false
99105
- name: Set up Python
100-
uses: astral-sh/setup-uv@v7
106+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
101107
with:
102108
python-version: ${{ matrix.python-version }}
103109
cache-suffix: ${{ matrix.cache-suffix }}
104110
prune-cache: false
105111
- name: Checkout repo (with submodules)
106112
if: matrix.tests-type == 'answer'
107-
uses: actions/checkout@v6
113+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
108114
with:
109115
submodules: true
116+
persist-credentials: false
110117
- name: Install dependencies and yt
111118
shell: bash
112119
env:
@@ -145,11 +152,12 @@ jobs:
145152

146153
steps:
147154
- name: Checkout repo (with submodules)
148-
uses: actions/checkout@v6
155+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
149156
with:
150157
submodules: true
158+
persist-credentials: false
151159
- name: Set up Python
152-
uses: astral-sh/setup-uv@v7
160+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
153161
with:
154162
python-version: '3.11'
155163
enable-cache: false
@@ -186,14 +194,14 @@ jobs:
186194
# (and especially) in case of failure.
187195
- name: Upload pytest-mpl report
188196
if: always()
189-
uses: actions/upload-artifact@v5
197+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
190198
with:
191199
name: yt_pytest_mpl_results
192200
path: pytest_mpl_results/*
193201

194202
- name: Upload pytest-mpl baseline
195203
if: always()
196-
uses: actions/upload-artifact@v5
204+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
197205
with:
198206
name: yt_pytest_mpl_new_baseline
199207
path: pytest_mpl_new_baseline/*

.github/workflows/type-checking.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- .github/workflows/type-checking.yaml
1212
workflow_dispatch:
1313

14+
permissions: {}
15+
1416
jobs:
1517
build:
1618
runs-on: ubuntu-latest
@@ -24,10 +26,12 @@ jobs:
2426

2527
steps:
2628
- name: Checkout repo
27-
uses: actions/checkout@v6
29+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
30+
with:
31+
persist-credentials: false
2832

2933
- name: Set up Python
30-
uses: astral-sh/setup-uv@v7
34+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
3135
with:
3236
# run with oldest supported python version
3337
# so that we always get compatible versions of

.github/workflows/wheels.yaml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ on:
1616
- setupext.py
1717
workflow_dispatch:
1818

19+
permissions: {}
1920

2021
jobs:
2122
build_wheels:
@@ -48,18 +49,20 @@ jobs:
4849

4950
steps:
5051
- name: Checkout repo
51-
uses: actions/checkout@v6
52+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
53+
with:
54+
persist-credentials: false
5255

5356
- name: Build wheels for CPython
54-
uses: pypa/[email protected]
57+
uses: pypa/cibuildwheel@63fd63b352a9a8bdcc24791c9dbee952ee9a8abc # v3.3.0
5558
with:
5659
extras: uv
5760
output-dir: dist
5861
env:
5962
CIBW_ARCHS: ${{ matrix.archs }}
6063
CIBW_BUILD: ${{ matrix.select }}
6164

62-
- uses: actions/upload-artifact@v5
65+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
6366
with:
6467
name: wheels-${{ matrix.os }}-${{ matrix.id }}
6568
path: ./dist/*.whl
@@ -69,10 +72,12 @@ jobs:
6972
runs-on: ubuntu-latest
7073
steps:
7174
- name: Checkout repo
72-
uses: actions/checkout@v6
75+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
76+
with:
77+
persist-credentials: false
7378

7479
- name: Set up Python
75-
uses: astral-sh/setup-uv@v7
80+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
7681
with:
7782
python-version: '3.10'
7883
enable-cache: false
@@ -81,7 +86,7 @@ jobs:
8186
run: uv build --sdist
8287

8388
- name: Upload sdist
84-
uses: actions/upload-artifact@v5
89+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
8590
with:
8691
name: sdist
8792
path: dist/*.tar.gz
@@ -93,7 +98,7 @@ jobs:
9398
cp conftest.py cfg
9499
95100
- name: Upload pytest configuration files
96-
uses: actions/upload-artifact@v5
101+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
97102
with:
98103
name: pytest-conf
99104
path: cfg
@@ -104,20 +109,20 @@ jobs:
104109
needs: [build_sdist]
105110
steps:
106111
- name: Download sdist
107-
uses: actions/download-artifact@v6
112+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
108113
with:
109114
name: sdist
110115
path: dist
111116

112117
- name: Set up Python
113-
uses: astral-sh/setup-uv@v7
118+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
114119
with:
115120
python-version: '3.10'
116121
enable-cache: false
117122
activate-environment: true # allows using uv pip directly
118123

119124
- name: Download pytest configuration files
120-
uses: actions/download-artifact@v6
125+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
121126
with:
122127
name: pytest-conf
123128
path: cfg
@@ -140,11 +145,12 @@ jobs:
140145
runs-on: ubuntu-latest
141146
steps:
142147
- name: Checkout repo
143-
uses: actions/checkout@v6
148+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
144149
with:
145150
submodules: true
151+
persist-credentials: false
146152
- name: Set up Python
147-
uses: astral-sh/setup-uv@v7
153+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
148154
with:
149155
python-version: '3.13'
150156
enable-cache: false
@@ -159,20 +165,20 @@ jobs:
159165
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/yt-')
160166
steps:
161167
- name: Download sdist
162-
uses: actions/download-artifact@v6
168+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
163169
with:
164170
name: sdist
165171
path: dist
166172

167173
- name: Download wheels
168-
uses: actions/download-artifact@v6
174+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
169175
with:
170176
path: dist
171177
pattern: wheels-*
172178
merge-multiple: true
173179

174180
- name: Publish to PyPI
175-
uses: pypa/[email protected]
181+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 # zizmor: ignore[use-trusted-publishing]
176182
with:
177183
user: __token__
178184
password: ${{ secrets.pypi_token }}

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ repos:
2727
- id: check-executables-have-shebangs
2828
- id: check-yaml
2929

30+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
31+
rev: v1.18.0
32+
hooks:
33+
- id: zizmor
34+
3035
# TODO: replace this with ruff when it supports embedded python blocks
3136
# see https://github.com/astral-sh/ruff/issues/8237
3237
- repo: https://github.com/adamchainz/blacken-docs

0 commit comments

Comments
 (0)