Skip to content

Commit 9e25551

Browse files
SEC: fix insecure GitHub Actions settings and enable automated audits with zizmor + pre-commit (#373)
* SEC: switch GHA refs to immutable hashes with pinact * SEC: disable default gha permissions * SEC: avoid leaking credentials * SEC: enable security audits with zizmor + pre-commit
1 parent 4a8b8a2 commit 9e25551

4 files changed

Lines changed: 43 additions & 17 deletions

File tree

.github/workflows/idefix-ci-doc.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ on:
99
paths-ignore:
1010
- '.github/ISSUE_TEMPLATE/*'
1111

12+
permissions: {}
1213

1314
jobs:
1415
ReadTheDocs:
1516
runs-on: ubuntu-latest
1617
steps:
1718
- name: Check out repo
18-
uses: actions/checkout@v3
19+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
20+
with:
21+
persist-credentials: false
1922
- name: install doxygen
2023
run: sudo apt-get install -y doxygen
2124
- name: install python dependencies

.github/workflows/idefix-ci-jobs.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ env:
2121
PYTHONPATH: ${{ github.workspace }}
2222
IDEFIX_DIR: ${{ github.workspace }}
2323

24+
permissions: {}
25+
2426
jobs:
2527
ShocksHydro:
2628
runs-on: self-hosted
2729
steps:
2830
- name: Check out repo
29-
uses: actions/checkout@v3
31+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
3032
with:
3133
submodules: recursive
34+
persist-credentials: false
3235
- name: Sod test
3336
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/sod -all $TESTME_OPTIONS
3437
- name: Isothermal Sod test
@@ -40,9 +43,10 @@ jobs:
4043
runs-on: self-hosted
4144
steps:
4245
- name: Check out repo
43-
uses: actions/checkout@v3
46+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
4447
with:
4548
submodules: recursive
49+
persist-credentials: false
4650
- name: Viscous flow past cylinder
4751
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ViscousFlowPastCylinder -all $TESTME_OPTIONS
4852
- name: Viscous disk
@@ -54,9 +58,10 @@ jobs:
5458
runs-on: self-hosted
5559
steps:
5660
- name: Check out repo
57-
uses: actions/checkout@v3
61+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
5862
with:
5963
submodules: recursive
64+
persist-credentials: false
6065
- name: MHD Sod test
6166
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/sod -all $TESTME_OPTIONS
6267
- name: MHD Isothermal Sod test
@@ -72,9 +77,10 @@ jobs:
7277
runs-on: self-hosted
7378
steps:
7479
- name: Check out repo
75-
uses: actions/checkout@v3
80+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
7681
with:
7782
submodules: recursive
83+
persist-credentials: false
7884
- name: Ambipolar C Shock
7985
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/AmbipolarCshock -all $TESTME_OPTIONS
8086
- name: Ambipolar C Shock 3D
@@ -91,9 +97,10 @@ jobs:
9197
runs-on: self-hosted
9298
steps:
9399
- name: Check out repo
94-
uses: actions/checkout@v3
100+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
95101
with:
96102
submodules: recursive
103+
persist-credentials: false
97104
- name: Fargo + planet
98105
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/FargoPlanet -all $TESTME_OPTIONS
99106
- name: Fargo MHD spherical
@@ -104,9 +111,10 @@ jobs:
104111
runs-on: self-hosted
105112
steps:
106113
- name: Check out repo
107-
uses: actions/checkout@v3
114+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
108115
with:
109116
submodules: recursive
117+
persist-credentials: false
110118
- name: Hydro shearing box
111119
run: scripts/ci/run-tests $IDEFIX_DIR/test/HD/ShearingBox -all $TESTME_OPTIONS
112120
- name: MHD shearing box
@@ -117,9 +125,10 @@ jobs:
117125
runs-on: self-hosted
118126
steps:
119127
- name: Check out repo
120-
uses: actions/checkout@v3
128+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
121129
with:
122130
submodules: recursive
131+
persist-credentials: false
123132
- name: Jeans Instability
124133
run: scripts/ci/run-tests $IDEFIX_DIR/test/SelfGravity/JeansInstability -all $TESTME_OPTIONS
125134
- name: Random sphere spherical
@@ -136,9 +145,10 @@ jobs:
136145
runs-on: self-hosted
137146
steps:
138147
- name: Check out repo
139-
uses: actions/checkout@v3
148+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
140149
with:
141150
submodules: recursive
151+
persist-credentials: false
142152
- name: 3 body
143153
run: scripts/ci/run-tests $IDEFIX_DIR/test/Planet/Planet3Body -all $TESTME_OPTIONS
144154
- name: migration
@@ -157,9 +167,10 @@ jobs:
157167
runs-on: self-hosted
158168
steps:
159169
- name: Check out repo
160-
uses: actions/checkout@v3
170+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
161171
with:
162172
submodules: recursive
173+
persist-credentials: false
163174
- name: Energy conservation
164175
run: scripts/ci/run-tests $IDEFIX_DIR/test/Dust/DustEnergy -all $TESTME_OPTIONS
165176
- name: Dusty wave
@@ -170,9 +181,10 @@ jobs:
170181
runs-on: self-hosted
171182
steps:
172183
- name: Check out repo
173-
uses: actions/checkout@v3
184+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
174185
with:
175186
submodules: recursive
187+
persist-credentials: false
176188
- name: MTI
177189
run: scripts/ci/run-tests $IDEFIX_DIR/test/MHD/MTI -all $TESTME_OPTIONS
178190
- name: Spherical anisotropic diffusion
@@ -187,9 +199,10 @@ jobs:
187199
runs-on: self-hosted
188200
steps:
189201
- name: Check out repo
190-
uses: actions/checkout@v3
202+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
191203
with:
192204
submodules: recursive
205+
persist-credentials: false
193206
- name: Run examples test
194207
run: cd test && ./checks_examples.sh $TEST_OPTIONS
195208

@@ -198,9 +211,10 @@ jobs:
198211
runs-on: self-hosted
199212
steps:
200213
- name: Check out repo
201-
uses: actions/checkout@v3
214+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
202215
with:
203216
submodules: recursive
217+
persist-credentials: false
204218
- name: Lookup table
205219
run: scripts/ci/run-tests $IDEFIX_DIR/test/utils/lookupTable -all $TESTME_OPTIONS
206220
- name: Dump Image

.github/workflows/idefix-ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ on:
99
paths-ignore:
1010
- '.github/ISSUE_TEMPLATE/*'
1111

12+
permissions: {}
13+
1214
jobs:
1315
Linter:
1416
# Don't do this in forks
1517
if: ${{ github.repository == 'idefix-code/idefix' || github.repository == 'glesur/idefix' }}
1618
runs-on: ubuntu-latest
1719
steps:
18-
- uses: actions/checkout@v3
19-
- uses: actions/setup-python@v4
20+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
21+
with:
22+
persist-credentials: false
23+
- uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4.9.1
2024
with:
2125
python-version: 3.x
22-
- uses: pre-commit/action@v3.0.0
23-
- uses: pre-commit-ci/lite-action@v1.0.0
26+
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
27+
- uses: pre-commit-ci/lite-action@50143aaf27e2c42e75a5e06185a471d9582e89df # v1.0.0
2428
if: always()
2529

2630
icc-jobs:

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ repos:
1515
- id: check-added-large-files
1616
args: ['--maxkb=100'] ## prevent files larger than 100kB from being commited (exclude git lfs files)
1717

18+
- repo: https://github.com/zizmorcore/zizmor-pre-commit
19+
rev: v1.23.1
20+
hooks:
21+
- id: zizmor
22+
1823
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
1924
rev: v1.1.2
2025
hooks:

0 commit comments

Comments
 (0)