fix(azure blob sink): Fix Shared Key auth for multipart uploads - #25978
Open
ArunPiduguDD wants to merge 6 commits into
Open
fix(azure blob sink): Fix Shared Key auth for multipart uploads#25978ArunPiduguDD wants to merge 6 commits into
ArunPiduguDD wants to merge 6 commits into
Conversation
🎉 All green!🧪 All tests passed 🔗 Commit SHA: e849eb1 | Docs | Datadog PR Page | Give us feedback! |
ArunPiduguDD
marked this pull request as ready for review
July 31, 2026 17:05
Sign the known request body length when Azure's SDK has not set Content-Length before Shared Key authorization. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-terra <noreply@pi.dev> Co-authored-by: ArunPiduguDD <arun.pidugu@datadoghq.com>
Add a known body length to the request so Shared Key signing and the HTTP transport use the same explicit header. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-sol <noreply@pi.dev> Co-authored-by: ArunPiduguDD <arun.pidugu@datadoghq.com>
Limit this change to explicit content-length handling and retain the existing policy placement. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-sol <noreply@pi.dev> Co-authored-by: ArunPiduguDD <arun.pidugu@datadoghq.com>
Move the Shared Key policy test module to the end of the file to satisfy Clippy. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-sol <noreply@pi.dev> Co-authored-by: ArunPiduguDD <arun.pidugu@datadoghq.com>
Use the lowercase HTTP header spelling in the Shared Key policy comment. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-sol <noreply@pi.dev> Co-authored-by: ArunPiduguDD <arun.pidugu@datadoghq.com>
ArunPiduguDD
force-pushed
the
arun.pidugu/azure-shared-key-content-length
branch
from
July 31, 2026 17:38
3511aa6 to
95978b6
Compare
Describe the multipart completion failure and the Shared Key signing correction. Environment: Datadog workspace Co-Authored-By: Pi ai-gw-openai/openai/gpt-5.6-sol <noreply@pi.dev>
bruceg
approved these changes
Aug 1, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fix Azure Blob Storage uploads that use an account-key connection string and are large enough to be sent in multiple parts.
When Vector is configured with an account-key connection string, it uses Shared Key authorization. Shared Key authorization constructs a signature from several parts of the request, including its
Content-Length.For uploads of 4 MiB or less, the Azure SDK sends a single request and provides its
content-lengthbefore Vector constructs the signature. Larger uploads are divided into blocks. After uploading those blocks, the SDK sends a finalPut Block Listrequest containing an XML body that identifies the blocks belonging to a single upload.Previously, this final block-list request was signed before the HTTP transport determined the XML body's
content-length. Vector therefore signed an empty content-length field, while Azure validated the signature using the body length it received. Because the two signatures were based on different values, Azure rejected the request with403 AuthorizationFailure.This change makes Vector's Shared Key policy add an explicit
content-lengthheader from the known request body length when the SDK has not already provided one. Vector then constructs the signature from that header, and the HTTP transport sends the same header to Azure. The policy preserves an explicit nonzero header supplied by the SDK and represents a zero-length body as an empty field in the signature, as required by Azure's Shared Key rules.Example of the affected request flow before this change:
After this change:
Vector configuration
No configuration changes are needed. This affects existing Azure Blob sink configurations that use a connection string with an account key, for example:
SAS URL and Microsoft Entra ID authentication are not affected because they do not use this per-request Shared Key signature.
How did you test this PR?
Content-Length: 0while representing it as an empty canonical field.?comp=blocklistwith403 AuthorizationFailure.?comp=blocklistrequest with201.Is this a breaking change?
Does this PR include user facing changes?
changelog.d/azure_blob_shared_key_multipart.fix.md.no-changeloglabel to this PR.References