-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close connection when invalid framing is detected (#8692)
* Ensure message is always set to null before deframing/deserializing to ensure that corruption triggers connection shutdown. * Close connection when invalid framing is detected * Fix tests * Avoid complex exception filters * Update src/Orleans.Core/Messaging/InvalidMessageFrameException.cs Co-authored-by: David Pine <[email protected]> --------- Co-authored-by: David Pine <[email protected]>
- Loading branch information
1 parent
eef2802
commit d3e7d94
Showing
4 changed files
with
75 additions
and
18 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
src/Orleans.Core/Messaging/InvalidMessageFrameException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Orleans.Runtime.Messaging; | ||
|
||
/// <summary> | ||
/// Indicates that a message frame is invalid, either when sending a message or receiving a message. | ||
/// </summary> | ||
[GenerateSerializer] | ||
public sealed class InvalidMessageFrameException : OrleansException | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InvalidMessageFrameException"/> class. | ||
/// </summary> | ||
public InvalidMessageFrameException() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InvalidMessageFrameException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
public InvalidMessageFrameException(string message) : base(message) | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InvalidMessageFrameException"/> class. | ||
/// </summary> | ||
/// <param name="message">The message that describes the error.</param> | ||
/// <param name="innerException">The exception that is the cause of the current exception.</param> | ||
public InvalidMessageFrameException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
|
||
protected InvalidMessageFrameException(SerializationInfo info, StreamingContext context) : base(info, context) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters