Skip to content

Commit a2523e3

Browse files
committed
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: nathannaveen <[email protected]>
1 parent c2aa519 commit a2523e3

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ on:
99
schedule:
1010
- cron: '37 19 * * 0'
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
analyze:
17+
permissions:
18+
actions: read # for github/codeql-action/init to get workflow details
19+
contents: read # for actions/checkout to fetch code
20+
security-events: write # for github/codeql-action/autobuild to send a status report
1421
name: Analyze
1522
runs-on: ubuntu-latest
1623

.github/workflows/generate.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ on:
99
description: 'The remote kubernetes release branch to fetch openapi spec. .e.g. "release-1.23"'
1010

1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
generate:
17+
permissions:
18+
contents: write # for Git to git push
19+
pull-requests: write # for repo-sync/pull-request to create pull requests
1420
runs-on: ubuntu-latest
1521
steps:
1622
- name: Checkout Java

.github/workflows/snapshot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- master
77
workflow_dispatch: {}
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
verify:
1114
name: latest-images

0 commit comments

Comments
 (0)