chore: 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: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
This commit is contained in:
nathannaveen 2022-05-30 00:58:11 +00:00 committed by Victor Zverovich
parent fe6eb792d5
commit 11316b29af
4 changed files with 12 additions and 0 deletions

View File

@ -2,6 +2,9 @@ name: doc
on: [push, pull_request] on: [push, pull_request]
permissions:
contents: read
jobs: jobs:
build: build:
# Use Ubuntu 20.04 because doxygen 1.8.13 from Ubuntu 18.04 is broken. # Use Ubuntu 20.04 because doxygen 1.8.13 from Ubuntu 18.04 is broken.

View File

@ -2,6 +2,9 @@ name: linux
on: [push, pull_request] on: [push, pull_request]
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}

View File

@ -2,6 +2,9 @@ name: macos
on: [push, pull_request] on: [push, pull_request]
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: macos-10.15 runs-on: macos-10.15

View File

@ -2,6 +2,9 @@ name: windows
on: [push, pull_request] on: [push, pull_request]
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ${{matrix.os}} runs-on: ${{matrix.os}}