Skip to content

Commit 349e457

Browse files
Set permissions for GitHub actions (#10526)
- 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> Co-authored-by: Diego Molina <diemol@users.noreply.github.com>
1 parent 3d19b84 commit 349e457

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

‎.github/workflows/ci-java.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ env:
2020

2121
jobs:
2222
check_workflow:
23+
permissions:
24+
contents: none
2325
uses: ./.github/workflows/should-workflow-run.yml
2426
with:
2527
bazel-target-prefix: '//java'

‎.github/workflows/ci-javascript.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717

1818
jobs:
1919
check_workflow:
20+
permissions:
21+
contents: none
2022
uses: ./.github/workflows/should-workflow-run.yml
2123
with:
2224
bazel-target-prefix: '//javascript'

‎.github/workflows/ci-python.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717

1818
jobs:
1919
check_workflow:
20+
permissions:
21+
contents: none
2022
uses: ./.github/workflows/should-workflow-run.yml
2123
with:
2224
bazel-target-prefix: '//py'

‎.github/workflows/ci-ruby.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ on:
1717

1818
jobs:
1919
check_workflow:
20+
permissions:
21+
contents: none
2022
uses: ./.github/workflows/should-workflow-run.yml
2123
with:
2224
bazel-target-prefix: '//rb'

‎.github/workflows/stale.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ on:
55
schedule:
66
- cron: '15 10,20 * * *'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
stale:
13+
permissions:
14+
issues: write # for actions/stale to close stale issues
15+
pull-requests: write # for actions/stale to close stale PRs
1016
runs-on: ubuntu-latest
1117
steps:
1218
- uses: actions/stale@v4

0 commit comments

Comments
 (0)