Skip to content

Comments

fix: Check max frame size in inbound TCP framing#32791

Merged
johanandren merged 1 commit intomainfrom
wip-frame-size-patriknw
Aug 29, 2025
Merged

fix: Check max frame size in inbound TCP framing#32791
johanandren merged 1 commit intomainfrom
wip-frame-size-patriknw

Conversation

@patriknw
Copy link
Contributor

No description provided.

Copy link
Contributor

@octonato octonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@johanandren johanandren merged commit 903b139 into main Aug 29, 2025
9 checks passed
@johanandren johanandren deleted the wip-frame-size-patriknw branch August 29, 2025 14:01
@johanandren johanandren added this to the 2.10.10 milestone Aug 29, 2025
override def parse(reader: ByteReader): ParseResult[EnvelopeBuffer] = {
val frameLength = reader.readIntLE()
if (frameLength > maxFrameLength)
throw new FramingException(s"Too long frame [$frameLength], max length is [$maxFrameLength]")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll verify one more thing before we include this in a release. Perhaps it's not great to fail the entire inbound stream in this case. Not sure how that error is handled. Might be better to discard, if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have confirmed that it's ok to throw FramingException. It will close that connection, but it's possible to continue fine after that.

outbound connection to [akka://RemoteConnectionSpec-remote-0@localhost:51094], message stream] Upstream failed, cause: StreamTcpException: The connection closed with error: Connection reset

It's possible to trigger such FramingException in other ways, such as wrong magic, non-matching frame length and such, so we can handle this in the same way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants