Skip to content

Commit 64a7440

Browse files
authored
chore(ci): harden workflow permissions and gate releases to owner (#211)
1 parent 4574c84 commit 64a7440

6 files changed

Lines changed: 21 additions & 13 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
benchmark:
2124
name: Benchmark

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1919
cancel-in-progress: ${{ github.ref_name != 'main' }}
2020

21+
permissions:
22+
contents: read
23+
2124
defaults:
2225
run:
2326
shell: bash

.github/workflows/codecov.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}-${{ github.ref }}
1717
cancel-in-progress: ${{ github.ref_name != 'main' }}
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
coverage:
2124
name: Code Coverage

.github/workflows/release-npm.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ on:
3434
required: false
3535
default: true
3636

37-
permissions:
38-
# To publish packages with provenance
39-
id-token: write
40-
# Allow commenting on issues for `reusable-build.yml`
41-
issues: write
37+
permissions: {}
4238

4339
jobs:
4440
build:
@@ -65,6 +61,8 @@ jobs:
6561
- target: aarch64-apple-darwin
6662
runner: "macos-latest"
6763

64+
permissions:
65+
contents: read
6866
uses: ./.github/workflows/reusable-build.yml
6967
with:
7068
target: ${{ matrix.array.target }}
@@ -77,8 +75,9 @@ jobs:
7775
name: Release
7876
environment: npm
7977
permissions:
78+
# push release tag via scripts/x.mjs publish --push-tags
8079
contents: write
81-
# To publish packages with provenance
80+
# OIDC provenance for npm publish
8281
id-token: write
8382
runs-on: ubuntu-latest
8483
needs: build

.github/workflows/release-plz.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ on:
1313
required: false
1414
default: false
1515

16-
permissions:
17-
# trust publish needs
18-
id-token: write
19-
# push tag
20-
contents: write
16+
permissions: {}
2117

2218
jobs:
2319
release-plz:
2420
name: Release-plz
2521
runs-on: ubuntu-latest
2622
environment: crate
23+
permissions:
24+
# OIDC trusted publishing to crates.io
25+
id-token: write
26+
# push release tag
27+
contents: write
2728
steps:
2829
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2930
with:

.github/workflows/reusable-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ env:
3535
CARGO_INCREMENTAL: 0
3636

3737
permissions:
38-
# Allow commenting on issues
39-
issues: write
38+
contents: read
4039

4140
jobs:
4241
build:

0 commit comments

Comments
 (0)