Skip to content

Commit 36b6da6

Browse files
committed
minor #17246 GitHub Workflows security hardening (sashashura)
This PR was submitted for the 6.2 branch but it was merged into the 4.4 branch instead. Discussion ---------- GitHub Workflows security hardening This PR adds explicit [permissions section](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions) to workflows. This is a security best practice because by default workflows run with [extended set of permissions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) (except from `on: pull_request` [from external forks](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)). By specifying any permission explicitly all others are set to none. By using the principle of least privilege the damage a compromised workflow can do (because of an [injection](https://securitylab.github.com/research/github-actions-untrusted-input/) or compromised third party tool or action) is restricted. It is recommended to have [most strict permissions on the top level](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions) and grant write permissions on [job level](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs) case by case. Commits ------- c62747f Update ci.yaml
2 parents 31c4f19 + c62747f commit 36b6da6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches-ignore:
99
- 'github-comments'
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
symfony-docs-builder-build:
1316
name: Build (symfony-tools/docs-builder)

0 commit comments

Comments
 (0)