Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 04d39a3

Browse files
authored
Setup cargo-deny (#2638)
Using [`cargo-deny`](https://embarkstudios.github.io/cargo-deny/) to ensure that disallowed dependencies removed in #2423 do not accidentally make their way back in. `cargo-deny` subsumes the `cargo-audit` functionality, so switch to the `cargo-deny` version. Setting this up required explicitly stating the license which was not in some of our `Cargo.toml` files.
1 parent 894dcc6 commit 04d39a3

File tree

10 files changed

+48
-15
lines changed

10 files changed

+48
-15
lines changed

.devcontainer/install-dependencies.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -eux
55
# Note that this script runs as user 'vscode' during devcontainer setup.
66

77
# Rust global tools, needed to run CI scripts
8-
"$HOME/.cargo/bin/cargo" install cargo-audit cargo-[email protected] cargo-llvm-cov
8+
"$HOME/.cargo/bin/cargo" install [email protected] cargo-llvm-cov cargo-deny
99
"$HOME/.cargo/bin/rustup" component add llvm-tools-preview
1010

1111
# NPM global tools

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
CARGO_TERM_COLOR: always
1919
SCCACHE_DIR: ${{github.workspace}}/sccache/
2020
SCCACHE_CACHE_SIZE: 1G
21-
ACTIONS_CACHE_KEY_DATE: 2022-10-28-01
21+
ACTIONS_CACHE_KEY_DATE: 2022-11-21-02
2222
CI: true
2323
DOTNET_VERSION: 7.0.x
2424

src/agent/dynamic-library/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "dynamic-library"
33
version = "0.1.0"
44
edition = "2021"
5+
license = "MIT"
56

67
[dependencies]
78
anyhow = "1.0"
@@ -26,7 +27,7 @@ features = [
2627
"shellapi",
2728
"werapi",
2829
"winbase",
29-
"winerror"
30+
"winerror",
3031
]
3132

3233
[[bin]]

src/agent/onefuzz-agent/Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "0.1.0"
44
authors = ["[email protected]"]
55
edition = "2018"
66
publish = false
7+
license = "MIT"
78

89
[dependencies]
910
anyhow = { version = "1.0", features = ["backtrace"] }
@@ -13,7 +14,11 @@ env_logger = "0.9"
1314
futures = "0.3"
1415
log = "0.4"
1516
onefuzz = { path = "../onefuzz" }
16-
reqwest = { version = "0.11", features = ["json", "stream", "native-tls-vendored"], default-features = false}
17+
reqwest = { version = "0.11", features = [
18+
"json",
19+
"stream",
20+
"native-tls-vendored",
21+
], default-features = false }
1722
serde = { version = "1.0", features = ["derive"] }
1823
serde_json = "1.0"
1924
storage-queue = { path = "../storage-queue" }

src/agent/stacktrace-parser/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name = "stacktrace-parser"
33
version = "0.1.0"
44
authors = ["<[email protected]>"]
55
edition = "2018"
6+
license = "MIT"
67

78
[dependencies]
89
anyhow = "1.0"

src/ci/agent.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ cd src/agent
3737

3838
rustc --version
3939
cargo --version
40-
cargo audit --version
40+
cargo deny --version
4141
cargo clippy --version
4242
cargo fmt --version
4343
cargo license --version
@@ -48,9 +48,7 @@ if [ X${CARGO_INCREMENTAL} == X ]; then
4848
fi
4949

5050
cargo fmt -- --check
51-
# RUSTSEC-2022-0048: xml-rs is unmaintained
52-
# RUSTSEC-2021-0139: ansi_term is unmaintained
53-
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
51+
cargo deny -L error check
5452
cargo license -j > data/licenses.json
5553
cargo build --release --locked
5654
cargo clippy --release --locked --all-targets -- -D warnings

src/ci/proxy.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ mkdir -p artifacts/proxy
1212
cd src/proxy-manager
1313
cargo fmt -- --check
1414
cargo clippy --release --all-targets -- -D warnings
15-
# RUSTSEC-2022-0048: xml-rs is unmaintained
16-
# RUSTSEC-2021-0139: ansi_term is unmaintained
17-
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2022-0048 --ignore RUSTSEC-2021-0139
15+
cargo deny -L error check
1816
cargo license -j > data/licenses.json
1917
cargo build --release --locked
2018
# export RUST_LOG=trace
2119
export RUST_BACKTRACE=full
22-
cargo test --release
20+
cargo test --release --locked
2321

2422
cp target/release/onefuzz-proxy-manager ../../artifacts/proxy

src/ci/rust-prereqs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111
# sccache --start-server
1212
# export RUSTC_WRAPPER=$(which sccache)
1313

14-
cargo install cargo-audit cargo-llvm-cov
14+
cargo install cargo-llvm-cov cargo-deny
1515

1616
if ! cargo license --help; then
1717
cargo install [email protected]

src/deny.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[licenses]
2+
allow = [
3+
"Apache-2.0 WITH LLVM-exception",
4+
"Apache-2.0",
5+
"BSD-3-Clause",
6+
"CC0-1.0",
7+
"ISC",
8+
"MIT",
9+
"Zlib",
10+
]
11+
12+
[advisories]
13+
vulnerability = "deny"
14+
unmaintained = "deny"
15+
unsound = "deny"
16+
yanked = "deny"
17+
ignore = [
18+
"RUSTSEC-2022-0048", # xml-rs is unmaintained
19+
"RUSTSEC-2021-0139", # ansi_term is unmaintained
20+
]
21+
22+
[bans]
23+
24+
# disallow rustls; we must use OpenSSL
25+
[[bans.deny]]
26+
name = "rustls"
27+
28+
# disallow ring; unapproved crypto
29+
[[bans.deny]]
30+
name = "ring"

src/proxy-manager/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)