Skip to content

Commit 3049508

Browse files
committed
ci: specify workflow permissions per job
Also remove some unnecessary permissions: * The notification job in release-artifacts.yml only needs to read repo contents, not write contents and actions. * All jobs in release.yml except "Create release" and "Update podman.io" only need to read repo contents. "Update podman.io" only needs to write repo contents and pull requests. * Likewise, permissions for update-podmanio.yml can be restricted to only writing repo contents and pull requests. Signed-off-by: Daniel Hast <hast.daniel@protonmail.com>
1 parent 248d8f6 commit 3049508

File tree

10 files changed

+44
-12
lines changed

10 files changed

+44
-12
lines changed

.github/workflows/dev-bump.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ on:
33
push:
44
tags:
55
- '*'
6+
7+
permissions: {}
8+
69
jobs:
710
bump:
811
name: Bump to -dev
912
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write # to create and push to a branch
15+
pull-requests: write # to read and create pull requests
1016
steps:
1117
- uses: actions/checkout@v6
1218
with:
@@ -77,6 +83,9 @@ jobs:
7783
mainbump:
7884
name: Bump on main
7985
runs-on: ubuntu-latest
86+
permissions:
87+
contents: write # to create and push to a branch
88+
pull-requests: write # to read and create pull requests
8089
env:
8190
GH_TOKEN: ${{ github.token }}
8291
steps:

.github/workflows/first_contrib_cert_generator.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ on:
1616
description: 'The pull request number'
1717
required: true
1818

19-
# Permissions needed for this workflow.
20-
permissions:
21-
contents: read # Write access for certificate storage
22-
pull-requests: write # Write access to comment on PRs
23-
actions: read # Read access for workflow actions
19+
permissions: {}
2420

2521
jobs:
2622
screenshot_and_comment:
2723
# This job runs if the PR was merged or if it's a manual trigger.
2824
# The logic for first-time contributors is handled in a dedicated step below.
2925
if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }}
3026
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read # Write access for certificate storage
29+
pull-requests: write # Write access to comment on PRs
30+
actions: read # Read access for workflow actions
3131
steps:
3232
# Step 1: Check if this is the contributor's first merged PR.
3333
# This step is the source of truth and will control the execution of subsequent steps.

.github/workflows/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: "Pull Request Labeler"
33
on:
44
- pull_request_target
55

6+
permissions: {}
7+
68
jobs:
79
triage:
810
permissions:

.github/workflows/mac-pkg.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ on:
1515
- "true" # Must be quoted string, boolean value not supported.
1616
- "false"
1717

18-
permissions:
19-
contents: write
18+
permissions: {}
2019

2120
jobs:
2221
build:
2322
runs-on: macos-latest
23+
permissions:
24+
contents: write
2425
env:
2526
APPLICATION_CERTIFICATE: ${{ secrets.MACOS_APPLICATION_CERT }}
2627
CODESIGN_IDENTITY: ${{ secrets.MACOS_APPLICATION_IDENTITY }}

.github/workflows/machine-os-pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
paths:
66
- 'version/rawversion/version.go'
77

8+
permissions: {}
9+
810
concurrency:
911
# Cancel other in-progress runs on re-pushes
1012
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}

.github/workflows/needs-info-labeler.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
issues:
44
types:
55
- labeled
6+
7+
permissions: {}
8+
69
jobs:
710
add-comment:
811
if: github.event.label.name == 'needs-info'

.github/workflows/release-artifacts.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ on:
1515
- "true" # Must be quoted string, boolean value not supported.
1616
- "false"
1717

18-
permissions:
19-
contents: write
20-
actions: write
18+
permissions: {}
2119

2220
jobs:
2321
build:
2422
runs-on: ubuntu-24.04
23+
permissions:
24+
contents: write
25+
actions: write
2526
steps:
2627
# If the job fails, these details are all but impossible to observe.yy
2728
- name: Provide github event JSON for examination
@@ -202,6 +203,8 @@ jobs:
202203
if: needs.build.outputs.uploaded == 'true'
203204
runs-on: ubuntu-24.04
204205
needs: build
206+
permissions:
207+
contents: read
205208
steps:
206209
- name: Format release email
207210
id: format

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
- "true" # Must be quoted string, boolean value not supported.
1717
- "false"
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
check:
2124
name: Check
@@ -374,6 +377,9 @@ jobs:
374377
name: Update podman.io
375378
uses: ./.github/workflows/update-podmanio.yml
376379
needs: [check, release]
380+
permissions:
381+
contents: write # to push to a branch
382+
pull-requests: write # to read and create PRs
377383
if: needs.check.outputs.buildonly == 'false'
378384
secrets: inherit
379385
with:

.github/workflows/update-podmanio.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ on:
1818
PODMANBOT_TOKEN:
1919
required: true
2020

21+
permissions: {}
22+
2123
jobs:
2224
bump:
2325
name: Bump
2426
runs-on: ubuntu-24.04
27+
permissions:
28+
contents: write # to push to a branch
29+
pull-requests: write # to read and create PRs
2530
steps:
2631
- name: Get version
2732
id: getversion

.github/workflows/upload-win-installer.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ on:
1515
- "true" # Must be quoted string, boolean value not supported.
1616
- "false"
1717

18-
permissions:
19-
contents: write
18+
permissions: {}
2019

2120
jobs:
2221
build:
2322
runs-on: windows-latest
23+
permissions:
24+
contents: write
2425
env:
2526
FETCH_BASE_URL: ${{ github.server_url }}/${{ github.repository }}
2627
steps:

0 commit comments

Comments
 (0)