Set permissions for GitHub actions

- 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 <172697+naveensrinivasan@users.noreply.github.com>
This commit is contained in:
naveensrinivasan 2022-04-15 21:26:48 -05:00
parent 047e4a6750
commit d932463cfe
No known key found for this signature in database
GPG Key ID: F39F847B7B035ADE
4 changed files with 18 additions and 0 deletions

View File

@ -10,6 +10,9 @@ on:
branches:
- develop
permissions:
contents: read
jobs:
changelog:
runs-on: ubuntu-latest

View File

@ -11,8 +11,14 @@ on:
paths:
- "**/*.go"
- ".github/workflows/golangci-lint.yml"
permissions:
contents: read
jobs:
lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
runs-on: ubuntu-latest
steps:
- name: Checkout codebase

View File

@ -4,9 +4,15 @@ on:
schedule:
- cron: "30 1 * * *"
permissions:
contents: read
jobs:
stale:
permissions:
issues: write # for actions/stale to close stale issues
pull-requests: write # for actions/stale to close stale PRs
runs-on: ubuntu-latest
steps:

View File

@ -20,6 +20,9 @@ on:
- "go.sum"
- ".github/workflows/test.yml"
permissions:
contents: read
jobs:
test:
strategy: