Skip to content

Commit 1c173f1

Browse files
authored
Tighten GHA permissions (#7348)
1 parent 2c23982 commit 1c173f1

11 files changed

Lines changed: 59 additions & 40 deletions

File tree

.github/workflows/README.md

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Documents the various GitHub Actions workflows, the role they fulfil and 3rd party dependencies if any.
1+
Documents the various GitHub Actions workflows, the role they fulfill and 3rd party (i.e. outside of https://github.com/actions/) dependencies if any.
22

3-
# Bencher
3+
# Maintained
4+
5+
## Bencher
46

57
Builds and runs CCF performance tests, both end to end and micro-benchmarks. Results are posted to bencher.dev, and [plotted to make regressions obvious](https://bencher.dev/console/projects/ccf/plots).
68
Triggered on every commit on `main`, but not on PR builds because the setup required to build from forks is complex and fragile in terms of security, and the increase in pool usage would be substantial.
@@ -12,18 +14,14 @@ File: `bencher.yml`
1214

1315
- `bencherdev/bencher@main`
1416

15-
# Continuous Integration Containers GHCR
17+
## Bencher A/B
1618

17-
Produces the build images used by CI and release workflows between 5.0.0-rc0 and 6.0.0 (excluded). Complete images are attested and published to GHCR. Triggered on label creation (`build/*`).
19+
Builds and runs CCF performance tests, and perform a comparison to main. Triggered on PRs that have the label `bench-ab`.
1820

19-
File: `ci-containers-ghcr.yml`
21+
File: `bencher-ab.yml`
2022
3rd party dependencies:
2123

22-
- `docker/login-action@v3`
23-
- `docker/metadata-action@v5`
24-
- `docker/build-push-action@v6`
25-
26-
Note: This job is being kept until 5.0.x goes out of support.
24+
- `bencherdev/bencher@main`
2725

2826
# Continuous Integration
2927

@@ -76,18 +74,12 @@ Produces CCF reference release artefacts from 5.0.0-rc0 onwards, for all languag
7674
File: `release.yml`
7775
3rd party dependencies: None
7876

79-
# Containers GHCR
80-
81-
Produces reference release images for 5.x release versions. Not used from 6.0.0 onwards. Complete images are attested and published to GHCR. Triggered on release publishing.
82-
83-
File: `containers-ghcr.yml`
84-
3rd party dependencies:
77+
# Release Attestation
8578

86-
- `docker/login-action@v3`
87-
- `docker/metadata-action@v5`
88-
- `docker/build-push-action@v6`
79+
Generate signed build provenance attestations for release artifacts. Triggered by release creation.
8980

90-
Note: This job is being kept until 5.0.x goes out of support.
81+
File: `release-attestation.yml`
82+
3rd party dependencies: None
9183

9284
# NPM
9385

@@ -111,3 +103,27 @@ File: `doc.yml`
111103
3rd party dependencies:
112104

113105
- peaceiris/actions-gh-pages@v3
106+
107+
# Mothballed Actions
108+
109+
## Continuous Integration Containers GHCR
110+
111+
Produces the build images used by CI and release workflows for 5.x releases. Complete images are attested and published to GHCR. Triggered on label creation (`build/*`).
112+
113+
File: `ci-containers-ghcr.yml`
114+
3rd party dependencies:
115+
116+
- `docker/login-action@v3`
117+
- `docker/metadata-action@v5`
118+
- `docker/build-push-action@v6`
119+
120+
## Containers GHCR
121+
122+
Produces reference release images for 5.x release versions. Not used from 6.0.0 onwards. Complete images are attested and published to GHCR. Triggered on release publishing.
123+
124+
File: `containers-ghcr.yml`
125+
3rd party dependencies:
126+
127+
- `docker/login-action@v3`
128+
- `docker/metadata-action@v5`
129+
- `docker/build-push-action@v6`

.github/workflows/bencher-ab.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- opened
1212
- reopened
1313

14+
permissions: read-all
15+
1416
jobs:
1517
benchmark_pr:
1618
name: Benchmark PR

.github/workflows/bencher.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
- main
99
workflow_dispatch:
1010

11+
permissions: read-all
12+
1113
jobs:
1214
benchmark_virtual:
1315
name: Benchmark Virtual

.github/workflows/ci-verification.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
cancel-in-progress: true
1616

17-
permissions:
18-
actions: read
19-
contents: read
20-
security-events: write
17+
permissions: read-all
2118

2219
jobs:
2320
model-checking-consistency:

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: ${{ !contains(github.ref, 'main')}}
1313

14-
permissions:
15-
contents: read
16-
actions: read
17-
checks: write
14+
permissions: read-all
1815

1916
jobs:
2017
checks:

.github/workflows/doc.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- main
77
workflow_dispatch:
88

9+
permissions: read-all
10+
911
jobs:
1012
build:
1113
name: Build
@@ -56,15 +58,15 @@ jobs:
5658
with:
5759
path: build/html
5860

59-
# This is purposefully separate to keep the scope with
60-
# with the permissions to deploy to a minimum.
6161
deploy:
6262
name: Deploy
6363
needs: build
6464
runs-on: ubuntu-latest
6565
permissions:
66-
contents: read
66+
# Needed to authorize deployment to GitHub Pages
6767
pages: write
68+
# Needed to authenticate via OIDC
69+
# See https://github.com/actions/deploy-pages?tab=readme-ov-file#usage
6870
id-token: write
6971
environment:
7072
name: github-pages

.github/workflows/long-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- cron: "0 0 * * 1-5"
1212
workflow_dispatch:
1313

14+
permissions: read-all
15+
1416
jobs:
1517
long-asan:
1618
if: ${{ contains(github.event.pull_request.labels.*.name, 'run-long-test') || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'}}

.github/workflows/long-verification.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ on:
1111
- cron: "0 0 * * 0"
1212
workflow_dispatch:
1313

14-
permissions:
15-
actions: read
16-
contents: read
17-
security-events: write
14+
permissions: read-all
1815

1916
jobs:
2017
model-checking-with-atomic-reconfig-consensus:

.github/workflows/pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
python3 -m venv env
3333
source ./env/bin/activate
3434
pip install twine
35-
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} *.whl
35+
twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --skip-existing *.whl

.github/workflows/release-attestation.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ on:
1010
required: true
1111
type: string
1212

13+
permissions: read-all
14+
1315
jobs:
1416
attest-release-assets:
1517
runs-on: ubuntu-latest
1618
permissions:
1719
contents: read
20+
# Necessary to persist attestations
1821
attestations: write
22+
# OIDC authentication is needed to produce the attestation
23+
# See https://github.com/actions/attest-build-provenance?tab=readme-ov-file#usage
1924
id-token: write
2025
steps:
2126
- name: Download release assets

0 commit comments

Comments
 (0)