Skip to content

Commit

Permalink
chore: Set permissions for GitHub actions
Browse files Browse the repository at this point in the history
 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>
  • Loading branch information
neilnaveen authored and dcbaker committed Jun 25, 2022
1 parent 650cea3 commit 5f8b048
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/file_format.yml
Expand Up @@ -6,6 +6,9 @@ concurrency:
group: file_fmt-${{ github.head_ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
format:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Expand Up @@ -14,6 +14,9 @@ on:
- "**.py"
- ".github/workflows/lint.yml"

permissions:
contents: read

jobs:

pylint:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos.yml
Expand Up @@ -20,6 +20,9 @@ on:
- ".github/workflows/macos.yml"
- "run_unittests.py"

permissions:
contents: read

jobs:
unittests-appleclang:
runs-on: macos-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/msys2.yml
Expand Up @@ -20,6 +20,9 @@ on:
- ".github/workflows/msys2.yml"
- "run_unittests.py"

permissions:
contents: read

jobs:
test:
runs-on: windows-2019
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nonative.yml
Expand Up @@ -22,6 +22,9 @@ on:
- ".github/workflows/nonative.yml"
- "run*tests.py"

permissions:
contents: read

jobs:
cross-only-armhf:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/os_comp.yml
Expand Up @@ -26,6 +26,9 @@ on:
- ".github/workflows/os_comp.yml"
- "run_unittests.py"

permissions:
contents: read

jobs:
arch:
name: ${{ matrix.cfg.name }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unusedargs_missingreturn.yml
Expand Up @@ -36,6 +36,9 @@ on:
- "test cases/objcpp/**"
- "test caes/windows/**"

permissions:
contents: read

jobs:

linux:
Expand Down

0 comments on commit 5f8b048

Please sign in to comment.