Add a serialization binder for Service Fabric provider proxy#1363
Draft
AnatoliB wants to merge 1 commit into
Draft
Add a serialization binder for Service Fabric provider proxy#1363AnatoliB wants to merge 1 commit into
AnatoliB wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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
AllowedTypesSerializationBinderthat gatesBindToTypeby assembly short-name and delegates toDefaultSerializationBinder. - New
JsonSerializationBindersetting onFabricOrchestrationProviderSettings, plumbed throughTaskHubProxyListener→Startupand 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; |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.