Skip to content

Commit 9cb3b1c

Browse files
chore: Set permissions for GitHub actions
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: naveen <[email protected]>
1 parent a3eb0c1 commit 9cb3b1c

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ env:
3030

3131
ENABLED_DIAGNOSTICS: ${{ secrets.ENABLED_DIAGNOSTICS }}
3232

33+
permissions:
34+
contents: read
35+
3336
jobs:
3437
prepare:
3538
name: Prepare Build

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@ on:
2020
schedule:
2121
- cron: '0 12 * * *'
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
analyze:
28+
permissions:
29+
actions: read # for github/codeql-action/init to get workflow details
30+
contents: read # for actions/checkout to fetch code
31+
security-events: write # for github/codeql-action/analyze to upload SARIF results
2532
name: Analyze
2633
runs-on: ubuntu-latest
2734

.github/workflows/format.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- '**'
2020
- '!docs/**'
2121

22+
permissions:
23+
contents: read
24+
2225
jobs:
2326
format:
2427
runs-on: ubuntu-latest

.github/workflows/homebrew.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ on:
44
workflow_dispatch:
55
repository_dispatch:
66
types: [release]
7+
permissions:
8+
contents: read
9+
710
jobs:
811
homebrew:
12+
permissions:
13+
contents: none
914
name: Bump Homebrew formula
1015
runs-on: macos-latest
1116
steps:

0 commit comments

Comments
 (0)