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: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
naveensrinivasan 2022-04-23 21:23:42 -05:00
parent 7251837732
commit 92477b4608
No known key found for this signature in database
GPG Key ID: F39F847B7B035ADE
5 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,9 @@ on:
- "README.md"
- "docs/BestPractices.md"
permissions:
contents: read
jobs:
doctoc:
name: Doc TOC Check

View File

@ -2,6 +2,9 @@ name: Test Whitespace and line endings
on: [pull_request]
permissions:
contents: read
jobs:
eclint:
runs-on: ubuntu-latest

View File

@ -5,6 +5,9 @@ on:
paths:
- "**/*.md"
permissions:
contents: read
jobs:
markdown-link-check:
runs-on: ubuntu-latest

View File

@ -6,6 +6,9 @@ on:
- ".github/workflows/missing-checksum.yml"
- "**/alpine*/Dockerfile"
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest

View File

@ -5,6 +5,9 @@ on:
paths:
- "**/*.sh"
permissions:
contents: read
jobs:
shfmt:
runs-on: ubuntu-latest