Set permissions for GitHub actions
authornaveensrinivasan <redacted>
Thu, 7 Apr 2022 23:00:53 +0000 (23:00 +0000)
committernaveensrinivasan <redacted>
Thu, 7 Apr 2022 23:00:53 +0000 (23:00 +0000)
- 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/)

 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.

Signed-off-by: naveensrinivasan <redacted>
.github/workflows/ci.yml

index c8467f36412355294bb122f6a98053c5faf831d7..2bd1678e6b312c49823bdf4f792f82783a5fbd77 100644 (file)
@@ -5,6 +5,9 @@ on:
   pull_request:
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 jobs:
   test:
     name: Python ${{ matrix.python }} on ${{ matrix.os }}
git clone https://git.99rst.org/PROJECT