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>
This commit is contained in:
neilnaveen 2022-06-09 01:08:19 +00:00 committed by Tim van der Meij
parent 8403bafbfc
commit 83ecc3f46c
No known key found for this signature in database
GPG Key ID: 8C3FD2925A5F2762
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,8 @@
name: CI
on: [push, pull_request]
permissions:
contents: read
jobs:
test:
name: Test

View File

@ -1,13 +1,14 @@
name: CodeQL
on: [push, pull_request]
permissions:
contents: read
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy: