Skip to content

Commit 4a95cf9

Browse files
authored
Merge pull request #401 from Staffbase/security/define-job-level-permissions
security: define permissions at job level in all workflows
2 parents 43bb09d + 91df4be commit 4a95cf9

22 files changed

+93
-7
lines changed

.github/workflows/cla.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
jobs:
1010
CLAssistant:
1111
runs-on: ubuntu-slim
12+
permissions:
13+
actions: read
14+
contents: write
15+
pull-requests: write
16+
statuses: write
1217
steps:
1318
- name: "CLA Assistant"
1419
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request'

.github/workflows/release-drafter.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ on:
88
jobs:
99
update_release_draft:
1010
uses: Staffbase/gha-workflows/.github/workflows/template_release_drafter.yml@main
11+
permissions:
12+
contents: write
13+
pull-requests: read
1114
secrets:
1215
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/template_autodev.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ on:
5454

5555
jobs:
5656
autodev:
57-
5857
name: Build Dev Branch
5958
runs-on: ubuntu-slim
59+
permissions:
60+
contents: read
6061

6162
# check to not trigger if dependabot did something or PR was closed or label is not the configured dev label
6263
if: github.actor != 'dependabot[bot]' && (github.event_name == 'push' || github.event.label.name == inputs.label || github.event.action == 'closed')

.github/workflows/template_automerge_dependabot.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ on:
3030

3131
jobs:
3232
dependabot:
33-
3433
name: auto-merge
3534
runs-on: ubuntu-slim
36-
35+
permissions: {}
3736
if: github.event.pull_request.user.login == 'dependabot[bot]'
3837

3938
steps:

.github/workflows/template_changeset_check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ jobs:
77
name: changeset-check
88
if: (!contains(github.event.pull_request.user.login , '[bot]'))
99
runs-on: ubuntu-slim
10+
permissions:
11+
contents: read
12+
pull-requests: write
1013
steps:
1114
- name: Checkout code
1215
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

.github/workflows/template_changeset_release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
release:
3434
name: changeset-release
3535
runs-on: ubuntu-slim
36+
permissions:
37+
contents: read
3638
steps:
3739
- name: Get App Token
3840
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0

.github/workflows/template_flaky_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
flaky-tests:
3434
name: Flaky-Tests
3535
runs-on: ubuntu-slim
36+
permissions: {}
3637
steps:
3738
- name: Find flaky tests
3839
uses: Staffbase/github-action-find-flaky-tests@166ee4950d01688cea6a229e6c20ba28ce66c645 # v0.3.1

.github/workflows/template_gitops.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ jobs:
106106
name: GitOps
107107
runs-on: ${{ inputs.runs-on }}
108108
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
109+
permissions:
110+
contents: read
109111

110112
env:
111113
USING_APP_CREDENTIALS: ${{ secrets.app-id != '' && secrets.private-key != '' }}

.github/workflows/template_jira_tagging.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ on:
2020

2121
jobs:
2222
jira-annotate:
23-
2423
name: Annotate all occurring tickets since last release-tag
2524
runs-on: ubuntu-24.04
25+
permissions:
26+
contents: read
2627

2728
steps:
2829
- name: Checkout

.github/workflows/template_launchdarkly_code_references.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ on:
1313

1414
jobs:
1515
launchDarklyCodeReferences:
16-
1716
name: Find LaunchDarkly flag code references
1817
runs-on: ubuntu-slim
18+
permissions:
19+
contents: read
1920

2021
steps:
2122
- name: Checkout

0 commit comments

Comments
 (0)