Skip to content

Commit 9586527

Browse files
committed
Run cargo audit on committed Cargo.lock
The current audit action regenerates the lock file which may hide vulnerabilities in our binaries. Ensure binaries are built with committed lock file by adding the `--locked` flag. Note the `--locked` flag is currently documented in a confusing way in `cargo --help`. A fix for that has been merged into cargo recently: rust-lang/cargo#13665
1 parent 3de89b7 commit 9586527

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

.github/workflows/audit.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ jobs:
2626
uses: ./.github/actions/install-capnp
2727

2828
# See https://github.com/rustsec/audit-check for docs
29-
- uses: rustsec/audit-check@v1
30-
with:
31-
token: ${{ secrets.GITHUB_TOKEN }}
29+
# TODO: re-enable if https://github.com/rustsec/audit-check/pull/20 is merged
30+
# - uses: rustsec/audit-check@v1
31+
# with:
32+
# token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
# Currently the rustsec/audit-check action regenerates the Cargo.lock
35+
# file. Our binaries are built using the committed lock file.
36+
# Re-generating the lock file can hide vulnerabilities. We therefore run
37+
# cargo audit directly which respects our lock file.
38+
- run: cargo audit

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Build
5454
# Build in release without `testing` feature, this should work without `hotshot_example` config.
5555
run: |
56-
cargo build --release --workspace
56+
cargo build --locked --release --workspace
5757
5858
- name: Upload artifacts
5959
uses: actions/upload-artifact@v3
@@ -98,7 +98,7 @@ jobs:
9898

9999
- name: Build
100100
run: |
101-
cargo build --release --workspace
101+
cargo build --locked --release --workspace
102102
103103
- name: Upload artifacts
104104
uses: actions/upload-artifact@v3

.github/workflows/build_static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Compile all executables
6969
# timeout-minutes: 120
7070
run: |
71-
nix develop $DEVSHELL --accept-flake-config --option sandbox relaxed -c cargo build --release
71+
nix develop $DEVSHELL --accept-flake-config --option sandbox relaxed -c cargo build --locked --release
7272
7373
- name: Upload artifacts
7474
uses: actions/upload-artifact@v3

.github/workflows/contracts.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
7474
- name: Build diff-test
7575
run: |
76-
nix develop --accept-flake-config -c cargo build --bin diff-test --release
76+
nix develop --accept-flake-config -c cargo build --locked --bin diff-test --release
7777
7878
- name: Run tests (quick version for PR)
7979
if: ${{ github.event_name == 'pull_request' }}
@@ -85,4 +85,3 @@ jobs:
8585
if: ${{ github.event_name != 'pull_request' }}
8686
run: |
8787
nix develop --accept-flake-config -c forge test -vvv
88-

.github/workflows/test-demo-native.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: ./.github/actions/install-capnp
4848

4949
- name: Build
50-
run: cargo build --release
50+
run: cargo build --locked --release
5151

5252
- name: Test Demo
5353
run: |

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install Foundry
3333
uses: foundry-rs/foundry-toolchain@v1
3434
with:
35-
version: nightly-2cb875799419c907cc3709e586ece2559e6b340e # Not using the default version because likely of this bug https://github.com/foundry-rs/foundry/issues/7120
35+
version: nightly-2cb875799419c907cc3709e586ece2559e6b340e # Not using the default version because likely of this bug https://github.com/foundry-rs/foundry/issues/7120
3636

3737
- name: Install just command runner
3838
run: |
@@ -55,7 +55,7 @@ jobs:
5555
run: |
5656
export RUSTFLAGS="$RUSTFLAGS --cfg hotshot_example"
5757
export PATH="$PWD/target/release:$PATH"
58-
cargo build --bin diff-test --release
58+
cargo build --locked --bin diff-test --release
5959
cargo test --release --workspace --all-features --no-run
6060
cargo test --release --workspace --all-features --verbose -- --test-threads 1 --nocapture
6161
timeout-minutes: 30

0 commit comments

Comments
 (0)