Skip to content

Commit 20eff46

Browse files
nathannaveenhasezoey
authored andcommitted
chore(workflow/*): set permissions for GitHub actions (#640)
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 <[email protected]>
1 parent 9254090 commit 20eff46

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

.github/workflows/codeql-analysis.yml

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

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

.github/workflows/stale.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ on:
66
schedule:
77
- cron: '30 1 * * *'
88

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

.github/workflows/website.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ on:
1212
release:
1313
types: [created]
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
website:
20+
permissions:
21+
contents: write # for JamesIves/github-pages-deploy-action to push changes in repo
1722
runs-on: ubuntu-latest
1823
steps:
1924
- uses: actions/checkout@v2

0 commit comments

Comments
 (0)