Skip to content

Commit ff1afa5

Browse files
committed
fix(cactus-core-api): address CVE-2021-38192 - GHSA-x4qm-mcjq-v2gf
Performs a minor semver upgrades to tonic, tonic-build and prost so that the vulnerable version of prost-types is no longer in the dependency tree. Fixes #2612 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 2813b75 commit ff1afa5

File tree

8 files changed

+606
-633
lines changed

8 files changed

+606
-633
lines changed

packages/cactus-core-api/Cargo.lock

+290-426
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cactus-core-api/Cargo.toml

+3-10
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,13 @@ path = "src/main/rust/pb.rs"
1010

1111

1212
[dependencies]
13-
tonic = {version="0.2", features = ["tls"]}
14-
prost = "0.6"
13+
tonic = {version="0.6.2", features = ["tls"]}
14+
prost = "0.9"
1515
tokio = { version = "1.18", features = ["macros", "fs"] }
1616
serde = {version="1.0.110", features = ["derive"]}
1717

18-
# These upgraded versions compile fine as well, so we should upgrade them
19-
# in the future:
20-
# tonic = {version="0.6.2", features = ["tls"]}
21-
# prost = "0.9"
22-
# tokio = { version = "1.15.0", features = ["macros", "fs"] }
23-
# serde = {version="1.0.110", features = ["derive"]}
24-
2518
[build-dependencies]
26-
tonic-build = "0.2"
19+
tonic-build = "0.6.2"
2720

2821

2922

packages/cactus-core-api/src/main/rust/generated/proto-rs/common.ack.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,32 @@
11
/// This message respresents "ACKs" sent between relay-relay,
22
/// relay-driver and relay-network
3-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
3+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
44
pub struct Ack {
55
#[prost(enumeration = "ack::Status", tag = "2")]
66
pub status: i32,
77
#[prost(string, tag = "3")]
8-
pub request_id: std::string::String,
8+
pub request_id: ::prost::alloc::string::String,
99
/// an error can have an associated string
1010
/// this is the best way to represent this in protobuf
1111
#[prost(string, tag = "4")]
12-
pub message: std::string::String,
12+
pub message: ::prost::alloc::string::String,
1313
}
14+
/// Nested message and enum types in `Ack`.
1415
pub mod ack {
15-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
16+
#[derive(
17+
serde::Serialize,
18+
serde::Deserialize,
19+
Clone,
20+
Copy,
21+
Debug,
22+
PartialEq,
23+
Eq,
24+
Hash,
25+
PartialOrd,
26+
Ord,
27+
::prost::Enumeration,
28+
)]
1629
#[repr(i32)]
17-
#[derive(serde::Serialize, serde::Deserialize)]
1830
pub enum Status {
1931
Ok = 0,
2032
Error = 1,
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/// the payload to define the data that is being requested
2-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
2+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
33
pub struct Query {
44
#[prost(string, repeated, tag = "1")]
5-
pub policy: ::std::vec::Vec<std::string::String>,
5+
pub policy: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
66
#[prost(string, tag = "2")]
7-
pub address: std::string::String,
7+
pub address: ::prost::alloc::string::String,
88
#[prost(string, tag = "3")]
9-
pub requesting_relay: std::string::String,
9+
pub requesting_relay: ::prost::alloc::string::String,
1010
#[prost(string, tag = "4")]
11-
pub requesting_network: std::string::String,
11+
pub requesting_network: ::prost::alloc::string::String,
1212
#[prost(string, tag = "5")]
13-
pub certificate: std::string::String,
13+
pub certificate: ::prost::alloc::string::String,
1414
#[prost(string, tag = "6")]
15-
pub requestor_signature: std::string::String,
15+
pub requestor_signature: ::prost::alloc::string::String,
1616
#[prost(string, tag = "7")]
17-
pub nonce: std::string::String,
17+
pub nonce: ::prost::alloc::string::String,
1818
#[prost(string, tag = "8")]
19-
pub request_id: std::string::String,
19+
pub request_id: ::prost::alloc::string::String,
2020
#[prost(string, tag = "9")]
21-
pub requesting_org: std::string::String,
21+
pub requesting_org: ::prost::alloc::string::String,
2222
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// Metadata for a View
2-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
2+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
33
pub struct Meta {
44
/// Underlying distributed ledger protocol.
55
#[prost(enumeration = "meta::Protocol", tag = "1")]
@@ -8,67 +8,92 @@ pub struct Meta {
88
/// If the observer and network are synchronizing on a global clock
99
/// there won't be a need to distinguish between static and dynamic views.
1010
#[prost(string, tag = "2")]
11-
pub timestamp: std::string::String,
11+
pub timestamp: ::prost::alloc::string::String,
1212
/// Notorization, SPV, ZKP, etc. Possibly enum
1313
#[prost(string, tag = "3")]
14-
pub proof_type: std::string::String,
14+
pub proof_type: ::prost::alloc::string::String,
1515
/// The data field's serialization format (e.g. JSON, XML, Protobuf)
1616
#[prost(string, tag = "4")]
17-
pub serialization_format: std::string::String,
17+
pub serialization_format: ::prost::alloc::string::String,
1818
}
19+
/// Nested message and enum types in `Meta`.
1920
pub mod meta {
20-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
21+
#[derive(
22+
serde::Serialize,
23+
serde::Deserialize,
24+
Clone,
25+
Copy,
26+
Debug,
27+
PartialEq,
28+
Eq,
29+
Hash,
30+
PartialOrd,
31+
Ord,
32+
::prost::Enumeration,
33+
)]
2134
#[repr(i32)]
22-
#[derive(serde::Serialize, serde::Deserialize)]
2335
pub enum Protocol {
2436
Bitcoin = 0,
2537
Ethereum = 1,
2638
Fabric = 3,
2739
Corda = 4,
2840
}
2941
}
30-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
42+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
3143
pub struct View {
3244
#[prost(message, optional, tag = "1")]
33-
pub meta: ::std::option::Option<Meta>,
45+
pub meta: ::core::option::Option<Meta>,
3446
/// Represents the data playload of this view.
3547
/// The representation of Fabric, Corda etc will be captured elsewhere.
3648
/// For some protocols, like Bitcoin, the structure of an SPV proof is well known.
37-
#[prost(bytes, tag = "2")]
38-
pub data: std::vec::Vec<u8>,
49+
#[prost(bytes = "vec", tag = "2")]
50+
pub data: ::prost::alloc::vec::Vec<u8>,
3951
}
4052
/// View represents the response from a remote network
41-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
53+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
4254
pub struct ViewPayload {
4355
#[prost(string, tag = "1")]
44-
pub request_id: std::string::String,
56+
pub request_id: ::prost::alloc::string::String,
4557
#[prost(oneof = "view_payload::State", tags = "2, 3")]
46-
pub state: ::std::option::Option<view_payload::State>,
58+
pub state: ::core::option::Option<view_payload::State>,
4759
}
60+
/// Nested message and enum types in `ViewPayload`.
4861
pub mod view_payload {
49-
#[derive(Clone, PartialEq, ::prost::Oneof, serde::Serialize, serde::Deserialize)]
62+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)]
5063
pub enum State {
5164
#[prost(message, tag = "2")]
5265
View(super::View),
5366
#[prost(string, tag = "3")]
54-
Error(std::string::String),
67+
Error(::prost::alloc::string::String),
5568
}
5669
}
5770
/// the payload that is used for the communication between the requesting relay
5871
/// and its network
59-
#[derive(Clone, PartialEq, ::prost::Message, serde::Serialize, serde::Deserialize)]
72+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Message)]
6073
pub struct RequestState {
6174
#[prost(string, tag = "1")]
62-
pub request_id: std::string::String,
75+
pub request_id: ::prost::alloc::string::String,
6376
#[prost(enumeration = "request_state::Status", tag = "2")]
6477
pub status: i32,
6578
#[prost(oneof = "request_state::State", tags = "3, 4")]
66-
pub state: ::std::option::Option<request_state::State>,
79+
pub state: ::core::option::Option<request_state::State>,
6780
}
81+
/// Nested message and enum types in `RequestState`.
6882
pub mod request_state {
69-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
83+
#[derive(
84+
serde::Serialize,
85+
serde::Deserialize,
86+
Clone,
87+
Copy,
88+
Debug,
89+
PartialEq,
90+
Eq,
91+
Hash,
92+
PartialOrd,
93+
Ord,
94+
::prost::Enumeration,
95+
)]
7096
#[repr(i32)]
71-
#[derive(serde::Serialize, serde::Deserialize)]
7297
pub enum Status {
7398
/// pending ACK from remote relay
7499
PendingAck = 0,
@@ -77,11 +102,11 @@ pub mod request_state {
77102
Error = 2,
78103
Completed = 3,
79104
}
80-
#[derive(Clone, PartialEq, ::prost::Oneof, serde::Serialize, serde::Deserialize)]
105+
#[derive(serde::Serialize, serde::Deserialize, Clone, PartialEq, ::prost::Oneof)]
81106
pub enum State {
82107
#[prost(message, tag = "3")]
83108
View(super::View),
84109
#[prost(string, tag = "4")]
85-
Error(std::string::String),
110+
Error(::prost::alloc::string::String),
86111
}
87112
}

0 commit comments

Comments
 (0)