Skip to content

Commit

Permalink
Merge pull request #21 from solo-io/1.26.8-forward
Browse files Browse the repository at this point in the history
1.26.8 forward
  • Loading branch information
nfuden committed Apr 5, 2024
2 parents 37f7ac7 + 1de78fa commit f87a614
Show file tree
Hide file tree
Showing 19 changed files with 314 additions and 45 deletions.
20 changes: 11 additions & 9 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -489,16 +489,18 @@ build:rbe-engflow --remote_timeout=3600s
build:rbe-engflow --bes_timeout=3600s
build:rbe-engflow --bes_upload_mode=fully_async

build:rbe-envoy-engflow --google_default_credentials=false
build:rbe-envoy-engflow --remote_cache=grpcs://morganite.cluster.engflow.com
build:cache-envoy-engflow --google_default_credentials=false
build:cache-envoy-engflow --remote_cache=grpcs://morganite.cluster.engflow.com
build:cache-envoy-engflow --remote_timeout=3600s
build:cache-envoy-engflow --credential_helper=*.engflow.com=%workspace%/bazel/engflow-bazel-credential-helper.sh
build:cache-envoy-engflow --grpc_keepalive_time=30s
build:bes-envoy-engflow --bes_backend=grpcs://morganite.cluster.engflow.com/
build:bes-envoy-engflow --bes_results_url=https://morganite.cluster.engflow.com/invocation/
build:bes-envoy-engflow --bes_timeout=3600s
build:bes-envoy-engflow --bes_upload_mode=fully_async
build:rbe-envoy-engflow --config=cache-envoy-engflow
build:rbe-envoy-engflow --config=bes-envoy-engflow
build:rbe-envoy-engflow --remote_executor=grpcs://morganite.cluster.engflow.com
build:rbe-envoy-engflow --bes_backend=grpcs://morganite.cluster.engflow.com/
build:rbe-envoy-engflow --bes_results_url=https://morganite.cluster.engflow.com/invocation/
build:rbe-envoy-engflow --credential_helper=*.engflow.com=%workspace%/bazel/engflow-bazel-credential-helper.sh
build:rbe-envoy-engflow --grpc_keepalive_time=30s
build:rbe-envoy-engflow --remote_timeout=3600s
build:rbe-envoy-engflow --bes_timeout=3600s
build:rbe-envoy-engflow --bes_upload_mode=fully_async
build:rbe-envoy-engflow --remote_default_exec_properties=container-image=docker://docker.io/envoyproxy/envoy-build-ubuntu:cmake-fdd65c6270a8507a18d5acd6cf19a18cb695e4fa@sha256:06d3d10a99cce5bf4036be65190f192a30503fa93b9df3c119fd1260d3ed7024

#############################################################################
Expand Down
19 changes: 0 additions & 19 deletions .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,27 +81,8 @@ checks:
- publish
- verify
required: true
windows:
name: Envoy/Windows
required: true
on-run:
- build-windows

run:
build-windows:
paths:
- .bazelrc
- .bazelversion
- .github/config.yml
- api/**/*
- bazel/**/*
- ci/**/*
- configs/**/*
- contrib/**/*
- envoy/**/*
- source/**/*
- test/**/*
- VERSION.txt
build-macos:
paths:
- .bazelrc
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.26.7
1.26.8
168 changes: 168 additions & 0 deletions bazel/foreign_cc/nghttp2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,171 @@ diff -u -r a/CMakeLists.txt b/CMakeLists.txt
endif()
# AC_TYPE_UINT8_T
# AC_TYPE_UINT16_T
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 7d7f31c6..ce50d89e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -74,6 +74,7 @@ APIDOCS= \
nghttp2_option_set_peer_max_concurrent_streams.rst \
nghttp2_option_set_server_fallback_rfc7540_priorities.rst \
nghttp2_option_set_user_recv_extension_type.rst \
+ nghttp2_option_set_max_continuations.rst \
nghttp2_option_set_max_outbound_ack.rst \
nghttp2_option_set_max_settings.rst \
nghttp2_option_set_stream_reset_rate_limit.rst \
diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h
index 7910db23..a54efbfd 100644
--- a/lib/includes/nghttp2/nghttp2.h
+++ b/lib/includes/nghttp2/nghttp2.h
@@ -440,7 +440,12 @@ typedef enum {
* exhaustion on server side to send these frames forever and does
* not read network.
*/
- NGHTTP2_ERR_FLOODED = -904
+ NGHTTP2_ERR_FLOODED = -904,
+ /**
+ * When a local endpoint receives too many CONTINUATION frames
+ * following a HEADER frame.
+ */
+ NGHTTP2_ERR_TOO_MANY_CONTINUATIONS = -905,
} nghttp2_error;

/**
@@ -2773,6 +2778,17 @@ NGHTTP2_EXTERN void
nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option,
uint64_t burst, uint64_t rate);

+/**
+ * @function
+ *
+ * This function sets the maximum number of CONTINUATION frames
+ * following an incoming HEADER frame. If more than those frames are
+ * received, the remote endpoint is considered to be misbehaving and
+ * session will be closed. The default value is 8.
+ */
+NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option,
+ size_t val);
+
/**
* @function
*
diff --git a/lib/nghttp2_helper.c b/lib/nghttp2_helper.c
index 93dd4754..b3563d98 100644
--- a/lib/nghttp2_helper.c
+++ b/lib/nghttp2_helper.c
@@ -336,6 +336,8 @@ const char *nghttp2_strerror(int error_code) {
"closed";
case NGHTTP2_ERR_TOO_MANY_SETTINGS:
return "SETTINGS frame contained more than the maximum allowed entries";
+ case NGHTTP2_ERR_TOO_MANY_CONTINUATIONS:
+ return "Too many CONTINUATION frames following a HEADER frame";
default:
return "Unknown error code";
}
diff --git a/lib/nghttp2_option.c b/lib/nghttp2_option.c
index 43d4e952..53144b9b 100644
--- a/lib/nghttp2_option.c
+++ b/lib/nghttp2_option.c
@@ -150,3 +150,8 @@ void nghttp2_option_set_stream_reset_rate_limit(nghttp2_option *option,
option->stream_reset_burst = burst;
option->stream_reset_rate = rate;
}
+
+void nghttp2_option_set_max_continuations(nghttp2_option *option, size_t val) {
+ option->opt_set_mask |= NGHTTP2_OPT_MAX_CONTINUATIONS;
+ option->max_continuations = val;
+}
diff --git a/lib/nghttp2_option.h b/lib/nghttp2_option.h
index 2259e184..c89cb97f 100644
--- a/lib/nghttp2_option.h
+++ b/lib/nghttp2_option.h
@@ -71,6 +71,7 @@ typedef enum {
NGHTTP2_OPT_SERVER_FALLBACK_RFC7540_PRIORITIES = 1 << 13,
NGHTTP2_OPT_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION = 1 << 14,
NGHTTP2_OPT_STREAM_RESET_RATE_LIMIT = 1 << 15,
+ NGHTTP2_OPT_MAX_CONTINUATIONS = 1 << 16,
} nghttp2_option_flag;

/**
@@ -98,6 +99,10 @@ struct nghttp2_option {
* NGHTTP2_OPT_MAX_SETTINGS
*/
size_t max_settings;
+ /**
+ * NGHTTP2_OPT_MAX_CONTINUATIONS
+ */
+ size_t max_continuations;
/**
* Bitwise OR of nghttp2_option_flag to determine that which fields
* are specified.
diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c
index ce21caf9..18949528 100644
--- a/lib/nghttp2_session.c
+++ b/lib/nghttp2_session.c
@@ -496,6 +496,7 @@ static int session_new(nghttp2_session **session_ptr,
(*session_ptr)->max_send_header_block_length = NGHTTP2_MAX_HEADERSLEN;
(*session_ptr)->max_outbound_ack = NGHTTP2_DEFAULT_MAX_OBQ_FLOOD_ITEM;
(*session_ptr)->max_settings = NGHTTP2_DEFAULT_MAX_SETTINGS;
+ (*session_ptr)->max_continuations = NGHTTP2_DEFAULT_MAX_CONTINUATIONS;

if (option) {
if ((option->opt_set_mask & NGHTTP2_OPT_NO_AUTO_WINDOW_UPDATE) &&
@@ -584,6 +585,10 @@ static int session_new(nghttp2_session **session_ptr,
option->stream_reset_burst,
option->stream_reset_rate);
}
+
+ if (option->opt_set_mask & NGHTTP2_OPT_MAX_CONTINUATIONS) {
+ (*session_ptr)->max_continuations = option->max_continuations;
+ }
}

rv = nghttp2_hd_deflate_init2(&(*session_ptr)->hd_deflater,
@@ -6778,6 +6783,8 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
}
}
session_inbound_frame_reset(session);
+
+ session->num_continuations = 0;
}
break;
}
@@ -6899,6 +6906,10 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in,
}
#endif /* DEBUGBUILD */

+ if (++session->num_continuations > session->max_continuations) {
+ return NGHTTP2_ERR_TOO_MANY_CONTINUATIONS;
+ }
+
readlen = inbound_frame_buf_read(iframe, in, last);
in += readlen;

diff --git a/lib/nghttp2_session.h b/lib/nghttp2_session.h
index b119329a..ef8f7b27 100644
--- a/lib/nghttp2_session.h
+++ b/lib/nghttp2_session.h
@@ -110,6 +110,10 @@ typedef struct {
#define NGHTTP2_DEFAULT_STREAM_RESET_BURST 1000
#define NGHTTP2_DEFAULT_STREAM_RESET_RATE 33

+/* The default max number of CONTINUATION frames following an incoming
+ HEADER frame. */
+#define NGHTTP2_DEFAULT_MAX_CONTINUATIONS 8
+
/* Internal state when receiving incoming frame */
typedef enum {
/* Receiving frame header */
@@ -290,6 +294,12 @@ struct nghttp2_session {
size_t max_send_header_block_length;
/* The maximum number of settings accepted per SETTINGS frame. */
size_t max_settings;
+ /* The maximum number of CONTINUATION frames following an incoming
+ HEADER frame. */
+ size_t max_continuations;
+ /* The number of CONTINUATION frames following an incoming HEADER
+ frame. This variable is reset when END_HEADERS flag is seen. */
+ size_t num_continuations;
/* Next Stream ID. Made unsigned int to detect >= (1 << 31). */
uint32_t next_stream_id;
/* The last stream ID this session initiated. For client session,
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Nghttp2",
project_desc = "Implementation of HTTP/2 and its header compression algorithm HPACK in C",
project_url = "https://nghttp2.org",
version = "1.57.0",
sha256 = "1e3258453784d3b7e6cc48d0be087b168f8360b5d588c66bfeda05d07ad39ffd",
version = "1.59.0",
sha256 = "90fd27685120404544e96a60ed40398a3457102840c38e7215dc6dec8684470f",
strip_prefix = "nghttp2-{version}",
urls = ["https://github.com/nghttp2/nghttp2/releases/download/v{version}/nghttp2-{version}.tar.gz"],
use_category = ["controlplane", "dataplane_core"],
release_date = "2023-10-10",
release_date = "2024-01-21",
cpe = "cpe:2.3:a:nghttp2:nghttp2:*",
license = "MIT",
license_url = "https://github.com/nghttp2/nghttp2/blob/v{version}/LICENSE",
Expand Down
28 changes: 28 additions & 0 deletions changelogs/1.26.7.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
date: February 9, 2024

bug_fixes:
- area: buffer
change: |
Fixed a bug (https://github.com/envoyproxy/envoy/issues/28760) that the internal listener causes an undefined
behavior due to the unintended release of the buffer memory.
- area: http
change: |
Fixed recursion when HTTP connection is disconnected due to a high number of premature resets.
- area: proxy protocol
change: |
fixed a crash when Envoy is configured for PROXY protocol on both a listener and cluster, and the listener receives
a PROXY protocol header with address type LOCAL (typically used for health checks).
- area: proxy_protocol
change: |
Fix crash due to uncaught exception when the operating system does not support an address type (such as IPv6) that is
received in a proxy protocol header. Connections will instead be dropped/reset.
- area: proxy_protocol
change: |
Fixed a bug where TLVs with non utf8 characters were inserted as protobuf values into filter metadata circumventing
ext_authz checks when ``failure_mode_allow`` is set to ``true``.
- area: http
change: |
Fixed crash when HTTP request idle and per try timeouts occurs within backoff interval.
- area: url matching
change: |
Fixed excessive CPU utilization when using regex URL template matcher.
13 changes: 11 additions & 2 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
date: February 9, 2024
date: April 4, 2024

bug_fixes:
- area: buffer
- area: http2
change: |
Update nghttp2 to resolve CVE-2024-30255 (https://github.com/envoyproxy/envoy/security/advisories/GHSA-j654-3ccm-vfmm).
new_features:
- area: google_grpc
change: |
Added an off-by-default runtime flag
``envoy.reloadable_features.google_grpc_disable_tls_13`` to disable TLSv1.3
usage by gRPC SDK for ``google_grpc`` services.
fixed a bug where handshake may fail when both private key provider and cert validation are set.
- area: buffer
change: |
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile-envoy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILD_OS=ubuntu
ARG BUILD_TAG=20.04@sha256:bb1c41682308d7040f74d103022816d41c50d7b0c89e9d706a74b4e548636e54
ARG BUILD_TAG=20.04@sha256:80ef4a44043dec4490506e6cc4289eeda2d106a70148b74b5ae91ee670e9c35d
ARG ENVOY_VRP_BASE_IMAGE=envoy-base


Expand Down Expand Up @@ -58,7 +58,7 @@ COPY --chown=0:0 --chmod=755 \


# STAGE: envoy-distroless
FROM gcr.io/distroless/base-nossl-debian12:nonroot@sha256:51ab103bb161fdf8fee4c6311a2d41f484effc409d4f4c58342ab68b2da7ccc2 AS envoy-distroless
FROM gcr.io/distroless/base-nossl-debian12:nonroot@sha256:0cf184cfdb9ac2878822b15b8917fae5d42fba26da654cd75ab3ed34add0737f AS envoy-distroless
EXPOSE 10000
ENTRYPOINT ["/usr/local/bin/envoy"]
CMD ["-c", "/etc/envoy/envoy.yaml"]
Expand Down
Binary file modified docs/inventories/v1.26/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
"1.23": 1.23.12
"1.24": 1.24.12
"1.25": 1.25.11
"1.26": 1.26.6
"1.26": 1.26.7
1 change: 1 addition & 0 deletions source/common/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ envoy_cc_library(
"//envoy/grpc:google_grpc_creds_interface",
"//envoy/registry",
"//source/common/config:datasource_lib",
"//source/common/runtime:runtime_lib",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
],
alwayslink = LEGACY_ALWAYSLINK,
Expand Down
38 changes: 31 additions & 7 deletions source/common/grpc/google_grpc_creds_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include "envoy/grpc/google_grpc_creds.h"

#include "source/common/config/datasource.h"
#include "source/common/runtime/runtime_features.h"

#include "grpcpp/security/tls_certificate_provider.h"

namespace Envoy {
namespace Grpc {
Expand All @@ -15,12 +18,29 @@ std::shared_ptr<grpc::ChannelCredentials> CredsUtility::getChannelCredentials(
case envoy::config::core::v3::GrpcService::GoogleGrpc::ChannelCredentials::
CredentialSpecifierCase::kSslCredentials: {
const auto& ssl_credentials = google_grpc.channel_credentials().ssl_credentials();
const grpc::SslCredentialsOptions ssl_credentials_options = {
Config::DataSource::read(ssl_credentials.root_certs(), true, api),
Config::DataSource::read(ssl_credentials.private_key(), true, api),
Config::DataSource::read(ssl_credentials.cert_chain(), true, api),
};
return grpc::SslCredentials(ssl_credentials_options);
const auto root_certs = Config::DataSource::read(ssl_credentials.root_certs(), true, api);
const auto private_key = Config::DataSource::read(ssl_credentials.private_key(), true, api);
const auto cert_chain = Config::DataSource::read(ssl_credentials.cert_chain(), true, api);
grpc::experimental::TlsChannelCredentialsOptions options;
if (!private_key.empty() || !cert_chain.empty()) {
options.set_certificate_provider(
std::make_shared<grpc::experimental::StaticDataCertificateProvider>(
root_certs,
std::vector<grpc::experimental::IdentityKeyCertPair>{{private_key, cert_chain}}));
} else if (!root_certs.empty()) {
options.set_certificate_provider(
std::make_shared<grpc::experimental::StaticDataCertificateProvider>(root_certs));
}
if (!root_certs.empty()) {
options.watch_root_certs();
}
if (!private_key.empty() || !cert_chain.empty()) {
options.watch_identity_key_cert_pairs();
}
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.google_grpc_disable_tls_13")) {
options.set_max_tls_version(grpc_tls_version::TLS1_2);
}
return grpc::experimental::TlsCredentials(options);
}
case envoy::config::core::v3::GrpcService::GoogleGrpc::ChannelCredentials::
CredentialSpecifierCase::kLocalCredentials: {
Expand All @@ -43,7 +63,11 @@ std::shared_ptr<grpc::ChannelCredentials> CredsUtility::defaultSslChannelCredent
if (creds != nullptr) {
return creds;
}
return grpc::SslCredentials({});
grpc::experimental::TlsChannelCredentialsOptions options;
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.google_grpc_disable_tls_13")) {
options.set_max_tls_version(grpc_tls_version::TLS1_2);
}
return grpc::experimental::TlsCredentials(options);
}

std::vector<std::shared_ptr<grpc::CallCredentials>>
Expand Down
Loading

0 comments on commit f87a614

Please sign in to comment.