Skip to content

Commit dec76a5

Browse files
[StepSecurity] ci: Harden GitHub Actions (#80)
Signed-off-by: StepSecurity Bot <[email protected]>
1 parent 6ab1106 commit dec76a5

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

.github/workflows/check.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@ jobs:
2929
runs-on: ubuntu-latest
3030

3131
steps:
32+
- name: Harden the runner (Audit all outbound calls)
33+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
34+
with:
35+
egress-policy: audit
36+
3237
- name: Fetch Repository
3338
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
3439

3540
- name: Install stable toolchain
36-
uses: actions-rust-lang/setup-rust-toolchain@v1
41+
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
3742

3843
- name: cargo build
3944
run: cargo b --locked --all-targets --all-features
@@ -43,11 +48,16 @@ jobs:
4348
runs-on: ubuntu-latest
4449

4550
steps:
51+
- name: Harden the runner (Audit all outbound calls)
52+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
53+
with:
54+
egress-policy: audit
55+
4656
- name: Fetch Repository
4757
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
4858

4959
- name: Install stable toolchain
50-
uses: actions-rust-lang/setup-rust-toolchain@v1
60+
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
5161
with:
5262
components: rustfmt
5363
toolchain: nightly
@@ -60,11 +70,16 @@ jobs:
6070
runs-on: ubuntu-latest
6171

6272
steps:
73+
- name: Harden the runner (Audit all outbound calls)
74+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
75+
with:
76+
egress-policy: audit
77+
6378
- name: Fetch Repository
6479
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
6580

6681
- name: Install stable toolchain
67-
uses: actions-rust-lang/setup-rust-toolchain@v1
82+
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
6883
with:
6984
components: clippy
7085

@@ -76,8 +91,13 @@ jobs:
7691
runs-on: ubuntu-latest
7792

7893
steps:
94+
- name: Harden the runner (Audit all outbound calls)
95+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
96+
with:
97+
egress-policy: audit
98+
7999
- name: Fetch Repository
80100
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
81101

82102
- name: Check spelling of files in the workspace
83-
uses: crate-ci/typos@v1
103+
uses: crate-ci/typos@0c17dabcee8b8f1957fa917d17393a23e02e1583 # v1.36.3

.github/workflows/publish.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ jobs:
2121
name: Publish event-scanner on crates.io
2222
runs-on: ubuntu-latest
2323
steps:
24+
- name: Harden the runner (Audit all outbound calls)
25+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
26+
with:
27+
egress-policy: audit
28+
2429
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
2530

2631
- name: Install rust
27-
uses: actions-rust-lang/setup-rust-toolchain@v1
32+
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
2833

2934
- name: Verify tag matches crate version
3035
id: version-check

.github/workflows/test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,30 @@ jobs:
1919
runs-on: ubuntu-latest
2020

2121
steps:
22+
- name: Harden the runner (Audit all outbound calls)
23+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
24+
with:
25+
egress-policy: audit
26+
2227
- name: Fetch Repository
2328
uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
2429

2530
- name: Install stable toolchain
26-
uses: actions-rust-lang/setup-rust-toolchain@v1
31+
uses: actions-rust-lang/setup-rust-toolchain@02be93da58aa71fb456aa9c43b301149248829d8 # v1.15.1
2732

2833
- name: Install Foundry
29-
uses: foundry-rs/foundry-toolchain@v1
34+
uses: foundry-rs/foundry-toolchain@82dee4ba654bd2146511f85f0d013af94670c4de # v1.4.0
3035

3136
- name: Cache cargo-nextest binary
3237
id: cache-cargo-nextest
33-
uses: actions/cache@v4
38+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3439
with:
3540
path: ~/.cargo/bin/cargo-nextest
3641
key: ${{ runner.os }}-cargo-nextest-${{ hashFiles('**/Cargo.lock') }}
3742

3843
- name: Install cargo-nextest
3944
if: steps.cache-cargo-nextest.outputs.cache-hit != 'true'
40-
uses: taiki-e/install-action@v2
45+
uses: taiki-e/install-action@71d339ebf191fcbc3d49cd04b9484a4261f29975 # v2.62.9
4146
with:
4247
tool: cargo-nextest
4348

0 commit comments

Comments
 (0)