Skip to content

Commit 4e782c9

Browse files
addaleaxTrott
authored andcommittedAug 18, 2019
http2: remove security revert flags
As the comment in `node_revert.h` indicates, the master branch should not provide security revert flags. Refs: #29122 PR-URL: #29141 Reviewed-By: Beth Griggs <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 27b7656 commit 4e782c9

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed
 

‎src/node_http2.cc

+4-14
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ Http2Options::Http2Options(Environment* env, nghttp2_session_type type) {
151151
buffer[IDX_OPTIONS_PEER_MAX_CONCURRENT_STREAMS]);
152152
}
153153

154-
if (IsReverted(SECURITY_REVERT_CVE_2019_9512))
155-
nghttp2_option_set_max_outbound_ack(options_, 10000);
156-
157154
// The padding strategy sets the mechanism by which we determine how much
158155
// additional frame padding to apply to DATA and HEADERS frames. Currently
159156
// this is set on a per-session basis, but eventually we may switch to
@@ -919,10 +916,8 @@ int Http2Session::OnBeginHeadersCallback(nghttp2_session* handle,
919916
if (UNLIKELY(!session->CanAddStream() ||
920917
Http2Stream::New(session, id, frame->headers.cat) ==
921918
nullptr)) {
922-
if (session->rejected_stream_count_++ > 100 &&
923-
!IsReverted(SECURITY_REVERT_CVE_2019_9514)) {
919+
if (session->rejected_stream_count_++ > 100)
924920
return NGHTTP2_ERR_CALLBACK_FAILURE;
925-
}
926921
// Too many concurrent streams being opened
927922
nghttp2_submit_rst_stream(**session, NGHTTP2_FLAG_NONE, id,
928923
NGHTTP2_ENHANCE_YOUR_CALM);
@@ -1013,10 +1008,8 @@ int Http2Session::OnInvalidFrame(nghttp2_session* handle,
10131008
Http2Session* session = static_cast<Http2Session*>(user_data);
10141009

10151010
Debug(session, "invalid frame received, code: %d", lib_error_code);
1016-
if (session->invalid_frame_count_++ > 1000 &&
1017-
!IsReverted(SECURITY_REVERT_CVE_2019_9514)) {
1011+
if (session->invalid_frame_count_++ > 1000)
10181012
return 1;
1019-
}
10201013

10211014
// If the error is fatal or if error code is ERR_STREAM_CLOSED... emit error
10221015
if (nghttp2_is_fatal(lib_error_code) ||
@@ -1383,8 +1376,7 @@ int Http2Session::HandleDataFrame(const nghttp2_frame* frame) {
13831376

13841377
if (!stream->IsDestroyed() && frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
13851378
stream->EmitRead(UV_EOF);
1386-
} else if (frame->hd.length == 0 &&
1387-
!IsReverted(SECURITY_REVERT_CVE_2019_9518)) {
1379+
} else if (frame->hd.length == 0) {
13881380
return 1; // Consider 0-length frame without END_STREAM an error.
13891381
}
13901382
return 0;
@@ -2269,9 +2261,7 @@ bool Http2Stream::AddHeader(nghttp2_rcbuf* name,
22692261
if (this->statistics_.first_header == 0)
22702262
this->statistics_.first_header = uv_hrtime();
22712263
size_t name_len = nghttp2_rcbuf_get_buf(name).len;
2272-
if (name_len == 0 && !IsReverted(SECURITY_REVERT_CVE_2019_9516)) {
2273-
return true; // Ignore headers with empty names.
2274-
}
2264+
if (name_len == 0) return true; // Ignore headers with empty names.
22752265
size_t value_len = nghttp2_rcbuf_get_buf(value).len;
22762266
size_t length = name_len + value_len + 32;
22772267
// A header can only be added if we have not exceeded the maximum number

‎src/node_revert.h

-6
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616
namespace node {
1717

1818
#define SECURITY_REVERSIONS(XX) \
19-
XX(CVE_2019_9512, "CVE-2019-9512", "HTTP/2 Ping/Settings Flood") \
20-
XX(CVE_2019_9514, "CVE-2019-9514", "HTTP/2 Reset Flood") \
21-
XX(CVE_2019_9516, "CVE-2019-9516", "HTTP/2 0-Length Headers Leak") \
22-
XX(CVE_2019_9518, "CVE-2019-9518", "HTTP/2 Empty DATA Frame Flooding") \
2319
// XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title")
24-
// TODO(addaleax): Remove all of the above before Node.js 13 as the comment
25-
// at the start of the file indicates.
2620

2721
enum reversion {
2822
#define V(code, ...) SECURITY_REVERT_##code,

0 commit comments

Comments
 (0)
Please sign in to comment.