chore: Set permissions for GitHub actions (#14120)

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 <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
Naveen 2022-07-01 00:43:08 -05:00 committed by GitHub
parent ab208fca91
commit 6bc73ed8af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 0 deletions

View File

@ -6,6 +6,9 @@ on:
repository_dispatch:
types: [run_build]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest

View File

@ -6,6 +6,9 @@ on:
repository_dispatch:
types: [run_build]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest

View File

@ -6,6 +6,9 @@ on:
repository_dispatch:
types: [run_build]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest

View File

@ -6,8 +6,13 @@ on:
schedule:
- cron: '0 0 * * *' # every day at midnight
permissions:
contents: read
jobs:
sync:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
steps:
- name: Setup Java JDK

View File

@ -10,6 +10,9 @@ on:
- 'intl/*_us.h'
- 'intl/*_us.json'
permissions:
contents: read
jobs:
sync:
runs-on: ubuntu-latest

View File

@ -10,6 +10,9 @@ on:
branches:
- master
permissions:
contents: read
jobs:
linux-c89: # Smoketest build using most restrictive compiler and default options
runs-on: ubuntu-latest