Skip to content

Commit af58509

Browse files
yannsbnjjj
andauthored
deps: Use nu-ansi-term to replace unmaintained ansi_term (#2844)
Partially fixes https://rustsec.org/advisories/RUSTSEC-2021-0139 `clap` is still depending on [ansi_term](https://github.com/ogham/rust-ansi-term). cargo audit before the change: ``` Crate: ansi_term Version: 0.12.1 Warning: unmaintained Title: ansi_term is Unmaintained Date: 2021-08-18 ID: RUSTSEC-2021-0139 URL: https://rustsec.org/advisories/RUSTSEC-2021-0139 Dependency tree: ansi_term 0.12.1 ├── clap 2.34.0 │ ├── structopt 0.3.26 │ │ └── cargo-scaffold 0.8.7 │ │ └── apollo-router-scaffold 1.12.1 │ └── cargo-scaffold 0.8.7 └── apollo-router 1.12.1 ├── throw-error 0.1.0 ├── supergraph_sdl 0.1.0 ├── rhai-surrogate-cache-key 0.1.0 ├── rhai-subgraph-request-log 0.1.0 ├── rhai-logging 0.1.0 ├── rhai-error-response-mutate 0.1.0 ├── rhai-data-response-mutate 0.1.0 ├── propagate-status-code 0.1.0 ├── op-name-to-header 0.1.0 ├── jwt-claims 0.1.0 ├── hello-world 0.1.0 ├── forbid_anonymous_operations_rhai 0.1.0 ├── forbid-anonymous-operations 0.1.0 ├── external-subgraph 0.1.0 ├── cookies-to-headers 0.1.0 ├── context-data 0.1.0 ├── async-allow-client-id 0.1.0 ├── apollo-router-benchmarks 1.12.1 └── add-timestamp-header 0.1.0 ``` cargo audit after the change: ``` Crate: ansi_term Version: 0.12.1 Warning: unmaintained Title: ansi_term is Unmaintained Date: 2021-08-18 ID: RUSTSEC-2021-0139 URL: https://rustsec.org/advisories/RUSTSEC-2021-0139 Dependency tree: ansi_term 0.12.1 └── clap 2.34.0 ├── structopt 0.3.26 │ └── cargo-scaffold 0.8.7 │ └── apollo-router-scaffold 1.12.1 └── cargo-scaffold 0.8.7 ``` Co-authored-by: Coenen Benjamin <[email protected]>
1 parent c541edf commit af58509

File tree

6 files changed

+26
-17
lines changed

6 files changed

+26
-17
lines changed

Cargo.lock

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ name = "apollo-router"
275275
version = "1.15.1"
276276
dependencies = [
277277
"access-json",
278-
"ansi_term",
279278
"anyhow",
280279
"apollo-compiler",
281280
"apollo-parser 0.5.1",
@@ -334,6 +333,7 @@ dependencies = [
334333
"multer",
335334
"multimap",
336335
"notify",
336+
"nu-ansi-term 0.47.0",
337337
"once_cell",
338338
"opentelemetry",
339339
"opentelemetry-datadog",
@@ -3536,6 +3536,15 @@ dependencies = [
35363536
"winapi 0.3.9",
35373537
]
35383538

3539+
[[package]]
3540+
name = "nu-ansi-term"
3541+
version = "0.47.0"
3542+
source = "registry+https://github.com/rust-lang/crates.io-index"
3543+
checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76"
3544+
dependencies = [
3545+
"windows-sys 0.45.0",
3546+
]
3547+
35393548
[[package]]
35403549
name = "num"
35413550
version = "0.4.0"
@@ -6276,7 +6285,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
62766285
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
62776286
dependencies = [
62786287
"matchers",
6279-
"nu-ansi-term",
6288+
"nu-ansi-term 0.46.0",
62806289
"once_cell",
62816290
"regex",
62826291
"serde",

apollo-router/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ features = ["docs_rs"]
4040
askama = "0.11.1"
4141
access-json = "0.1.0"
4242
anyhow = "1.0.68"
43-
ansi_term = "0.12"
4443
apollo-compiler = "0.8.0"
4544
apollo-parser = "0.5.1"
4645
arc-swap = "1.6.0"
@@ -104,6 +103,7 @@ multer = "2.0.4"
104103
multimap = "0.8.3"
105104
# To avoid tokio issues
106105
notify = { version = "5.1.0", default-features = false, features=["macos_kqueue"] }
106+
nu-ansi-term = "0.47"
107107
once_cell = "1.16.0"
108108

109109
# Any package that starts with `opentelemetry` needs to be updated with care

apollo-router/src/plugins/telemetry/formatters/text.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt;
22

3-
use ansi_term::Color;
4-
use ansi_term::Style;
3+
use nu_ansi_term::Color;
4+
use nu_ansi_term::Style;
55
use opentelemetry::trace::TraceContextExt;
66
use tracing_core::Event;
77
use tracing_core::Level;

xtask/Cargo.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ dependencies = [
2626
"libc",
2727
]
2828

29-
[[package]]
30-
name = "ansi_term"
31-
version = "0.12.1"
32-
source = "registry+https://github.com/rust-lang/crates.io-index"
33-
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
34-
dependencies = [
35-
"winapi",
36-
]
37-
3829
[[package]]
3930
name = "anstream"
4031
version = "0.2.6"
@@ -1107,6 +1098,15 @@ dependencies = [
11071098
"windows-sys 0.45.0",
11081099
]
11091100

1101+
[[package]]
1102+
name = "nu-ansi-term"
1103+
version = "0.47.0"
1104+
source = "registry+https://github.com/rust-lang/crates.io-index"
1105+
checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76"
1106+
dependencies = [
1107+
"windows-sys 0.45.0",
1108+
]
1109+
11101110
[[package]]
11111111
name = "num-bigint"
11121112
version = "0.4.3"
@@ -2604,7 +2604,6 @@ dependencies = [
26042604
name = "xtask"
26052605
version = "1.5.0"
26062606
dependencies = [
2607-
"ansi_term",
26082607
"anyhow",
26092608
"base64 0.20.0",
26102609
"camino",
@@ -2619,6 +2618,7 @@ dependencies = [
26192618
"itertools",
26202619
"libc",
26212620
"memorable-wordlist",
2621+
"nu-ansi-term",
26222622
"octorust",
26232623
"once_cell",
26242624
"regex",

xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ license = "LicenseRef-ELv2"
99
publish = false
1010

1111
[dependencies]
12-
ansi_term = "0.12"
1312
anyhow = "1"
1413
base64 = "0.20"
1514
camino = "1"
@@ -24,6 +23,7 @@ git2 = { version = "0.16.1", features = ["vendored-openssl"] }
2423
itertools = "0.10.5"
2524
libc = "0.2"
2625
memorable-wordlist = "0.1.7"
26+
nu-ansi-term = "0.47"
2727
octorust = "0.2.2"
2828
once_cell = "1"
2929
regex="1.7.1"

xtask/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
mod commands;
22

3-
use ansi_term::Colour::Green;
43
use anyhow::Result;
54
use clap::Parser;
5+
use nu_ansi_term::Color::Green;
66

77
fn main() -> Result<()> {
88
let app = Xtask::parse();

0 commit comments

Comments
 (0)