Skip to content

Commit 869503b

Browse files
authored
Tighten GHA permissions (#7959)
* Add dependabot cooldown to avoid bleeding edge * Restrict workflow-level permissions in all workflows * Switch Zizmor workflow to use official Action * Tighten a few permissions
1 parent 85a234a commit 869503b

File tree

10 files changed

+27
-18
lines changed

10 files changed

+27
-18
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ updates:
88
labels:
99
- "Github CI/CD"
1010
- "no releasenotes"
11+
cooldown:
12+
default-days: 7

.github/workflows/devcontainer-docker-image.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: devcontainer-docker-image
22

3+
permissions: {}
4+
35
on:
46
workflow_dispatch:
57
schedule:
@@ -18,7 +20,6 @@ jobs:
1820
# Set permissions for GitHub token
1921
# <https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#authenticating-to-package-registries-on-github>
2022
permissions:
21-
contents: read
2223
packages: write
2324

2425
steps:

.github/workflows/docker-image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: docker-image
22

3+
permissions: {}
4+
35
on:
46
release:
57
types:

.github/workflows/mypy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: mypy
22

3+
permissions: {}
4+
35
on:
46
pull_request:
57
push:

.github/workflows/pr-auto-label.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: "Pull Request Labeler"
2+
3+
permissions: {}
4+
25
on:
36
# The labeler doesn't execute any contributed code, so it should be fairly safe.
47
- pull_request_target # zizmor: ignore[dangerous-triggers]

.github/workflows/publish-release-notes-to-discourse.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Publish Release Notes to Discourse
22

3+
permissions: {}
4+
35
on:
46
release:
57
types: [published]

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: release-pipeline
22

3+
permissions: {}
4+
35
on:
46
push:
57
branches:

.github/workflows/slash_dispatch.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
name: Slash Command Dispatch
2+
3+
permissions: {}
4+
25
on:
36
issue_comment:
47
types: [created]

.github/workflows/tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: tests
22

3+
permissions: {}
4+
35
on:
46
pull_request:
57
push:

.github/workflows/zizmor.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,26 @@
1-
# https://github.com/woodruffw/zizmor
2-
name: zizmor GHA analysis
1+
# Source: <https://github.com/zizmorcore/zizmor-action>
2+
name: GitHub Actions Security Analysis with zizmor 🌈
33

44
on:
55
push:
66
branches: ["main"]
77
pull_request:
88
branches: ["**"]
99

10+
permissions: {}
11+
1012
jobs:
1113
zizmor:
12-
name: zizmor latest via PyPI
1314
runs-on: ubuntu-latest
1415
permissions:
1516
security-events: write
17+
# contents: read # only needed for private repos
18+
# actions: read # only needed for private repos
1619
steps:
1720
- name: Checkout repository
1821
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
1922
with:
2023
persist-credentials: false
2124

22-
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817 # v2.3.0
23-
2425
- name: Run zizmor 🌈
25-
run: uvx zizmor --format sarif . > results.sarif
26-
env:
27-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
29-
- name: Upload SARIF file
30-
uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
31-
with:
32-
# Path to SARIF file relative to the root of the repository
33-
sarif_file: results.sarif
34-
# Optional category for the results
35-
# Used to differentiate multiple results for one commit
36-
category: zizmor
26+
uses: zizmorcore/zizmor-action@e673c3917a1aef3c65c972347ed84ccd013ecda4 # v0.2.0

0 commit comments

Comments
 (0)