Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/DurableTask.AzureStorage/MessageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace DurableTask.AzureStorage
{
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.IO.Compression;
using System.Linq;
Expand Down Expand Up @@ -51,6 +52,14 @@ class MessageManager

bool containerInitialized;

[SuppressMessage(
"Security",
"CA2326:Do not use TypeNameHandling values other than None",
Justification = "Required to round-trip polymorphic HistoryEvent payloads through customer-owned Azure Storage. See inline CodeQL suppression comment below.")]
[SuppressMessage(
"Security",
"CA2327:Do not use insecure deserializer settings",
Justification = "Required to round-trip polymorphic HistoryEvent payloads through customer-owned Azure Storage. See inline CodeQL suppression comment below.")]
public MessageManager(
AzureStorageOrchestrationServiceSettings settings,
AzureStorageClient azureStorageClient,
Expand All @@ -59,6 +68,14 @@ public MessageManager(
this.settings = settings;
this.azureStorageClient = azureStorageClient;
this.blobContainer = this.azureStorageClient.GetBlobContainerReference(blobContainerName);
// CodeQL [SM05220] TypeNameHandling.Objects with TypeNameSerializationBinder is required to round-trip
// polymorphic HistoryEvent payloads (and dictionary types like ExecutionStartedEvent.Tags) through
// customer-owned Azure Storage queues/blobs. The DTFx worker and the Storage account sit on the same
// side of the trust boundary: both are authenticated with the customer's tenant credentials, so any
// attacker capable of writing a malicious $type into the queue/blob has already breached the data-plane
// auth boundary that protects the Storage account. The public ICustomTypeBinder extensibility point
// (CustomMessageTypeBinder) lets security-sensitive customers plug in their own allowlist; tightening
// the default binder to a hard-coded allowlist would be a breaking change for the DTFx public API.
this.taskMessageSerializerSettings = new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Objects,
Expand Down
Loading