Skip to content

Commit 054a3f0

Browse files
naveensrinivasanSteve Riesenberg
authored and
Steve Riesenberg
committed
Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ Signed-off-by: naveen <[email protected]> Closes gh-11367
1 parent 409998a commit 054a3f0

7 files changed

+21
-0
lines changed

.github/workflows/algolia-index.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- cron: '0 10 * * *' # Once per day at 10am UTC
66
workflow_dispatch: # Manual trigger
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
update:
1013
name: Update Algolia Index

.github/workflows/antora-generate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
env:
1111
GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
build:
1518
runs-on: ubuntu-latest

.github/workflows/clean_build_artifacts.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ on:
33
schedule:
44
- cron: '0 10 * * *' # Once per day at 10am UTC
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
main:
11+
permissions:
12+
contents: none
813
runs-on: ubuntu-latest
914
steps:
1015
- name: Delete artifacts in cron job

.github/workflows/continuous-integration-workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ jobs:
232232
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
233233
DOCS_HOST: ${{ secrets.DOCS_HOST }}
234234
perform_release:
235+
permissions:
236+
contents: write # for Git to git push
235237
name: Perform release
236238
needs: [prerequisites, deploy_artifacts, deploy_docs, deploy_schema]
237239
runs-on: ubuntu-latest

.github/workflows/deploy-reference.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- cron: '0 10 * * *' # Once per day at 10am UTC
88
workflow_dispatch: # Manual trigger
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
deploy:
1215
name: deploy

.github/workflows/milestone-spring-releasetrain.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ env:
77
TITLE: ${{ github.event.milestone.title }}
88
jobs:
99
spring-releasetrain-checks:
10+
permissions:
11+
contents: none
1012
name: Check DueOn is on a Release Date
1113
runs-on: ubuntu-latest
1214
steps:

.github/workflows/pr-build-workflow.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on: pull_request
55
env:
66
RUN_JOBS: ${{ github.repository == 'spring-projects/spring-security' }}
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
build:
1013
name: Build

0 commit comments

Comments
 (0)