Skip to content

Commit f96e7c4

Browse files
germa89pyansys-ci-botCopilot
authored
fix: security zizmor issues (#4357)
* ci: add zizmor and bandit pre-commit hooks with configurations * ci: update pre-commit hook revisions for various repositories * chore: adding changelog file 4345.maintenance.md [dependabot-skip] * ci: add concurrency settings to various workflows for improved job management * ci: update pre-commit hooks configuration to exclude tests directory from bandit checks * Update .pre-commit-config.yaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * ci: remove concurrency settings from local and remote testing workflows * ci: add concurrency limits ignore comments to local and remote testing workflows * fix: remove zizmor and bandit pre-commit hooks for security issues * chore: adding changelog file 4357.fixed.md [dependabot-skip] --------- Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3e5f655 commit f96e7c4

16 files changed

+116
-90
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ updates:
2222

2323
- directory: "/" # Location of package manifests
2424
package-ecosystem: "pip" # See documentation for possible values
25-
insecure-external-code-execution: allow
2625
schedule:
2726
interval: "weekly"
2827
day: "friday"

.github/workflows/approver.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ on:
2424

2525
permissions: {}
2626

27+
concurrency:
28+
group: ${{ github.workflow }}-${{ github.ref }}
29+
cancel-in-progress: true
30+
2731
jobs:
2832
autoapprove:
2933
# This job only runs for pull request comments
@@ -33,7 +37,7 @@ jobs:
3337
github.event.comment.user.login == 'germa89'
3438
)) || ( github.event_name == 'workflow_dispatch' )
3539
permissions:
36-
pull-requests: write
40+
pull-requests: write # Needed to approve pull requests
3741
runs-on: ubuntu-latest
3842
steps:
3943

.github/workflows/cache_cleaner.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ on:
77

88
permissions: {}
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
cleanup:
1216
name: Cleanup caches
1317
runs-on: ubuntu-latest
1418
permissions:
15-
actions: write
19+
actions: write # Needed to delete cache entries
1620
steps:
1721
- name: Check out code
1822
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0

.github/workflows/ci.yml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
name: Adding assignee if there is none.
4343
runs-on: ubuntu-latest
4444
permissions:
45-
pull-requests: write
45+
pull-requests: write # Needed to add assignees to pull requests
4646
steps:
4747
- uses: actions-ecosystem/action-add-assignees@a5b84af721c4a621eb9c7a4a95ec20a90d0b88e9 #v1.0.1
4848
if: |
@@ -61,10 +61,10 @@ jobs:
6161
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
6262
runs-on: ubuntu-latest
6363
permissions:
64-
contents: write
65-
pull-requests: write
64+
contents: write # Needed to update changelog files
65+
pull-requests: write # Needed to create pull requests with changelog updates
6666
steps:
67-
- uses: ansys/actions/doc-deploy-changelog@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
67+
- uses: ansys/actions/doc-deploy-changelog@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
6868
with:
6969
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
7070
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
@@ -76,10 +76,10 @@ jobs:
7676
name: Check the name of the pull-request
7777
runs-on: ubuntu-latest
7878
permissions:
79-
pull-requests: read
79+
pull-requests: read # Needed to read pull request details
8080
steps:
8181
- name: Check pull-request name
82-
uses: ansys/actions/check-pr-title@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
82+
uses: ansys/actions/check-pr-title@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
8383
with:
8484
token: ${{ secrets.GITHUB_TOKEN }}
8585

@@ -94,7 +94,7 @@ jobs:
9494
folder: ["doc", "examples"]
9595
steps:
9696
- name: "Ansys documentation style checks"
97-
uses: ansys/actions/doc-style@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
97+
uses: ansys/actions/doc-style@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
9898
with:
9999
token: ${{ secrets.GITHUB_TOKEN }}
100100
files: ${{ matrix.folder }}
@@ -122,7 +122,7 @@ jobs:
122122
steps:
123123
- name: "Build wheelhouse and perform smoke test"
124124
id: build-wheelhouse
125-
uses: ansys/actions/build-wheelhouse@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
125+
uses: ansys/actions/build-wheelhouse@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
126126
with:
127127
library-name: ${{ env.PACKAGE_NAME }}
128128
operating-system: ${{ matrix.os }}
@@ -150,7 +150,7 @@ jobs:
150150
permissions:
151151
contents: read
152152
steps:
153-
- uses: ansys/actions/check-vulnerabilities@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
153+
- uses: ansys/actions/check-vulnerabilities@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
154154
with:
155155
python-version: ${{ env.MAIN_PYTHON_VERSION }}
156156
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
@@ -161,7 +161,7 @@ jobs:
161161
name: "Check actions security"
162162
runs-on: ubuntu-latest
163163
steps:
164-
- uses: ansys/actions/check-actions-security@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
164+
- uses: ansys/actions/check-actions-security@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
165165
with:
166166
generate-summary: true
167167
token: ${{ secrets.GITHUB_TOKEN }}
@@ -173,8 +173,8 @@ jobs:
173173
needs: doc-style
174174
uses: ./.github/workflows/doc-build.yml
175175
permissions:
176-
contents: read
177-
packages: read
176+
contents: read # Needed to read repository contents for documentation build
177+
packages: read # Needed to pull Docker images from GitHub packages
178178
secrets:
179179
license-server: ${{ secrets.LICENSE_SERVER }}
180180
username: ${{ github.actor }}
@@ -187,10 +187,10 @@ jobs:
187187
needs: docs-build
188188
if: contains(github.event.pull_request.labels.*.name, 'deploy pr docs')
189189
permissions:
190-
contents: write
191-
pull-requests: write
190+
contents: write # Needed to push documentation to gh-pages branch
191+
pull-requests: write # Needed to comment on pull requests with documentation link
192192
steps:
193-
- uses: ansys/actions/doc-deploy-pr@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
193+
- uses: ansys/actions/doc-deploy-pr@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
194194
with:
195195
cname: ${{ env.DOCUMENTATION_CNAME }}
196196
token: ${{ secrets.GITHUB_TOKEN }}
@@ -203,14 +203,14 @@ jobs:
203203
name: "Build remote test matrix"
204204
runs-on: ubuntu-latest
205205
permissions:
206-
contents: read
206+
contents: read # Needed to read repository contents for matrix build
207207
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
208208
outputs:
209209
matrix: ${{ steps.set-matrix.outputs.matrix }}
210210

211211
steps:
212212
- name: "Install Git and checkout project"
213-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
213+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
214214
with:
215215
persist-credentials: false
216216

@@ -230,8 +230,8 @@ jobs:
230230
fail-fast: false
231231
matrix: ${{ fromJson(needs.build-test-remote-matrix.outputs.matrix) }}
232232
permissions:
233-
contents: read
234-
packages: read
233+
contents: read # Needed to read repository contents for tests
234+
packages: read # Needed to pull Docker images from GitHub packages
235235
uses: ./.github/workflows/test-remote.yml
236236
secrets:
237237
license-server: ${{ secrets.LICENSE_SERVER }}
@@ -248,13 +248,13 @@ jobs:
248248
name: "Build test matrix for minimal and local"
249249
runs-on: ubuntu-latest
250250
permissions:
251-
contents: read
251+
contents: read # Needed to read repository contents for matrix build
252252
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
253253
outputs:
254254
matrix: ${{ steps.set-matrix.outputs.matrix }}
255255
steps:
256256
- name: "Install Git and checkout project"
257-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
257+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
258258
with:
259259
persist-credentials: false
260260

@@ -273,8 +273,8 @@ jobs:
273273
needs: [smoke-tests, build-test-local-matrix]
274274
uses: ./.github/workflows/test-local.yml
275275
permissions:
276-
contents: read
277-
packages: read
276+
contents: read # Needed to read repository contents for tests
277+
packages: read # Needed to pull Docker images from GitHub packages
278278
strategy:
279279
fail-fast: false
280280
matrix: ${{ fromJson(needs.build-test-local-matrix.outputs.matrix) }}
@@ -301,8 +301,8 @@ jobs:
301301
needs: [build-test-ubuntu-local, build-test-remote]
302302
uses: ./.github/workflows/test-local.yml
303303
permissions:
304-
contents: read
305-
packages: read
304+
contents: read # Needed to read repository contents for tests
305+
packages: read # Needed to pull Docker images from GitHub packages
306306
strategy:
307307
fail-fast: false
308308
matrix:
@@ -329,8 +329,8 @@ jobs:
329329
if: github.ref != 'refs/heads/main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
330330
needs: [build-test-ubuntu-local, build-test-remote]
331331
permissions:
332-
contents: read
333-
packages: read
332+
contents: read # Needed to read repository contents for tests
333+
packages: read # Needed to pull Docker images from GitHub packages
334334
uses: ./.github/workflows/test-local.yml
335335
strategy:
336336
fail-fast: false
@@ -358,10 +358,10 @@ jobs:
358358
needs: [build-test-remote, build-test-ubuntu-local, build-test-ubuntu-minimal, docs-build]
359359
runs-on: ubuntu-latest
360360
permissions:
361-
contents: read
361+
contents: read # Needed to read repository contents for packaging
362362
steps:
363363
- name: "Build library source and wheel artifacts"
364-
uses: ansys/actions/build-library@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
364+
uses: ansys/actions/build-library@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
365365
with:
366366
library-name: ${{ env.PACKAGE_NAME }}
367367
python-version: ${{ env.MAIN_PYTHON_VERSION }}
@@ -375,11 +375,11 @@ jobs:
375375
# Specifying a GitHub environment is optional, but strongly encouraged
376376
environment: release
377377
permissions:
378-
id-token: write
379-
contents: write
378+
id-token: write # Required for trusted publishing to PyPI
379+
contents: write # Needed to create GitHub releases
380380
steps:
381381
- name: "Download the library artifacts from build-library step"
382-
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
382+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
383383
with:
384384
name: ${{ env.PACKAGE_NAME }}-artifacts
385385
path: ${{ env.PACKAGE_NAME }}-artifacts
@@ -396,7 +396,7 @@ jobs:
396396
skip-existing: false
397397

398398
- name: "Release to GitHub"
399-
uses: ansys/actions/release-github@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
399+
uses: ansys/actions/release-github@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
400400
with:
401401
library-name: ${{ env.PACKAGE_NAME }}
402402
additional-artifacts: "minimum_requirements.txt"
@@ -408,11 +408,11 @@ jobs:
408408
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
409409
runs-on: ubuntu-latest
410410
permissions:
411-
contents: write
411+
contents: write # Needed to push documentation to gh-pages branch
412412
needs: [release]
413413
steps:
414414
- name: "Deploy the stable documentation"
415-
uses: ansys/actions/doc-deploy-stable@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
415+
uses: ansys/actions/doc-deploy-stable@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
416416
with:
417417
cname: ${{ env.DOCUMENTATION_CNAME }}
418418
token: ${{ secrets.GITHUB_TOKEN }}
@@ -426,11 +426,11 @@ jobs:
426426
if: github.ref == 'refs/heads/main' && !contains(github.ref, 'refs/tags')
427427
runs-on: ubuntu-latest
428428
permissions:
429-
contents: write
429+
contents: write # Needed to push documentation to gh-pages branch
430430
needs: [docs-build]
431431
steps:
432432
- name: "Deploy the latest documentation"
433-
uses: ansys/actions/doc-deploy-dev@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
433+
uses: ansys/actions/doc-deploy-dev@21c9de9bee9692173780696d4a39964f20b9cfa3 #v10.1.5
434434
with:
435435
cname: ${{ env.DOCUMENTATION_CNAME }}
436436
token: ${{ secrets.GITHUB_TOKEN }}
@@ -444,7 +444,7 @@ jobs:
444444
if: failure() && github.event_name == 'schedule'
445445
runs-on: ubuntu-latest
446446
permissions:
447-
issues: write
447+
issues: write # Needed to create issues on build failures
448448
steps:
449449
- name: "Open issue"
450450
uses: jayqi/failed-build-issue-action@1a893bbf43ef1c2a8705e2b115cd4f0fe3c5649b #v1.2.0
@@ -467,7 +467,7 @@ jobs:
467467
os: [ubuntu-latest, windows-latest]
468468

469469
steps:
470-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
470+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
471471
with:
472472
persist-credentials: false
473473

@@ -485,11 +485,11 @@ jobs:
485485
if: always()
486486
runs-on: ubuntu-latest
487487
permissions:
488-
contents: read
489-
actions: write
488+
contents: read # Needed to read repository contents
489+
actions: write # Needed to generate workflow summaries
490490
steps:
491491
- name: "Install Git and checkout project"
492-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
492+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
493493
with:
494494
persist-credentials: false
495495

.github/workflows/codeql-analysis.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121

2222
permissions: {}
2323

24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
2428
jobs:
2529
analyze:
2630
name: Analyze (${{ matrix.language }})
@@ -31,15 +35,10 @@ jobs:
3135
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
3236
runs-on: 'ubuntu-latest'
3337
permissions:
34-
# required for all workflows
35-
security-events: write
36-
37-
# required to fetch internal or private CodeQL packs
38-
packages: read
39-
40-
# only required for workflows in private repositories
41-
actions: read
42-
contents: read
38+
security-events: write # Required to upload security scanning results
39+
packages: read # Required to fetch internal or private CodeQL packs
40+
actions: read # Required for workflows in private repositories
41+
contents: read # Required to read the repository contents
4342

4443
strategy:
4544
fail-fast: false

.github/workflows/doc-build.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,18 @@ on:
6363
Password for the GitHub container registry.
6464
required: true
6565

66+
# zizmor: ignore[concurrency-limits]
67+
# Concurrency is controlled by the parent workflow (ci.yml)
68+
6669
permissions: {}
6770

6871
jobs:
6972
doc-build:
7073
name: Build documentation
7174
runs-on: ubuntu-latest
7275
permissions:
73-
contents: read
74-
packages: read
76+
contents: read # Needed to read repository contents for documentation build
77+
packages: read # Needed to pull Docker images from GitHub packages
7578
env:
7679
ON_CI: True
7780
ON_DOCUMENTATION: TRUE

.github/workflows/docker_clean_untagged.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ jobs:
1515
name: Cleaning unnecessary packages
1616
runs-on: ubuntu-latest
1717
permissions:
18-
contents: read
19-
packages: write
18+
contents: read # Needed to read repository contents
19+
packages: write # Needed to delete untagged Docker images
2020
env:
2121
PACKAGE_DELETION_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222

0 commit comments

Comments
 (0)