Repository navigation
fix(storage): validate resumable upload session URL origin in REST stub - #16718
nidhiii-27 wants to merge 1 commit into
Conversation
RestStub now validates that absolute resumable upload session URLs in QueryResumableUpload, DeleteResumableUpload, and UploadChunk match the configured REST endpoint origin (or resolved storage authority with the same scheme) before issuing requests. Relative session paths, custom and emulator endpoints, explicit default ports, and matching origins continue to work unchanged. Added unit tests for resumable upload session URL validation in google/cloud/storage/internal/rest/stub_test.cc. [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces validation for resumable upload session URLs in the REST stub to ensure they match the configured REST endpoint origin or resolved storage authority. It adds helper functions like ParseOrigin and ValidateUploadSessionUrl along with comprehensive unit tests. The reviewer feedback correctly points out that ValidateUploadSessionUrl should be called with the per-call options parameter instead of the class-level options_ member variable in QueryResumableUpload, DeleteResumableUpload, and UploadChunk to ensure per-call option overrides are respected.
| Status valid = | ||
| ValidateUploadSessionUrl(request.upload_session_url(), options_); |
There was a problem hiding this comment.
The function should validate the upload session URL against the call-specific options parameter rather than the client-level options_ member variable. This ensures that any per-call option overrides (such as a custom endpoint or authority) are correctly respected during validation.
Status valid =
ValidateUploadSessionUrl(request.upload_session_url(), options);| Status valid = | ||
| ValidateUploadSessionUrl(request.upload_session_url(), options_); |
There was a problem hiding this comment.
The function should validate the upload session URL against the call-specific options parameter rather than the client-level options_ member variable. This ensures that any per-call option overrides (such as a custom endpoint or authority) are correctly respected during validation.
Status valid =
ValidateUploadSessionUrl(request.upload_session_url(), options);| Status valid = | ||
| ValidateUploadSessionUrl(request.upload_session_url(), options_); |
There was a problem hiding this comment.
The function should validate the upload session URL against the call-specific options parameter rather than the client-level options_ member variable. This ensures that any per-call option overrides (such as a custom endpoint or authority) are correctly respected during validation.
Status valid =
ValidateUploadSessionUrl(request.upload_session_url(), options);
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16718 +/- ##
========================================
Coverage 92.78% 92.79%
========================================
Files 2277 2277
Lines 228147 228356 +209
========================================
+ Hits 211696 211907 +211
+ Misses 16451 16449 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RestStub now validates that absolute resumable upload session URLs in QueryResumableUpload, DeleteResumableUpload, and UploadChunk match the configured REST endpoint origin (or resolved storage authority with the same scheme) before issuing requests. Relative session paths, custom and emulator endpoints, explicit default ports, and matching origins continue to work unchanged. Added unit tests for resumable upload session URL validation in google/cloud/storage/internal/rest/stub_test.cc.