Skip to content

Commit 4d279b9

Browse files
authored
ci(security): reduce the workflow permissions to read-all (#85)
By default all the workflows should have read-all permissions and any extra permission required should be added explicitly per job. Closes #84 Signed-off-by: Jonathan Gonzalez V. <[email protected]>
1 parent 84f77b9 commit 4d279b9

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

.github/workflows/build-commitfest.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ defaults:
1515
# default failure handling for shell scripts in 'run' steps
1616
shell: 'bash -Eeuo pipefail -x {0}'
1717

18+
permissions: read-all
19+
1820
jobs:
1921
build-pg:
2022
name: Build the patch for PostgreSQL

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ defaults:
2020
# default failure handling for shell scripts in 'run' steps
2121
shell: 'bash -Eeuo pipefail -x {0}'
2222

23+
permissions: read-all
24+
2325
jobs:
2426
build-pg:
2527
name: Build generic PostgreSQL image from sources

.github/workflows/continuous-delivery.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ defaults:
1919
# default failure handling for shell scripts in 'run' steps
2020
shell: 'bash -Eeuo pipefail -x {0}'
2121

22+
permissions: read-all
23+
2224
jobs:
2325
build-pg:
2426
name: Build the Trunk of PostgreSQL
@@ -87,6 +89,8 @@ jobs:
8789
needs:
8890
- build-pg
8991
uses: ./.github/workflows/reusable-e2e.yml
92+
permissions:
93+
packages: write
9094
with:
9195
postgres_img: ${{ needs.build-pg.outputs.pg_image }}
9296
major_version: ${{ needs.build-pg.outputs.pg_major }}

.github/workflows/reusable-e2e.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,28 @@ defaults:
3737
# default failure handling for shell scripts in 'run' steps
3838
shell: 'bash -Eeuo pipefail -x {0}'
3939

40+
permissions:
41+
actions: none
42+
attestations: none
43+
checks: none
44+
contents: none
45+
deployments: none
46+
id-token: none
47+
issues: none
48+
models: none
49+
discussions: none
50+
packages: none
51+
pages: none
52+
pull-requests: none
53+
security-events: none
54+
statuses: none
55+
4056
jobs:
4157
e2e-local:
4258
name: Run E2E on local executors
4359
runs-on: ubuntu-24.04
60+
permissions:
61+
packages: write
4462
env:
4563
TEST_DEPTH: ${{ inputs.test_depth }}
4664
FEATURE_TYPE: ${{ inputs.feature_type }}

.github/workflows/run-e2e-test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ on:
1919
description: 'E2E feature type filter. See https://github.com/cloudnative-pg/cloudnative-pg/blob/main/contribute/e2e_testing_environment/README.md#using-feature-type-test-selectionfilter'
2020
required: false
2121

22+
permissions: read-all
23+
2224
jobs:
2325
evaluate-env:
2426
name: Evaluate input env variables
@@ -62,6 +64,8 @@ jobs:
6264
needs:
6365
- evaluate-env
6466
uses: ./.github/workflows/reusable-e2e.yml
67+
permissions:
68+
packages: write
6569
with:
6670
postgres_img: ${{ needs.evaluate-env.outputs.pg_image }}
6771
major_version: ${{ needs.evaluate-env.outputs.pg_major }}

0 commit comments

Comments
 (0)