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 <Juice10@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/ci-cd.yml
vendored
2
.github/workflows/ci-cd.yml
vendored
@@ -7,6 +7,8 @@ concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Tests
|
name: Tests
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
|
|||||||
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@@ -19,7 +19,6 @@ jobs:
|
|||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
cache: 'yarn'
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|||||||
8
.github/workflows/style-check.yml
vendored
8
.github/workflows/style-check.yml
vendored
@@ -5,6 +5,8 @@ on: [push, pull_request_target]
|
|||||||
jobs:
|
jobs:
|
||||||
eslint_check_upload:
|
eslint_check_upload:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
name: ESLint Check and Report Upload
|
name: ESLint Check and Report Upload
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -36,6 +38,8 @@ jobs:
|
|||||||
annotation:
|
annotation:
|
||||||
# Skip the annotation action in push events
|
# Skip the annotation action in push events
|
||||||
if: github.event_name == 'pull_request_target'
|
if: github.event_name == 'pull_request_target'
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
needs: eslint_check_upload
|
needs: eslint_check_upload
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: ESLint Annotation
|
name: ESLint Annotation
|
||||||
@@ -52,6 +56,8 @@ jobs:
|
|||||||
prettier_check:
|
prettier_check:
|
||||||
# In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness.
|
# In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness.
|
||||||
if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb'
|
if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb'
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Format Check
|
name: Format Check
|
||||||
steps:
|
steps:
|
||||||
@@ -73,6 +79,8 @@ jobs:
|
|||||||
# Skip the format code action in forked PRs
|
# Skip the format code action in forked PRs
|
||||||
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb'
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
name: Format Code
|
name: Format Code
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|||||||
Reference in New Issue
Block a user