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: neilnaveen <42328488+neilnaveen@users.noreply.github.com>
pull/10540/head
neilnaveen 2 years ago committed by Dylan Baker
parent 650cea3d08
commit 5f8b0487ab
  1. 3
      .github/workflows/file_format.yml
  2. 3
      .github/workflows/lint.yml
  3. 3
      .github/workflows/macos.yml
  4. 3
      .github/workflows/msys2.yml
  5. 3
      .github/workflows/nonative.yml
  6. 3
      .github/workflows/os_comp.yml
  7. 3
      .github/workflows/unusedargs_missingreturn.yml

@ -6,6 +6,9 @@ concurrency:
group: file_fmt-${{ github.head_ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
format:
runs-on: ubuntu-latest

@ -14,6 +14,9 @@ on:
- "**.py"
- ".github/workflows/lint.yml"
permissions:
contents: read
jobs:
pylint:

@ -20,6 +20,9 @@ on:
- ".github/workflows/macos.yml"
- "run_unittests.py"
permissions:
contents: read
jobs:
unittests-appleclang:
runs-on: macos-latest

@ -20,6 +20,9 @@ on:
- ".github/workflows/msys2.yml"
- "run_unittests.py"
permissions:
contents: read
jobs:
test:
runs-on: windows-2019

@ -22,6 +22,9 @@ on:
- ".github/workflows/nonative.yml"
- "run*tests.py"
permissions:
contents: read
jobs:
cross-only-armhf:
runs-on: ubuntu-latest

@ -26,6 +26,9 @@ on:
- ".github/workflows/os_comp.yml"
- "run_unittests.py"
permissions:
contents: read
jobs:
arch:
name: ${{ matrix.cfg.name }}

@ -36,6 +36,9 @@ on:
- "test cases/objcpp/**"
- "test caes/windows/**"
permissions:
contents: read
jobs:
linux:

Loading…
Cancel
Save