Skip to content

Commit

Permalink
build(deps): update tonic, prost, and linkerd2-proxy-api (#1137)
Browse files Browse the repository at this point in the history
This updates `prost`, `prost-types`, and `prost-build` to v0.8, which
includes a fix for a panic (and potential denial-of-service attack) when
converting a protobuf duration into a Rust `Duration`. Although we don't
use the vulnerable APIs in the proxy or in `linkerd2-proxy-api`, this is
necessary in order to fix a RUSTSEC advisory warning. In order to update
`prost`, we must also update `tonic` and `tonic-build` to v0.5, which
depends on `prost` 0.8, and update the `linkerd2-proxy-api` crate to
include linkerd/linkerd2-proxy-api#71.

Since these crates all depend on each other, we need to update them all
at the same time. Dependabot has opened separate PRs for these crates,
but none of them will pass CI, since they depend on incompatible
versions. This PR, on the other hand, should pass, since it updates all
the crates atomically in one commit. Also, some minor code changes
were required due to breaking API changes in `tonic` 0.5.

Closes #1134, #1135, and #1136; should fix CI.
  • Loading branch information
hawkw committed Jul 9, 2021
1 parent b98c13d commit e908293
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 68 deletions.
54 changes: 39 additions & 15 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,18 @@ dependencies = [
"tower",
]

[[package]]
name = "hyper-timeout"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
dependencies = [
"hyper",
"pin-project-lite",
"tokio",
"tokio-io-timeout",
]

[[package]]
name = "idna"
version = "0.2.3"
Expand Down Expand Up @@ -530,9 +542,9 @@ checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9"

[[package]]
name = "itertools"
version = "0.9.0"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
Expand Down Expand Up @@ -1465,7 +1477,7 @@ dependencies = [
[[package]]
name = "linkerd2-proxy-api"
version = "0.1.18"
source = "git+https://github.com/linkerd/linkerd2-proxy-api?branch=main#def4e323b26e04f177c53f8f14a9ff7c82830721"
source = "git+https://github.com/linkerd/linkerd2-proxy-api?branch=main#5e4e190df8fe3a2c869169a60b7ba78e2afe31b6"
dependencies = [
"h2",
"http",
Expand Down Expand Up @@ -1733,19 +1745,19 @@ dependencies = [

[[package]]
name = "prost"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2"
checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
dependencies = [
"bytes",
"prost-derive",
]

[[package]]
name = "prost-build"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3"
checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
dependencies = [
"bytes",
"heck",
Expand All @@ -1761,9 +1773,9 @@ dependencies = [

[[package]]
name = "prost-derive"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4"
checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
dependencies = [
"anyhow",
"itertools",
Expand All @@ -1774,9 +1786,9 @@ dependencies = [

[[package]]
name = "prost-types"
version = "0.7.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb"
checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
dependencies = [
"bytes",
"prost",
Expand Down Expand Up @@ -2139,6 +2151,16 @@ dependencies = [
"winapi",
]

[[package]]
name = "tokio-io-timeout"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90c49f106be240de154571dd31fbe48acb10ba6c6dd6f6517ad603abffa42de9"
dependencies = [
"pin-project-lite",
"tokio",
]

[[package]]
name = "tokio-macros"
version = "1.1.0"
Expand Down Expand Up @@ -2214,9 +2236,9 @@ dependencies = [

[[package]]
name = "tonic"
version = "0.4.3"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ac42cd97ac6bd2339af5bcabf105540e21e45636ec6fa6aae5e85d44db31be0"
checksum = "b584f064fdfc50017ec39162d5aebce49912f1eb16fd128e04b7f4ce4907c7e5"
dependencies = [
"async-stream",
"async-trait",
Expand All @@ -2228,6 +2250,7 @@ dependencies = [
"http",
"http-body",
"hyper",
"hyper-timeout",
"percent-encoding",
"pin-project",
"prost",
Expand All @@ -2236,16 +2259,17 @@ dependencies = [
"tokio-stream",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
"tracing",
"tracing-futures",
]

[[package]]
name = "tonic-build"
version = "0.4.2"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c695de27302f4697191dda1c7178131a8cb805463dda02864acb80fe1322fdcf"
checksum = "25db9a497663a9a779693ef67b6e6aef8345b3d3ff8d50ef92eae6c88cb1e386"
dependencies = [
"proc-macro2",
"prost-build",
Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ regex = "1.5.4"
thiserror = "1.0"
tokio = { version = "1", features = ["rt"] }
tokio-stream = { version = "0.1.7", features = ["time", "sync"] }
tonic = { version = "0.4", default-features = false, features = ["prost"] }
tonic = { version = "0.5", default-features = false, features = ["prost"] }
tower = "0.4.8"
tracing = "0.1.26"
2 changes: 1 addition & 1 deletion linkerd/app/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ serde_json = "1"
thiserror = "1.0"
tokio = { version = "1", features = ["macros", "sync", "parking_lot"]}
tokio-stream = { version = "0.1.7", features = ["time"] }
tonic = { version = "0.4", default-features = false, features = ["prost"] }
tonic = { version = "0.5", default-features = false, features = ["prost"] }
tracing = "0.1.26"
pin-project = "1"

Expand Down
1 change: 0 additions & 1 deletion linkerd/app/core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ fn code_header(code: grpc::Code) -> HeaderValue {
Code::Unavailable => HeaderValue::from_static("14"),
Code::DataLoss => HeaderValue::from_static("15"),
Code::Unauthenticated => HeaderValue::from_static("16"),
Code::__NonExhaustive => unreachable!("Code::__NonExhaustive"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion linkerd/app/integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tokio = { version = "1", features = ["io-util", "net", "rt", "macros"] }
tokio-stream = { version = "0.1.7", features = ["sync"] }
tokio-rustls = "0.22"
tower = { version = "0.4.8", default-features = false }
tonic = { version = "0.4", default-features = false }
tonic = { version = "0.5", default-features = false }
tracing = "0.1.26"
webpki = "0.21"
tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt"] }
Expand Down
2 changes: 1 addition & 1 deletion linkerd/opencensus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ http-body = "0.4"
linkerd-error = { path = "../error" }
linkerd-metrics = { path = "../metrics" }
opencensus-proto = { path = "../../opencensus-proto" }
tonic = { version = "0.4", default-features = false, features = ["prost", "codegen"] }
tonic = { version = "0.5", default-features = false, features = ["prost", "codegen"] }
tower = { version = "0.4.8", default-features = false }
tokio = { version = "1", features = ["macros", "sync", "time"] }
tokio-stream = { version = "0.1.7", features = ["sync"] }
Expand Down
4 changes: 2 additions & 2 deletions linkerd/opencensus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ where
T: GrpcService<BoxBody> + Clone,
T::Error: Into<Error>,
<T::ResponseBody as HttpBody>::Error: Into<Error> + Send + Sync,
T::ResponseBody: 'static,
T::ResponseBody: Send + Sync + 'static,
S: Stream<Item = Span> + Unpin,
{
debug!("Span exporter running");
Expand All @@ -49,7 +49,7 @@ where
T: GrpcService<BoxBody>,
T::Error: Into<Error>,
<T::ResponseBody as HttpBody>::Error: Into<Error> + Send + Sync,
T::ResponseBody: 'static,
T::ResponseBody: Send + Sync + 'static,
S: Stream<Item = Span> + Unpin,
{
const MAX_BATCH_SIZE: usize = 1000;
Expand Down
4 changes: 2 additions & 2 deletions linkerd/proxy/api-resolve/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ linkerd-tls = { path = "../../tls" }
http = "0.2"
http-body = "0.4"
pin-project = "1"
prost = "0.7"
tonic = { version = "0.4", default-features = false }
prost = "0.8"
tonic = { version = "0.5", default-features = false }
tower = { version = "0.4.8", default-features = false }
tracing = "0.1.26"
16 changes: 6 additions & 10 deletions linkerd/proxy/api-resolve/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,12 @@ use crate::{
use api::destination_client::DestinationClient;
use async_stream::try_stream;
use futures::prelude::*;
use http_body::Body as HttpBody;
use http_body::Body;
use linkerd_error::Error;
use linkerd_stack::Param;
use std::pin::Pin;
use std::task::{Context, Poll};
use tonic::{
self as grpc,
body::{Body, BoxBody},
client::GrpcService,
};
use tonic::{self as grpc, body::BoxBody, client::GrpcService};
use tower::Service;
use tracing::{debug, info, trace};

Expand All @@ -32,9 +28,9 @@ impl<S> Resolve<S>
where
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::Error: Into<Error> + Send,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error: Into<Error> + Send,
<S::ResponseBody as Body>::Error: Into<Error> + Send,
S::Future: Send,
{
pub fn new(svc: S, context_token: String) -> Self {
Expand All @@ -56,9 +52,9 @@ where
T: Param<ConcreteAddr>,
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::Error: Into<Error> + Send,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error: Into<Error> + Send,
<S::ResponseBody as Body>::Error: Into<Error> + Send,
S::Future: Send,
{
type Response = UpdatesStream;
Expand Down
2 changes: 1 addition & 1 deletion linkerd/proxy/identity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ linkerd-metrics = { path = "../../metrics" }
linkerd-stack = { path = "../../stack" }
linkerd-tls = { path = "../../tls" }
tokio = { version = "1", features = ["time", "sync"] }
tonic = { version = "0.4", default-features = false }
tonic = { version = "0.5", default-features = false }
tracing = "0.1.26"
http-body = "0.4"
pin-project = "1"
12 changes: 4 additions & 8 deletions linkerd/proxy/identity/src/certify.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use http_body::Body as HttpBody;
use http_body::Body;
use linkerd2_proxy_api::identity::{self as api, identity_client::IdentityClient};
use linkerd_error::Error;
use linkerd_identity as id;
Expand All @@ -11,11 +11,7 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use tokio::sync::watch;
use tokio::time::{self, Sleep};
use tonic::{
self as grpc,
body::{Body, BoxBody},
client::GrpcService,
};
use tonic::{self as grpc, body::BoxBody, client::GrpcService};
use tracing::{debug, error, trace};

/// Configures the Identity service and local identity.
Expand Down Expand Up @@ -88,9 +84,9 @@ impl Daemon {
where
N: NewService<(), Service = S>,
S: GrpcService<BoxBody>,
S::ResponseBody: Send + 'static,
S::ResponseBody: Send + Sync + 'static,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error: Into<Error> + Send,
<S::ResponseBody as Body>::Error: Into<Error> + Send,
{
let Self {
crt_key_watch,
Expand Down
4 changes: 2 additions & 2 deletions linkerd/proxy/tap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ rand = { version = "0.8" }
thiserror = "1.0"
tokio = { version = "1", features = ["time"]}
tower = { version = "0.4.8", default-features = false }
tonic = { version = "0.4", default-features = false }
tonic = { version = "0.5", default-features = false }
tracing = "0.1.26"
pin-project = "1"

[dev-dependencies]
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", branch = "main", features = ["arbitrary"] }
prost-types = "0.7.0"
prost-types = "0.8.0"
quickcheck = { version = "1", default-features = false }
4 changes: 2 additions & 2 deletions linkerd/service-profiles/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ rand = { version = "0.8", features = ["small_rng"] }
regex = "1.5.4"
tokio = { version = "1", features = ["macros", "rt", "sync", "time"] }
tokio-stream = { version = "0.1", features = ["sync"] }
tonic = { version = "0.4", default-features = false }
tonic = { version = "0.5", default-features = false }
tower = { version = "0.4.8", features = [ "ready-cache", "retry", "util"] }
thiserror = "1"
tracing = "0.1.26"
pin-project = "1"

[dev-dependencies]
linkerd2-proxy-api = { git = "https://github.com/linkerd/linkerd2-proxy-api", branch = "main", features = ["arbitrary"] }
prost-types = "0.7.0"
prost-types = "0.8.0"
quickcheck = { version = "1", default-features = false }
23 changes: 10 additions & 13 deletions linkerd/service-profiles/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
use crate::{proto, LookupAddr, Profile, Receiver};
use futures::prelude::*;
use http_body::Body as HttpBody;
use http_body::Body;
use linkerd2_proxy_api::destination::{self as api, destination_client::DestinationClient};
use linkerd_error::{Never, Recover};
use linkerd_stack::{Param, Service};
use linkerd_tonic_watch::StreamWatch;
use std::task::{Context, Poll};
use tonic::{
body::{Body, BoxBody},
client::GrpcService,
};
use tonic::{body::BoxBody, client::GrpcService};
use tracing::debug;

/// Creates watches on service profiles.
Expand All @@ -30,9 +27,9 @@ struct Inner<S> {
impl<R, S> Client<R, S>
where
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error:
<S::ResponseBody as Body>::Error:
Into<Box<dyn std::error::Error + Send + Sync + 'static>> + Send,
S::Future: Send,
R: Recover<tonic::Status> + Send + Clone + 'static,
Expand All @@ -49,9 +46,9 @@ impl<T, R, S> Service<T> for Client<R, S>
where
T: Param<LookupAddr>,
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error:
<S::ResponseBody as Body>::Error:
Into<Box<dyn std::error::Error + Send + Sync + 'static>> + Send,
S::Future: Send,
R: Recover<tonic::Status> + Send + Clone + 'static,
Expand Down Expand Up @@ -96,9 +93,9 @@ type InnerFuture =
impl<S> Inner<S>
where
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error:
<S::ResponseBody as Body>::Error:
Into<Box<dyn std::error::Error + Send + Sync + 'static>> + Send,
S::Future: Send,
{
Expand All @@ -113,9 +110,9 @@ where
impl<S> Service<LookupAddr> for Inner<S>
where
S: GrpcService<BoxBody> + Clone + Send + 'static,
S::ResponseBody: Send,
S::ResponseBody: Send + Sync,
<S::ResponseBody as Body>::Data: Send,
<S::ResponseBody as HttpBody>::Error:
<S::ResponseBody as Body>::Error:
Into<Box<dyn std::error::Error + Send + Sync + 'static>> + Send,
S::Future: Send,
{
Expand Down
Loading

0 comments on commit e908293

Please sign in to comment.