Repository navigation
Reject Put Blob requests that target a snapshot URL - #2863
Open
Joel Town Road (hippi345) wants to merge 1 commit into
Open
Joel Town Road (hippi345) wants to merge 1 commit into
Joel Town Road (hippi345) wants to merge 1 commit into
Conversation
Put Blob with a snapshot query parameter was applied to the base blob. Reject it with 400 InvalidOperation, matching Azure Storage.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The localized guard addresses the reported overwrite with focused regression coverage and no unresolved findings; tests were not rerun.
No open issues 🎉
What changed in this PR
Prevents snapshot-targeted block blob uploads from overwriting the base blob, addressing #2854.
Changes:
- Rejects non-empty snapshot parameters with
400 InvalidOperationbefore persistence. - Adds regression coverage for the error response and unchanged base content.
- Documents the fix in the changelog.
| File | Description |
|---|---|
| tests/blob/apis/blob.test.ts | Tests snapshot upload rejection and base content preservation. |
| src/blob/handlers/BlockBlobHandler.ts | Adds an early snapshot-write rejection guard. |
| ChangeLog.md | Records the snapshot-write fix. |
Review effort: Balanced
Joel Town Road (hippi345)
marked this pull request as ready for review
October 17, 2026 01:47
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.
Problem
Put Blob sent to a blob URL that includes
?snapshot=was applied to the base blob. A snapshot write returned 201, after which GET on the base blob returned the new body. Snapshots are read-only; Azure Storage rejects this write.Fixes #2854
Fix
BlockBlobHandler.uploadnow rejects a non-emptysnapshotquery parameter before any content is persisted, with:InvalidOperationInvalid operation against a blob snapshot.This matches Blob Storage error codes (
InvalidOperation/ Bad Request (400) / "Invalid operation against a blob snapshot."), Put Blob (URI parameters list onlytimeout, notsnapshot), and Snapshot Blob remarks (a snapshot is a read-only copy).Testing
New test in
tests/blob/apis/blob.test.ts: Put Blob to a snapshot URL is rejected (400/InvalidOperation/ the Azure message) and the base blob content is unchanged.Before (unmodified upstream
main):After (this change):
This change was prepared with AI assistance. I remain responsible for the contribution and have reviewed it.