GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — fix(serialization)!: enforce type allow-list in default JSON storage serializer by ReubenBond · Pull Request #10268 · dotnet/orleans Conversation
|
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
44143cf to
8d48046
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This PR hardens Orleans’ default Newtonsoft.Json-based serializer path (grain storage/JSON streaming/transactional state) by enforcing the existing Orleans type allow-list when resolving $type values emitted under TypeNameHandling.All, mitigating gadget-chain deserialization risks while keeping the wire format compatible.
Changes:
OrleansJsonSerializationBinder to resolve types through TypeConverter (allow-list enforcement), with an opt-out flag for legacy permissive behavior.OrleansJsonSerializerOptions.AllowAllTypes and plumb it through default JSON serializer settings configuration.| File | Description |
|---|---|
| test/Orleans.Core.Tests/Serialization/OrleansJsonSerializationBinderTests.cs | Adds coverage for strict vs permissive binder behavior during type binding and deserialization. |
| src/Orleans.Core/Serialization/OrleansJsonSerializerSettings.cs | Threads AllowAllTypes from options into binder creation for default JSON settings. |
| src/Orleans.Core/Serialization/OrleansJsonSerializerOptions.cs | Adds AllowAllTypes option and ensures settings are configured accordingly. |
| src/Orleans.Core/Serialization/OrleansJsonSerializationBinder.cs | Enforces Orleans type allow-list via TypeConverter, with legacy permissive compatibility path. |
| src/api/Orleans.Core/Orleans.Core.cs | Updates public API surface for new constructor and options property. |
test/Orleans.Core.Tests/Serialization/OrleansJsonSerializationBinderTests.cs:126
Assert.ThrowsAny<Exception>(() => JsonConvert.DeserializeObject(json, typeof(object), settings));
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
…erializer The default grain-storage serializer (`JsonGrainStorageSerializer` -> `OrleansJsonSerializer`) is configured with `TypeNameHandling.All`, and its `OrleansJsonSerializationBinder` resolved any type named in the payload's `$type` token (via `CachedTypeResolver` and Newtonsoft's permissive `DefaultSerializationBinder`). This let an attacker who can influence persisted/streamed/transactional state cause arbitrary CLR types to be constructed during deserialization (a classic `TypeNameHandling.All` gadget-chain vulnerability). Make the binder enforce Orleans' existing type allow-list (reusing `TypeConverter` / `ITypeNameFilter` / `TypeManifestOptions.AllowedTypes`) instead of building a parallel Newtonsoft-specific mechanism. Types marked `[GenerateSerializer]` are already auto-allow-listed and keep working with no changes; BCL collections/primitives remain permitted by `DefaultTypeFilter`. Disallowed `$type` tokens now throw an actionable `JsonSerializationException`. This is secure by default with an opt-out: the new `OrleansJsonSerializerOptions.AllowAllTypes` (default false) restores the previous permissive behavior for the JSON storage/streaming/transaction path only, without weakening the native serializer's global filtering. The legacy `OrleansJsonSerializationBinder(TypeResolver)` constructor is retained (permissive) for API compatibility. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 75c9fe25-7322-4eb8-b0d4-a475959d5658
8d48046 to
2494046
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
src/Orleans.Core/Serialization/OrleansJsonSerializationBinder.cs:33
_typeConverter, but _typeConverter is a readonly field. This will not compile (readonly fields must be definitely assigned in every constructor). public OrleansJsonSerializationBinder(TypeResolver typeResolver)
{
_typeResolver = typeResolver;
_allowAllTypes = true;
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.