Skip to content

Commit 0d49d92

Browse files
committed
ci: explicitly set required permissions on GitHub Actions Workflows
The workflows currently have unlimited read/write permissions. This change sets all permissions to contents:read unless explicitly required by a specific action. Both the actions/create-release@v1 and rickstaa/action-create-tag@v1 actions need to make changes to the repo for release. Docs showing required permissions for creating releases and tags: https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps?apiVersion=2022-11-28#repository-permissions-for-contents This addresses https://github.com/alphagov/govuk-knowledge-graph-search/security/code-scanning/1.
1 parent 3f22ecb commit 0d49d92

5 files changed

Lines changed: 12 additions & 4 deletions

File tree

.github/workflows/actionlint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Lint GitHub Actions
2+
permissions:
3+
contents: read
24
on:
35
push:
46
paths: ['.github/**']

.github/workflows/check-code-hygiene.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Code Hygiene
2-
2+
permissions:
3+
contents: read
34
on:
45
pull_request:
56
branches:

.github/workflows/check-test-coverage.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Jest Coverage Check
2-
32
on:
43
push:
54
branches: [main]
@@ -11,6 +10,10 @@ jobs:
1110
name: Jest Test with Coverage Check
1211
runs-on: ubuntu-latest
1312

13+
permissions:
14+
contents: read
15+
actions: write
16+
1417
steps:
1518
- name: Check out code
1619
uses: actions/checkout@v4

.github/workflows/production-deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Deploy Production
2-
2+
permissions:
3+
contents: read
34
on:
45
workflow_dispatch:
56
inputs:

.github/workflows/staging-deploy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Deploy Staging
2-
2+
permissions:
3+
contents: read
34
on:
45
workflow_dispatch:
56
push:

0 commit comments

Comments
 (0)