[Storage] Blob Batch Inner-Header CRLF Injection Bugfix - #50403
Open
Isabelle (ibrandes) wants to merge 3 commits into
Open
[Storage] Blob Batch Inner-Header CRLF Injection Bugfix#50403Isabelle (ibrandes) wants to merge 3 commits into
Isabelle (ibrandes) wants to merge 3 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Security-sensitive header-name validation lacks regression coverage.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds CR/LF validation at Blob Batch inner-header serialization to prevent header injection.
Changes:
- Rejects CR/LF in inner header names and values.
- Adds regression tests and changelog documentation.
File summaries
| File | Description |
|---|---|
BlobBatchOperationInfo.java |
Validates headers before serialization. |
BlobBatchHeaderInjectionTests.java |
Tests malicious values and clean serialization. |
CHANGELOG.md |
Documents the security fix. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The serialization-boundary validation comprehensively addresses the vulnerability and is backed by focused regression coverage.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Isabelle (ibrandes)
marked this pull request as ready for review
September 10, 2026 21:19
Isabelle (ibrandes)
requested review from
a team,
Alan Zimmer (alzimmermsft),
browndav-msft,
gunjansingh-msft,
Kyle Knapp (kyleknap) and
Sean McCullough (seanmcc-msft)
as code owners
September 10, 2026 21:19
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
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.
Reject CR/LF in Blob Batch inner request headers (header-injection fix)
Summary
The Blob Batch client serializes each inner
application/httprequest's headers by concatenating the header name and value directly into the multipart batch body, without rejecting carriage-return (\r) or line-feed (\n) characters. Because these inner headers are emitted as bytes inside the outer request body, the HTTP transport layer never validates them. A caller-controlled header value — for example a blob tag condition supplied through the publicBlobRequestConditions.setTagsConditions(...)API — could therefore terminate the intendedx-ms-if-tagsheader and inject an additional Azure Storage operation-control header such asx-ms-delete-snapshots.This PR adds validation at the final inner-header serialization boundary in
BlobBatchOperationInfo.addBatchOperationthat rejects (rather than strips or normalizes) any\ror\nin inner header names and values, throwingIllegalArgumentException. Rejecting preserves the semantics of the authorized request so it cannot silently acquire a different meaning. Clean headers are unaffected.The non-batch delete path already rejects the same CRLF-bearing value before it reaches the network; this brings the Blob Batch path in line with that behavior.
Changes
BlobBatchOperationInfo.java— added avalidateHeader(...)check applied to each inner header name/value before serialization; added aClientLoggerfor exception logging.BlobBatchHeaderInjectionTests.java— new regression tests (extendingBlobBatchTestBase) covering CRLF, lone CR, lone LF (all rejected) and a clean control (preserved). Tests run fully offline viaprepareBlobBatchSubmission(), which builds the batch body without a network call.CHANGELOG.md— added a "Bugs Fixed" entry under12.32.0-beta.2 (Unreleased).