summaryrefslogtreecommitdiff
path: root/src/node_http2.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-08-10 22:27:48 +0200
committerMichaƫl Zasso <targos@protonmail.com>2019-08-15 09:50:30 +0200
commit474577cf54c3a5f48dec8ab88bd2d03881e2ac02 (patch)
tree606efc56dea8b0d39474490580746fb98a07f35b /src/node_http2.h
parent599eee0990c98ef0e6cc32f1c9dbf2f35b63a923 (diff)
downloadandroid-node-v8-474577cf54c3a5f48dec8ab88bd2d03881e2ac02.tar.gz
android-node-v8-474577cf54c3a5f48dec8ab88bd2d03881e2ac02.tar.bz2
android-node-v8-474577cf54c3a5f48dec8ab88bd2d03881e2ac02.zip
http2: limit number of rejected stream openings
Limit the number of streams that are rejected upon creation. Since each such rejection is associated with an `NGHTTP2_ENHANCE_YOUR_CALM` error that should tell the peer to not open any more streams, continuing to open streams should be read as a sign of a misbehaving peer. The limit is currently set to 100 but could be changed or made configurable. This is intended to mitigate CVE-2019-9514. PR-URL: https://github.com/nodejs/node/pull/29122 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http2.h')
-rw-r--r--src/node_http2.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/node_http2.h b/src/node_http2.h
index 47d25f2b07..1739a29b25 100644
--- a/src/node_http2.h
+++ b/src/node_http2.h
@@ -1005,6 +1005,11 @@ class Http2Session : public AsyncWrap, public StreamListener {
std::vector<nghttp2_stream_write> outgoing_buffers_;
std::vector<uint8_t> outgoing_storage_;
std::vector<int32_t> pending_rst_streams_;
+ // Count streams that have been rejected while being opened. Exceeding a fixed
+ // limit will result in the session being destroyed, as an indication of a
+ // misbehaving peer. This counter is reset once new streams are being
+ // accepted again.
+ int32_t rejected_stream_count_ = 0;
void CopyDataIntoOutgoing(const uint8_t* src, size_t src_length);
void ClearOutgoing(int status);