Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

[#6590] Error while saving bot state to azure blob storage#6595

Merged
tracyboehrer merged 2 commits into
mainfrom
southworks/update/serialization-binder
Mar 8, 2023
Merged

[#6590] Error while saving bot state to azure blob storage#6595
tracyboehrer merged 2 commits into
mainfrom
southworks/update/serialization-binder

Conversation

@sw-joelmut
Copy link
Copy Markdown
Collaborator

Fixes #6590

Description

This PR refactors the use of AllowedTypesSerializationBinder to be optionally provided through a JsonSerializer configuration across Blobs and CosmosDB storage constructors.

Behavior of AllowedTypesSerializationBinder:

  • It will only be used in the Blobs and CosmosDB storage when provided through the JsonSerializer.SerializationBinder, otherwise it will not execute any related code to the class.
  • When provided, it will evaluate which types need to be allowed and fail with a message to do so.
  • When provided with all the types to allow, it will behave as normal, but with an extra layer of security to allow only desired types in the application.

Specific Changes

  • Removed all code that was making Blobs, AzureBlobs (removed altogether, since it's deprecated) and CosmosDB storage dependent of the AllowedTypesSerializationBinder class, leaving only the verification process when the class is provided.
  • Updated the AllowedTypesSerializationBinder internal class behavior, removing the process that loads the types dynamically to use only the ones provided by the user, and added a step to recognize types that are represented as a generic type (e.g. List).
  • Updated the tests related to this process by removing the ones that weren't necessary anymore, and adding new ones to test when the AllowedTypesSerializationBinder is provided through the JsonSerializer instance.

Testing

The following images show the unit tests passing successfully and how the new binder implementation works.
image
image

@sw-joelmut sw-joelmut added the Automation: No parity PR does not need to be applied to other languages. label Feb 27, 2023
@sw-joelmut sw-joelmut requested a review from a team as a code owner February 27, 2023 16:46
@coveralls
Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 342214

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 5 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 79.098%

Files with Coverage Reduction New Missed Lines %
/libraries/AdaptiveExpressions/BuiltinFunctions/GetNextViableTime.cs 1 90.91%
/libraries/AdaptiveExpressions/BuiltinFunctions/GetPreviousViableTime.cs 1 90.91%
/libraries/Microsoft.Bot.Builder/AllowedTypesSerializationBinder.cs 3 95.65%
Totals Coverage Status
Change from base Build 341699: -0.01%
Covered Lines: 25813
Relevant Lines: 32634

💛 - Coveralls

@BruceHaley
Copy link
Copy Markdown
Contributor

✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.dll
✔️ No Binary Compatibility issues for Microsoft.Bot.Builder.Azure.dll

@tracyboehrer tracyboehrer requested a review from johnataylor March 7, 2023 15:26
@tracyboehrer tracyboehrer merged commit dc923ad into main Mar 8, 2023
@tracyboehrer tracyboehrer deleted the southworks/update/serialization-binder branch March 8, 2023 13:59
This was referenced May 14, 2026
This was referenced May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Automation: No parity PR does not need to be applied to other languages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error while saving bot state to azure blob storage

5 participants