Skip to content

Add a serialization binder for Service Fabric provider proxy#1363

Draft
AnatoliB wants to merge 1 commit into
mainfrom
anatolib/servicefabric-serialization-binder
Draft

Add a serialization binder for Service Fabric provider proxy#1363
AnatoliB wants to merge 1 commit into
mainfrom
anatolib/servicefabric-serialization-binder

Conversation

@AnatoliB
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 29, 2026 23:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-out ISerializationBinder (defaulting to a new AllowedTypesSerializationBinder) to the Service Fabric proxy listener so that JSON deserialization with TypeNameHandling.All only resolves types from a small allow-list of assemblies (DurableTask.Core, DurableTask.AzureServiceFabric, mscorlib, System.Private.CoreLib), mitigating untrusted $type payload attacks against the proxy endpoint.

Changes:

  • New AllowedTypesSerializationBinder that gates BindToType by assembly short-name and delegates to DefaultSerializationBinder.
  • New JsonSerializationBinder setting on FabricOrchestrationProviderSettings, plumbed through TaskHubProxyListenerStartup and applied to the Web API JSON formatter.
  • Documentation update and unit tests covering allow/deny and round-trip behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/DurableTask.AzureServiceFabric/Service/AllowedTypesSerializationBinder.cs New binder restricting deserialization to allow-listed assemblies.
src/DurableTask.AzureServiceFabric/FabricOrchestrationProviderSettings.cs Adds JsonSerializationBinder setting (defaulted to the new binder).
src/DurableTask.AzureServiceFabric/Service/TaskHubProxyListener.cs Passes the configured binder to Startup.
src/DurableTask.AzureServiceFabric/Service/Startup.cs Accepts and applies the binder on the Web API JSON formatter.
docs/providers/service-fabric.md Documents the new setting and a serialization-security section.
Test/DurableTask.AzureServiceFabric.Tests/AllowedTypesSerializationBinderTests.cs Unit tests for the binder and settings — placed in the legacy Test/ directory not referenced by the solution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// limitations under the License.
// ----------------------------------------------------------------------------------

namespace DurableTask.AzureServiceFabric.Tests
Comment on lines +30 to +36
static readonly HashSet<string> AllowedAssemblyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
typeof(Core.TaskMessage).Assembly.GetName().Name, // DurableTask.Core
typeof(FabricOrchestrationProvider).Assembly.GetName().Name, // DurableTask.AzureServiceFabric
"mscorlib", // .NET Framework core types
"System.Private.CoreLib", // .NET Core/5+ core types
};
class Startup : IOwinAppBuilder
{
FabricOrchestrationProvider fabricOrchestrationProvider;
ISerializationBinder serializationBinder;
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.

2 participants