Skip to content

Commit

Permalink
finagle: upgrade Netty to 4.1.67.Final
Browse files Browse the repository at this point in the history
Problem:

There is a new Netty release.

Solution:

Upgrade to netty 4.1.67.Final and netty-tcnative 2.0.40.Final
Refer release notes for detail:

```https://netty.io/news/2021/08/16/4-1-67-Final.html```

There are two major changes that have affected our libraries:
1. The PoolChunk API now requires an Object "base" and no longer accepts an int "offset"
See netty/netty@2071086

2. A patch for possible request smuggling now ensures that the content-length header
is validated. We had been exploiting this vulnerability where we added callback
information to responses without updating the content length. This is now fixed.
See GHSA-wm47-8v5p-wjpj

JIRA Issues: CSL-11245

Differential Revision: https://phabricator.twitter.biz/D726343
  • Loading branch information
joybestourous authored and jenkins committed Aug 20, 2021
1 parent 7cd4537 commit c373fc0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Unreleased
Runtime Behavior Changes
~~~~~~~~~~~~~~~~~~~~~~~~

* finagle: Upgrade to Netty 4.1.67.Final and netty-tcnative 2.0.40.Final. ``PHAB_ID=D726343``

* finagle: Bump version of Jackson to 2.11.4. ``PHAB_ID=D727879``

21.8.0 (No 21.7.0 Release)
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ val releaseVersion = "21.9.0-SNAPSHOT"

val libthriftVersion = "0.10.0"

val defaultNetty4Version = "4.1.59.Final"
val defaultNetty4StaticSslVersion = "2.0.35.Final"
val defaultNetty4Version = "4.1.67.Final"
val defaultNetty4StaticSslVersion = "2.0.40.Final"

val useNettySnapshot: Boolean = sys.env.get("FINAGLE_USE_NETTY_4_SNAPSHOT") match {
case Some(useSnapshot) => useSnapshot.toBoolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class JsonpFilter[Req <: Request] extends SimpleFilter[Req, Response] {
)
)
response.mediaType = MediaType.Javascript
response.contentLength match {
case Some(len: Long) =>
response.contentLength = len + callback.length + JsonpFilter.ExtraCharacters
case None => // Likely using Transfer-Encoding instead, no-op
}
}
response
}
Expand Down Expand Up @@ -69,4 +74,5 @@ object JsonpFilter extends JsonpFilter[Request] {
private val RightParenSemicolon = Buf.Utf8(");")
// Prepended to address CVE-2014-4671
private val Comment = Buf.Utf8("/**/")
private val ExtraCharacters = 7
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private[finagle] object Bijections {
result.headers
.add(NettyHttp.HttpHeaderNames.TRANSFER_ENCODING, NettyHttp.HttpHeaderValues.CHUNKED)
} else {
// Make sure we don't have a `Transfer-Encooding: chunked` header and `Content-Length` headers
// Make sure we don't have a `Transfer-Encoding: chunked` header and `Content-Length` headers
result.headers.remove(NettyHttp.HttpHeaderNames.TRANSFER_ENCODING)
}
result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ private class FinalizedSslContext(underlying: SslContext) extends SslContext {

def cipherSuites(): JList[String] = underlying.cipherSuites()

def sessionCacheSize(): Long = underlying.sessionCacheSize()
override def sessionCacheSize(): Long = underlying.sessionCacheSize()

def sessionTimeout(): Long = underlying.sessionTimeout()
override def sessionTimeout(): Long = underlying.sessionTimeout()

def applicationProtocolNegotiator(): ApplicationProtocolNegotiator =
underlying.applicationProtocolNegotiator()
Expand Down

0 comments on commit c373fc0

Please sign in to comment.