chore: Set permissions for GitHub actions (#12354)
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: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
This commit is contained in:
parent
513a6a8cbc
commit
274319a790
|
@ -7,6 +7,9 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-docs-build:
|
check-docs-build:
|
||||||
if: ${{ github.event.label.name == 'docs' }}
|
if: ${{ github.event.label.name == 'docs' }}
|
||||||
|
|
|
@ -4,8 +4,13 @@ on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "cosmovisor/v*.*.*"
|
- "cosmovisor/v*.*.*"
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
|
permissions:
|
||||||
|
contents: write # for goreleaser/goreleaser-action to create a GitHub release
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
|
@ -9,8 +9,13 @@ on:
|
||||||
- "docs/**"
|
- "docs/**"
|
||||||
- "x/**/*.md"
|
- "x/**/*.md"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build-and-deploy:
|
||||||
|
permissions:
|
||||||
|
contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: tendermintdev/docker-website-deployment
|
image: tendermintdev/docker-website-deployment
|
||||||
|
|
|
@ -2,8 +2,14 @@ name: "Pull Request Labeler"
|
||||||
on:
|
on:
|
||||||
- pull_request_target
|
- pull_request_target
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
labeler:
|
labeler:
|
||||||
|
permissions:
|
||||||
|
contents: read # for actions/labeler to determine modified files
|
||||||
|
pull-requests: write # for actions/labeler to add labels to PRs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/labeler@main
|
- uses: actions/labeler@main
|
||||||
|
|
|
@ -7,8 +7,14 @@ on:
|
||||||
- edited
|
- edited
|
||||||
- synchronize
|
- synchronize
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
main:
|
||||||
|
permissions:
|
||||||
|
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
|
||||||
|
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: amannn/action-semantic-pull-request@v4.5.0
|
- uses: amannn/action-semantic-pull-request@v4.5.0
|
||||||
|
|
|
@ -7,8 +7,13 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
golangci:
|
golangci:
|
||||||
|
permissions:
|
||||||
|
pull-requests: read # for technote-space/get-diff-action to get git reference
|
||||||
name: golangci-lint
|
name: golangci-lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
|
@ -6,6 +6,9 @@ on:
|
||||||
paths:
|
paths:
|
||||||
- "proto/**"
|
- "proto/**"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -6,6 +6,9 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- "rc**"
|
- "rc**"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-sim-multi-seed-long:
|
test-sim-multi-seed-long:
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
|
|
|
@ -7,8 +7,13 @@ on:
|
||||||
tags:
|
tags:
|
||||||
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
|
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
|
permissions:
|
||||||
|
contents: write # for goreleaser/goreleaser-action to create a GitHub release
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
|
@ -9,6 +9,9 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup-runs:
|
cleanup-runs:
|
||||||
|
permissions:
|
||||||
|
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
|
||||||
|
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
steps:
|
steps:
|
||||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||||
|
@ -28,6 +31,8 @@ jobs:
|
||||||
- run: make build
|
- run: make build
|
||||||
|
|
||||||
install-runsim:
|
install-runsim:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
|
@ -132,6 +137,8 @@ jobs:
|
||||||
SLACK_FOOTER: ""
|
SLACK_FOOTER: ""
|
||||||
|
|
||||||
sims-notify-failure:
|
sims-notify-failure:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
needs:
|
needs:
|
||||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -9,6 +9,9 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup-runs:
|
cleanup-runs:
|
||||||
|
permissions:
|
||||||
|
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
|
||||||
|
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
steps:
|
steps:
|
||||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||||
|
@ -28,6 +31,8 @@ jobs:
|
||||||
- run: make build
|
- run: make build
|
||||||
|
|
||||||
install-runsim:
|
install-runsim:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
needs: build
|
needs: build
|
||||||
steps:
|
steps:
|
||||||
|
@ -132,6 +137,8 @@ jobs:
|
||||||
SLACK_FOOTER: ""
|
SLACK_FOOTER: ""
|
||||||
|
|
||||||
sims-notify-failure:
|
sims-notify-failure:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
needs:
|
needs:
|
||||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -9,6 +9,9 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cleanup-runs:
|
cleanup-runs:
|
||||||
|
permissions:
|
||||||
|
actions: write # for rokroskar/workflow-run-cleanup-action to obtain workflow name & cancel it
|
||||||
|
contents: read # for rokroskar/workflow-run-cleanup-action to obtain branch
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
steps:
|
steps:
|
||||||
- uses: rokroskar/workflow-run-cleanup-action@master
|
- uses: rokroskar/workflow-run-cleanup-action@master
|
||||||
|
@ -17,6 +20,9 @@ jobs:
|
||||||
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
permissions:
|
||||||
|
contents: read # for actions/checkout to fetch code
|
||||||
|
pull-requests: read # for technote-space/get-diff-action to get git reference
|
||||||
runs-on: buildjet-4vcpu-ubuntu-2004
|
runs-on: buildjet-4vcpu-ubuntu-2004
|
||||||
if: "!contains(github.event.head_commit.message, 'skip-sims')"
|
if: "!contains(github.event.head_commit.message, 'skip-sims')"
|
||||||
steps:
|
steps:
|
||||||
|
@ -130,6 +136,8 @@ jobs:
|
||||||
SLACK_FOOTER: ""
|
SLACK_FOOTER: ""
|
||||||
|
|
||||||
sims-notify-failure:
|
sims-notify-failure:
|
||||||
|
permissions:
|
||||||
|
contents: none
|
||||||
needs:
|
needs:
|
||||||
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -3,8 +3,14 @@ on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
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
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v5
|
- uses: actions/stale@v5
|
||||||
|
|
Loading…
Reference in New Issue