Skip to content

Commit 89a7a10

Browse files
AnatoliBCopilot
andcommitted
Suppress SM05220 in src/DurableTask.AzureStorage/MessageManager.cs
Resolving https://msazure.visualstudio.com/Antares/_workitems/edit/37181656 Co-authored-by: Copilot <copilot@github.com>
1 parent 553d281 commit 89a7a10

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/DurableTask.AzureStorage/MessageManager.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace DurableTask.AzureStorage
1515
{
1616
using System;
17+
using System.Diagnostics.CodeAnalysis;
1718
using System.IO;
1819
using System.IO.Compression;
1920
using System.Linq;
@@ -51,6 +52,14 @@ class MessageManager
5152

5253
bool containerInitialized;
5354

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

0 commit comments

Comments
 (0)