Skip to content

Commit 6d76088

Browse files
committed
chore: Update GitHub Actions workflows to enhance permissions and checkout actions
- Added `permissions: read-all` to various workflows for improved access control. - Updated the `actions/checkout` version to v4 across all workflows for consistency and stability. - Removed outdated comments regarding permissions, streamlining the workflow files. These changes improve the clarity and functionality of the CI/CD processes, ensuring better adherence to security practices.
1 parent cbbf2f3 commit 6d76088

File tree

6 files changed

+32
-14
lines changed

6 files changed

+32
-14
lines changed

.github/workflows/changelog-update.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ on:
2323
- packages/**
2424
- .github/workflows/changelog-update.yml
2525

26+
permissions: read-all
27+
2628
jobs:
2729
update-changelog:
2830
runs-on: ubuntu-latest
2931
timeout-minutes: 10
3032

3133
if: github.event.pull_request.merged == true
3234

33-
# checkov:skip=CKV2_GHA_1:permissions:write-all is required for changelog updates to commit and push
3435
permissions:
3536
actions: read # Read-only access to workflow runs for changelog updates
3637
checks: read # Read-only access to check runs for changelog updates
@@ -46,7 +47,7 @@ jobs:
4647

4748
steps:
4849
- name: Checkout repository
49-
uses: actions/checkout@b4ffde65d8f02787b2c0e554639e0e5e24e7c8c1 # v6
50+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
5051
with:
5152
fetch-depth: 0 # Full history for git-cliff
5253
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ on:
1010
pull_request:
1111
branches: [main]
1212

13+
permissions: read-all
14+
1315
jobs:
1416
ci:
1517
runs-on: ubuntu-latest
1618
timeout-minutes: 15
1719

18-
# checkov:skip=CKV2_GHA_1:permissions:write-all is required for CI workflows to update commit statuses
1920
permissions:
2021
actions: read # Read-only access to workflow runs for CI
2122
checks: read # Read-only access to check runs
@@ -31,7 +32,7 @@ jobs:
3132

3233
steps:
3334
- name: Checkout repository
34-
uses: actions/checkout@b4ffde65d8f02787b2c0e554639e0e5e24e7c8c1 # v6
35+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
3536

3637
- name: Setup pnpm
3738
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ on:
5050
- v*.*.* # Matches v1.2.3
5151
workflow_dispatch: {}
5252

53+
permissions: read-all
54+
5355
jobs:
5456
release:
5557
runs-on: ubuntu-latest
5658
timeout-minutes: 20
5759

58-
# checkov:skip=CKV_GHA_3:contents:write is required for creating GitHub releases and pushing tags
5960
permissions:
6061
actions: read
6162
checks: read
@@ -71,7 +72,7 @@ jobs:
7172

7273
steps:
7374
- name: Checkout repository
74-
uses: actions/checkout@b4ffde65d8f02787b2c0e554639e0e5e24e7c8c1 # v6
75+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
7576
with:
7677
fetch-depth: 0 # Full history for changelog generation
7778

.github/workflows/reusable-setup.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# Provides reusable setup steps for Node.js, pnpm, and git-cliff
2-
# that can be called from other workflows to reduce duplication.
1+
# Reusable Setup Workflow
2+
#
3+
# Reusable workflow that can be called from other workflows to reduce duplication.
4+
# This workflow sets up the environment for the project, including Node.js, pnpm, and git-cliff.
35
#
46
# Usage:
57
# jobs:
@@ -35,12 +37,26 @@ on:
3537
type: number
3638
default: 0
3739

40+
permissions: read-all
41+
3842
jobs:
3943
setup:
4044
runs-on: ubuntu-latest
45+
permissions:
46+
actions: read
47+
checks: read
48+
contents: read
49+
deployments: none
50+
id-token: none
51+
issues: none
52+
packages: none
53+
pull-requests: none
54+
repository-projects: none
55+
security-events: none
56+
statuses: read
4157
steps:
4258
- name: Checkout repository
43-
uses: actions/checkout@b4ffde65d8f02787b2c0e554639e0e5e24e7c8c1 # v6
59+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
4460
with:
4561
fetch-depth: ${{ inputs.fetch-depth }}
4662

.github/workflows/version-bump.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ on:
3636
- scripts/bump-version.ts
3737
workflow_dispatch: {}
3838

39+
permissions: read-all
40+
3941
# Only run when PR is merged (not just closed) OR when manually triggered
4042
jobs:
4143
version-bump:
@@ -47,7 +49,6 @@ jobs:
4749
(github.event_name == 'workflow_dispatch') ||
4850
(github.event.pull_request.merged == true)
4951
50-
# checkov:skip=CKV_GHA_3:contents:write is required to commit and push version bumps
5152
permissions:
5253
actions: read
5354
checks: read
@@ -63,7 +64,7 @@ jobs:
6364

6465
steps:
6566
- name: Checkout repository
66-
uses: actions/checkout@b4ffde65d8f02787b2c0e554639e0e5e24e7c8c1 # v6
67+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
6768
with:
6869
fetch-depth: 0 # Full history for git-cliff
6970
token: ${{ secrets.GITHUB_TOKEN }}

.trunk/trunk.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ lint:
1313
enabled:
1414
1515
16-
17-
skip_checks:
18-
- CKV_GHA_3 # False positive: workflows legitimately need write permissions (statuses:write for CI, contents:write for releases/commits)
16+
1917
- git-diff-check
2018
2119

0 commit comments

Comments
 (0)