Skip to content

Commit dfb2991

Browse files
AdnaneKhanJuice10
andauthored
fix: address security risks in GitHub Actions workflows (#1651)
* Remove cache consumption in release workflow. * Tighten style-check.yml permissions * Tighten permissions in test workflow that consumes cache. * Use stricter permissions where possible --------- Co-authored-by: Justin Halsall <[email protected]>
1 parent 88ea2d0 commit dfb2991

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.github/workflows/ci-cd.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
77
jobs:
88
release:
99
name: Tests
10+
permissions:
11+
contents: read
1012
runs-on: ubuntu-22.04
1113
steps:
1214
- name: Checkout Repo

.github/workflows/release.yml

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ jobs:
1919
uses: actions/setup-node@v3
2020
with:
2121
node-version: lts/*
22-
cache: 'yarn'
2322

2423
- name: Install Dependencies
2524
run: yarn install --frozen-lockfile

.github/workflows/style-check.yml

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on: [push, pull_request_target]
55
jobs:
66
eslint_check_upload:
77
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
810
name: ESLint Check and Report Upload
911

1012
steps:
@@ -36,6 +38,8 @@ jobs:
3638
annotation:
3739
# Skip the annotation action in push events
3840
if: github.event_name == 'pull_request_target'
41+
permissions:
42+
checks: write
3943
needs: eslint_check_upload
4044
runs-on: ubuntu-latest
4145
name: ESLint Annotation
@@ -52,6 +56,8 @@ jobs:
5256
prettier_check:
5357
# In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness.
5458
if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb'
59+
permissions:
60+
contents: read
5561
runs-on: ubuntu-latest
5662
name: Format Check
5763
steps:
@@ -73,6 +79,8 @@ jobs:
7379
# Skip the format code action in forked PRs
7480
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb'
7581
runs-on: ubuntu-latest
82+
permissions:
83+
contents: write
7684
name: Format Code
7785
steps:
7886
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)