Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/v1.27' into release/v1.2…
Browse files Browse the repository at this point in the history
…7-backportedfork
  • Loading branch information
nfuden committed Apr 9, 2024
2 parents ebfb8ff + 9134d6a commit 31f980b
Show file tree
Hide file tree
Showing 23 changed files with 448 additions and 56 deletions.
20 changes: 11 additions & 9 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -492,16 +492,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:fdd65c6270a8507a18d5acd6cf19a18cb695e4fa@sha256:3c8a3ce6f90dcfb5d09dc8f79bb01404d3526d420061f9a176e0a8e91e1e573e

#############################################################################
Expand Down
19 changes: 0 additions & 19 deletions .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,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.27.3
1.27.4
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 @@ -456,12 +456,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
13 changes: 13 additions & 0 deletions changelogs/1.26.8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
date: April 4, 2024

bug_fixes:
- 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.
52 changes: 52 additions & 0 deletions changelogs/1.27.3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
date: February 9, 2024

minor_behavior_changes:
- area: access_log
change: |
When emitting grpc logs, only downstream filter state was used. Now, both downstream and upstream filter states will be tried
to find the keys configured in filter_state_objects_to_log.
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: grpc
change: |
Fixed a bug in gRPC async client cache which intermittently causes CPU spikes due to busy loop in timer expiration.
- area: tracing
change: |
Fixed a bug where Datadog spans tagged as errors would not have the appropriate error property set.
- area: tracing
change: |
Fixed a bug where child spans produced by the Datadog tracer would have an incorrect operation name.
- area: tracing
change: |
Fixed a bug that caused the Datadog tracing extension to drop traces that
should be kept on account of an extracted sampling decision.
- 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: tls
change: |
Fix crash due to uncaught exception when the operating system does not support an address type (such as IPv6) that is
received in an mTLS client cert IP SAN. These SANs will be ignored. This applies only when using formatter
``%DOWNSTREAM_PEER_IP_SAN%``.
- 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.
23 changes: 14 additions & 9 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
date: February 9, 2024
date: April 4, 2024

minor_behavior_changes:
- area: access_log
behavior_changes:
- area: http2
change: |
When emitting grpc logs, only downstream filter state was used. Now, both downstream and upstream filter states will be tried
to find the keys configured in filter_state_objects_to_log.
Discard the ``Host`` header if the ``:authority`` header was received to bring Envoy into compliance with
https://www.rfc-editor.org/rfc/rfc9113#section-8.3.1 This behavioral change can be reverted by setting runtime flag
``envoy.reloadable_features.http2_discard_host_header`` to false.
bug_fixes:
- area: buffer
- area: http2
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
Update nghttp2 to resolve CVE-2024-30255 (https://github.com/envoyproxy/envoy/security/advisories/GHSA-j654-3ccm-vfmm).
new_features:
- area: google_grpc
change: |
Fixed recursion when HTTP connection is disconnected due to a high number of premature resets.
- area: grpc
Expand Down Expand Up @@ -102,3 +104,6 @@ new_features:
config APIs to enable sending and receiving attributes from/to the external processing server.
deprecated:
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.
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.
Binary file modified docs/inventories/v1.27/objects.inv
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"1.23": 1.23.12
"1.24": 1.24.12
"1.25": 1.25.11
"1.26": 1.26.7
"1.27": 1.27.2
"1.26": 1.26.8
"1.27": 1.27.3
1 change: 1 addition & 0 deletions source/common/grpc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,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
Loading

0 comments on commit 31f980b

Please sign in to comment.