This repository was archived by the owner on Jan 5, 2026. It is now read-only.
Fix CodeQL SM02211 alert - SerializationBinder#6549
Merged
Conversation
…//github.com/southworks/botbuilder-dotnet into southworks/fix/sm02211-binder-implementation
Member
|
@sw-joelmut This is getting some test failures in the storage tests. Here is one: |
Collaborator
Author
@tracyboehrer, we will review them and let you know once we fix them. Thanks! |
Collaborator
Contributor
|
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll |
Collaborator
Author
|
@tracyboehrer, we updated the failing tests to include the new custom |
tracyboehrer
approved these changes
Nov 16, 2022
tracyboehrer
pushed a commit
that referenced
this pull request
Feb 21, 2023
This reverts commit 1ee5f6a.
tracyboehrer
added a commit
that referenced
this pull request
Feb 23, 2023
* Revert "[#6582, #6584] Incorrect serialization of state when using Blob or CosmosDB storage in v4.19.x (#6585)" This reverts commit e15b38d. * Revert "Fix CodeQL SM02211 alert - SerializationBinder (#6549)" This reverts commit 1ee5f6a. * Skip TypeNameHandling CodeQL issue from Azure and Blobs storage (#6592) --------- Co-authored-by: Tracy Boehrer <trboehre@microsoft.com> Co-authored-by: Joel Mut <62260472+sw-joelmut@users.noreply.github.com>
This was referenced May 14, 2026
This was referenced May 14, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #6515 #6516 #6517 #6519 #6520
Description
This PR fixes the CodeQL SM02211 alert related to unsafe
JsonSerializerTypeNameHandlingusage.For these cases, it implements a custom SerializationBinder, allowing only the types that are defined in the configuration or related ones.
Specific Changes
AllowedTypesSerializationBinderclass to allow only types that are defined in the instance.AllowedTypesSerializationBinderclass.BlobsStorage,AzureBlobStorage, andCosmosDbPartitionedStorageclasses to implement the binder.BlobsTranscriptStoresetting theTypeNameHandlingto None.Testing
The following image shows the tests passing successfully and the error message when a type isn't allowed by the process.

