Skip to content

Commit c87692d

Browse files
authored
Tighten GITHUB_TOKEN permissions (#4538)
* Tighten GITHUB_TOKEN permissions Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Tighten GITHUB_TOKEN permissions Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix permission Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 2dd4334 commit c87692d

18 files changed

+46
-8
lines changed

.github/workflows/backport.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
branches:
88
- develop
99

10+
permissions: {} # We use ELEMENT_BOT_TOKEN instead
11+
1012
jobs:
1113
backport:
1214
name: Backport

.github/workflows/docs-pr-netlify.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@ on:
55
workflows: ["Static Analysis"]
66
types:
77
- completed
8-
8+
permissions: {}
99
jobs:
1010
netlify:
1111
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
1212
runs-on: ubuntu-24.04
13+
permissions:
14+
actions: read
1315
steps:
1416
- name: 📥 Download artifact
1517
uses: actions/download-artifact@v4
1618
with:
17-
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
1819
run-id: ${{ github.event.workflow_run.id }}
1920
name: docs
2021
path: docs

.github/workflows/downstream-end-to-end-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
#
1414
#push:
1515
# branches: [develop, master]
16-
16+
permissions: {} # No permissions required
1717
concurrency:
1818
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.run_id }}
1919
cancel-in-progress: ${{ github.event.workflow_run.event == 'pull_request' }}

.github/workflows/notify-downstream.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches: [develop]
55
concurrency: ${{ github.workflow }}-${{ github.ref }}
6+
permissions: {} # We use ELEMENT_BOT_TOKEN instead
67
jobs:
78
notify-downstream:
89
# Only respect triggers from our develop branch, ignore that of forks

.github/workflows/pull_request.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
ELEMENT_BOT_TOKEN:
1010
required: true
1111
concurrency: ${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
12+
permissions: {} # We use ELEMENT_BOT_TOKEN instead
1213
jobs:
1314
changelog:
1415
name: Preview Changelog

.github/workflows/release-drafter-workflow.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ on:
88
type: string
99
required: false
1010
concurrency: release-drafter-action
11+
permissions: {}
1112
jobs:
1213
draft:
1314
runs-on: ubuntu-24.04
15+
permissions:
16+
contents: write
1417
steps:
1518
- name: 🧮 Checkout code
1619
uses: actions/checkout@v4

.github/workflows/release-drafter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches: [staging]
99
workflow_dispatch: {}
1010
concurrency: ${{ github.workflow }}
11+
permissions: {}
1112
jobs:
1213
draft:
14+
permissions:
15+
contents: write
1316
uses: matrix-org/matrix-js-sdk/.github/workflows/release-drafter-workflow.yml@develop

.github/workflows/release-gitflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ on:
1313
type: string
1414
required: false
1515
concurrency: ${{ github.workflow }}
16+
permissions: {} # Uses ELEMENT_BOT_TOKEN
1617
jobs:
1718
merge:
1819
runs-on: ubuntu-24.04
1920
steps:
2021
- uses: actions/checkout@v4
2122
with:
23+
# We will be pushing to this branch and want the CI to run after we do so we cannot use the GITHUB_TOKEN
2224
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
2325
fetch-depth: 0
2426

.github/workflows/release-make.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ on:
3838
description: The number of expected assets, including signatures, excluding generated zip & tarball.
3939
type: number
4040
required: false
41+
permissions: {}
4142
jobs:
4243
release:
4344
name: Release
4445
runs-on: ubuntu-24.04
4546
environment: Release
47+
permissions:
48+
contents: write
4649
steps:
4750
- name: Load GPG key
4851
id: gpg
@@ -65,6 +68,7 @@ jobs:
6568
- uses: actions/checkout@v4
6669
with:
6770
ref: staging
71+
# We will be pushing to this branch and want the CI to run after we do so we cannot use the GITHUB_TOKEN
6872
token: ${{ secrets.ELEMENT_BOT_TOKEN }}
6973
fetch-depth: 0
7074

@@ -274,6 +278,8 @@ jobs:
274278
name: Post release steps
275279
needs: release
276280
runs-on: ubuntu-24.04
281+
permissions:
282+
issues: write
277283
steps:
278284
- id: repository
279285
run: echo "REPO=${GITHUB_REPOSITORY#*/}" >> $GITHUB_OUTPUT

.github/workflows/release-npm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
id:
99
description: "The npm package@version string we published"
1010
value: ${{ jobs.npm.outputs.id }}
11+
permissions: {} # No permissions required
1112
jobs:
1213
npm:
1314
name: Publish to npm

0 commit comments

Comments
 (0)