Browse Source

chore: Set permissions for GitHub actions (#2496)

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>
pull/2503/head
Naveen 2 years ago
committed by GitHub
parent
commit
023eb3380d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 0 deletions
  1. +5
    -0
      .github/workflows/android.yml
  2. +3
    -0
      .github/workflows/cmake.yml
  3. +5
    -0
      .github/workflows/linux.yml
  4. +3
    -0
      .github/workflows/linux_examples.yml
  5. +5
    -0
      .github/workflows/macos.yml
  6. +5
    -0
      .github/workflows/windows.yml
  7. +3
    -0
      .github/workflows/windows_examples.yml

+ 5
- 0
.github/workflows/android.yml View File

@ -16,8 +16,13 @@ on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false

+ 3
- 0
.github/workflows/cmake.yml View File

@ -23,6 +23,9 @@ env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
permissions:
contents: read
jobs:
build_windows:
name: Windows Build

+ 5
- 0
.github/workflows/linux.yml View File

@ -15,8 +15,13 @@ on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ubuntu-latest
strategy:
fail-fast: false

+ 3
- 0
.github/workflows/linux_examples.yml View File

@ -14,6 +14,9 @@ on:
- 'examples/**'
- '.github/workflows/linux_examples.yml'
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest

+ 5
- 0
.github/workflows/macos.yml View File

@ -15,8 +15,13 @@ on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: macos-latest
env:

+ 5
- 0
.github/workflows/windows.yml View File

@ -15,8 +15,13 @@ on:
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false

+ 3
- 0
.github/workflows/windows_examples.yml View File

@ -14,6 +14,9 @@ on:
- 'examples/**'
- '.github/workflows/windows_examples.yml'
permissions:
contents: read
jobs:
build:
runs-on: windows-latest

Loading…
Cancel
Save