Skip to content

Commit eca7b2c

Browse files
decofehorsefacts
andauthored
ci: add least-privilege permissions and persist-credentials: false (#396)
- Add top-level permissions: contents: read to build.yml, docker.yml, docs-specs.yml, pr-audit.yml, release.yml - Add persist-credentials: false to all 17 actions/checkout steps - docker.yml gets top-level permissions since it's also a reusable workflow (workflow_call) Co-authored-by: horsefacts <[email protected]>
1 parent ab4364e commit eca7b2c

7 files changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
- "maxperf"
1313
- "profiling"
1414

15+
permissions:
16+
contents: read
17+
1518
concurrency:
1619
group: build-${{ github.head_ref }}
1720
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
@@ -30,6 +33,8 @@ jobs:
3033
binary: [tempo, tempo-bench, tempo-sidecar]
3134
steps:
3235
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
persist-credentials: false
3338
- uses: dtolnay/rust-toolchain@5d458579430fc14a04a08a1e7d3694f545e91ce6 # stable
3439
- uses: rui314/setup-mold@725a8794d15fc7563f59595bd9556495c0564878 # v1
3540
- uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9

.github/workflows/docker-profiling.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
steps:
2323
- name: Checkout repository
2424
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
persist-credentials: false
2527

2628
- uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
2729

.github/workflows/docker.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- cron: "5 9 * * *"
2020
- cron: "30 20 * * *"
2121

22+
permissions:
23+
contents: read
24+
2225
env:
2326
REGISTRY: ghcr.io/tempoxyz
2427

@@ -33,6 +36,8 @@ jobs:
3336
steps:
3437
- name: Checkout repository
3538
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+
with:
40+
persist-credentials: false
3641

3742
- uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
3843

.github/workflows/docs-specs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919
- "crates/tempo-zone/**"
2020
- ".github/workflows/docs-specs.yml"
2121

22+
permissions:
23+
contents: read
24+
2225
env:
2326
FOUNDRY_PROFILE: ci
2427
CARGO_TERM_COLOR: always
@@ -32,6 +35,7 @@ jobs:
3235
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3336
with:
3437
submodules: recursive
38+
persist-credentials: false
3539

3640
- name: Install Foundry
3741
uses: foundry-rs/foundry-toolchain@8789b3e21e6c11b2697f5eb56eddae542f746c10 # v1.7.0
@@ -50,6 +54,7 @@ jobs:
5054
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
5155
with:
5256
submodules: recursive
57+
persist-credentials: false
5358

5459
- name: Install Foundry
5560
uses: foundry-rs/foundry-toolchain@8789b3e21e6c11b2697f5eb56eddae542f746c10 # v1.7.0
@@ -65,6 +70,7 @@ jobs:
6570
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6671
with:
6772
submodules: recursive
73+
persist-credentials: false
6874

6975
- name: Install Foundry
7076
uses: foundry-rs/foundry-toolchain@8789b3e21e6c11b2697f5eb56eddae542f746c10 # v1.7.0
@@ -84,12 +90,14 @@ jobs:
8490
with:
8591
submodules: recursive
8692
path: tempo
93+
persist-credentials: false
8794

8895
- name: Checkout tempo-foundry
8996
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9097
with:
9198
repository: tempoxyz/tempo-foundry
9299
path: tempo-foundry
100+
persist-credentials: false
93101

94102
- name: Setup Rust
95103
uses: dtolnay/rust-toolchain@stable

.github/workflows/label-pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1616
with:
1717
fetch-depth: 0
18+
persist-credentials: false
1819

1920
- name: Label PRs
2021
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8

.github/workflows/pr-audit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
types: [labeled]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
audit:
912
uses: tempoxyz/gh-actions/.github/workflows/pr-audit.yml@main

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ on:
2525
default: false
2626
type: boolean
2727

28+
permissions:
29+
contents: read
30+
2831
env:
2932
CARGO_TERM_COLOR: always
3033
RUST_BACKTRACE: full
@@ -52,6 +55,8 @@ jobs:
5255
if: ${{ github.event.inputs.dry_run != 'true' }}
5356
steps:
5457
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
58+
with:
59+
persist-credentials: false
5560
- uses: dtolnay/rust-toolchain@stable
5661
- name: Verify crate version matches tag
5762
# Check that the Cargo version starts with the tag,
@@ -87,6 +92,8 @@ jobs:
8792
steps:
8893
- name: Checkout repository
8994
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
95+
with:
96+
persist-credentials: false
9097

9198
- name: Install Rust toolchain
9299
uses: dtolnay/rust-toolchain@stable
@@ -163,6 +170,7 @@ jobs:
163170
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
164171
with:
165172
fetch-depth: 0
173+
persist-credentials: false
166174

167175
- name: Download artifacts
168176
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -198,6 +206,7 @@ jobs:
198206
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
199207
with:
200208
fetch-depth: 0
209+
persist-credentials: false
201210

202211
- name: Download artifacts
203212
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1

0 commit comments

Comments
 (0)