Skip to content

Commit

Permalink
ci: 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-jobs/assigning-permissions-to-jobs

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan authored and Madhu-1 committed May 5, 2022
1 parent b1a0f42 commit 2672fad
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-multi-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
codespell:
name: multi-arch-build
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codespell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
codespell:
name: codespell
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
commitlint:
name: commitlint
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/go-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
go-test:
name: go-test
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
golangci-lint:
name: golangci-lint
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-extras.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
lint-extras:
name: lint-extras
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/mod-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches:
- '*'
permissions:
contents: read

jobs:
mod-check:
name: mod-check
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
- devel
# Push events to branches matching refs/heads/release-v*
- 'release-v*'
permissions:
contents: read

jobs:
push:
name: Publish artifacts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
schedule:
# Run the retest action every 30 minutes
- cron: "30 * * * *"

permissions:
contents: read

jobs:
retest:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ on:
# Run the stalebot every day at 9pm UTC
- cron: "00 21 * * *"
# yamllint disable rule:line-length
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-18.04
if: github.repository == 'ceph/ceph-csi'
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-retest-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
pull_request:
branches: [devel]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 2672fad

Please sign in to comment.