Skip to content

Commit 664ac01

Browse files
authored
Set permissions to GITHUB_TOKEN (#2848)
* [StepSecurity] ci: Harden GitHub Actions Signed-off-by: Joyce Brum <joycebrum@google.com> * set release.yml permissions Signed-off-by: Joyce <joycebrum@google.com> * set backport.yml permissions Signed-off-by: Joyce <joycebrum@google.com> --------- Signed-off-by: Joyce Brum <joycebrum@google.com> Signed-off-by: Joyce <joycebrum@google.com>
1 parent 5dd5f65 commit 664ac01

File tree

6 files changed

+22
-0
lines changed

6 files changed

+22
-0
lines changed

.github/workflows/backport.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ on:
55
- closed
66
- labeled
77

8+
permissions: {}
9+
810
jobs:
911
backport:
1012
runs-on: ubuntu-20.04
1113
name: Backport
14+
permissions:
15+
contents: write
1216
steps:
1317
- name: Backport Bot
1418
if: github.event.pull_request.merged && ( ( github.event.action == 'closed' && contains( join( github.event.pull_request.labels.*.name ), 'backport') ) || contains( github.event.label.name, 'backport' ) )

.github/workflows/ci_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
- master
1111
- r*
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
flake8-test:
1518
name: Flake8

.github/workflows/notify_codeowners.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types: [opened]
66

77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
notify-codeowners:
1013
name: Notify codeowners

.github/workflows/release-drafter.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
- master
77
- r*
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
update_release_draft:
14+
permissions:
15+
contents: write # for release-drafter/release-drafter to create a github release
16+
pull-requests: write # for release-drafter/release-drafter to add label to PR
1117
runs-on: ubuntu-latest
1218
steps:
1319
- uses: release-drafter/release-drafter@74e7c423dafbb406c9c18b1638334f67a7c891c3 # Version 5.7.0

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
- master
1515
- r*
1616

17+
permissions:
18+
contents: read
19+
1720
env:
1821
MIN_PY_VERSION: '3.9'
1922
MAX_PY_VERSION: '3.11'

.github/workflows/validate_codeowners.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ on:
1515
# Otherwise, it's useless, it just check the codeowners file from the latest commit in master
1616

1717

18+
permissions:
19+
contents: read
20+
1821
jobs:
1922
validate-codeowners:
2023
name: Check that the CODEOWNERS is valid

0 commit comments

Comments
 (0)