Skip to content

Commit 3fc5cc3

Browse files
chore: Set permissions for GitHub actions (#2334)
* 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: nathannaveen <[email protected]> * fix ci --------- Signed-off-by: nathannaveen <[email protected]> Co-authored-by: Aras Abbasi <[email protected]>
1 parent d978acd commit 3fc5cc3

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/continuous-integration.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ name: Continuous Integration
77
push:
88
branches:
99
- main
10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
format:
1215
name: Format
@@ -36,7 +39,7 @@ jobs:
3639
- name: Setup Node.js
3740
uses: actions/setup-node@v3
3841
with:
39-
node-version: 16
42+
node-version: lts/*
4043
cache: 'npm'
4144
- name: Install dependencies
4245
run: npm ci --ignore-scripts --no-audit --no-progress --prefer-offline
@@ -53,7 +56,7 @@ jobs:
5356
- name: Setup Node.js
5457
uses: actions/setup-node@v3
5558
with:
56-
node-version: 16
59+
node-version: lts/*
5760
cache: 'npm'
5861
- name: Install dependencies
5962
run: npm ci --ignore-scripts --no-audit --no-progress --prefer-offline

.github/workflows/fix-formatting.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@ name: Fix formatting
55
- dependabot/npm_and_yarn/prettier-*
66
- dependabot/npm_and_yarn/eslint-*
77
workflow_dispatch: {}
8+
permissions:
9+
contents: read
10+
811
jobs:
912
fixFormatting:
13+
permissions:
14+
contents: write # for Git to git push
1015
runs-on: ubuntu-latest
1116
steps:
1217
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)