-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add strict client side response validation for gRPC chunked resumable uploads #2527
Merged
Conversation
This file contains 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
Collaborator
BenWhitehead
commented
May 6, 2024
- Rename JsonResumableSessionFailureScenario to ResumableSessionFailureScenario. The failure scenarios themselves are not json specific, and the methods which are json specific can have grpc overloads
- Add more tests to validate GapicUnbufferedChunkedResumableWritableByteChannel is able to properly detect and handle various success responses from GCS which are not success for the client.
…mable uploads * Rename JsonResumableSessionFailureScenario to ResumableSessionFailureScenario. The failure scenarios themselves are not json specific, and the methods which are json specific can have grpc overloads * Add more tests to validate GapicUnbufferedChunkedResumableWritableByteChannel is able to properly detect and handle various success responses from GCS which are not success for the client. * Trim down ResumableWrite a bit as the logic
product-auto-label
bot
added
size: xl
Pull request size is extra large.
api: storage
Issues related to the googleapis/java-storage API.
labels
May 6, 2024
sydney-munro
approved these changes
May 7, 2024
This was referenced May 7, 2024
BenWhitehead
added a commit
that referenced
this pull request
May 28, 2024
Follow up to #2527 This updated errors from grpc single-shot uploads to have messages that include useful debugging information. When a response is received but doesn't validate with the expected state: ``` com.google.cloud.storage.StorageException: Finalized upload, but object size less than expected. |> [ |> com.google.storage.v2.WriteObjectRequest{ |> write_offset: 524288 |> finish_write: true |> } |> ] | |< com.google.storage.v2.WriteObjectResponse{ |< resource { |< name: "obj" |< size: 262144 |< } |< } | ```
BenWhitehead
added a commit
that referenced
this pull request
May 28, 2024
Follow up to #2527 This updated errors from grpc single-shot uploads to have messages that include useful debugging information. When a response is received but doesn't validate with the expected state: ``` com.google.cloud.storage.StorageException: Finalized upload, but object size less than expected. |> [ |> com.google.storage.v2.WriteObjectRequest{ |> write_offset: 524288 |> finish_write: true |> } |> ] | |< com.google.storage.v2.WriteObjectResponse{ |< resource { |< name: "obj" |< size: 262144 |< } |< } | ```
BenWhitehead
added a commit
that referenced
this pull request
May 28, 2024
Follow up to #2527 This updated errors from grpc single-shot uploads to have messages that include useful debugging information. When a response is received but doesn't validate with the expected state: ``` com.google.cloud.storage.StorageException: Finalized upload, but object size less than expected. |> [ |> com.google.storage.v2.WriteObjectRequest{ |> write_offset: 524288 |> finish_write: true |> } |> ] | |< com.google.storage.v2.WriteObjectResponse{ |< resource { |< name: "obj" |< size: 262144 |< } |< } | ```
BenWhitehead
added a commit
that referenced
this pull request
May 31, 2024
Follow up to #2527 Part 1, add tests and simulation server
BenWhitehead
added a commit
that referenced
this pull request
May 31, 2024
Follow up to #2527 Cleanup unused inner-class
BenWhitehead
added a commit
that referenced
this pull request
May 31, 2024
Follow up to #2527 Move request trimming inline rather than at the end
BenWhitehead
added a commit
that referenced
this pull request
May 31, 2024
Follow up to #2527 Update GapicBidiUnbufferedWritableByteChannel to correctly handle failure scenarios {1, 2, 3, 4, 4_1, 4_2, 5, 7} Refactor ResumableSessionFailureScenario to accept Message and List rather than WriteObjectResponse and List<WriteObjectRequest>. The shape of BidiWriteObjectRequest/WriteObjectRequest and BidiWriteObjectResponse/WriteObjectResponse are largely the same (bidi has two extra fields) so rather than overloading toStorageException yet again, this time there is a single method for grpc messages that internally can branch when formatting the request. In this case, we're quite safe taking this relaxed typing because it is an internal API that is only called from a grpc context where protos will be used.
BenWhitehead
added a commit
that referenced
this pull request
May 31, 2024
Follow up to #2527 Update GapicBidiUnbufferedWritableByteChannel to correctly handle partial consumption of content Tests passing now. Separate tracking of client detected errors and stream errors. When await is invoked, if a client detected error is present AND a stream error is present, the client detected error will take precedence. If a stream error happens and the client detected error has not yet been observed, the stream error will be added as a suppressed exception to the client detected error.
BenWhitehead
added a commit
that referenced
this pull request
Jun 3, 2024
…d object size Follow up to #2527 Add ITGapicUnbufferedFinalizeOnCloseResumableWritableByteChannelTest with failure scenarios
BenWhitehead
added a commit
that referenced
this pull request
Jun 11, 2024
…2567) Follow up to #2527 This updated errors from grpc single-shot uploads to have messages that include useful debugging information. When a response is received but doesn't validate with the expected state: ``` com.google.cloud.storage.StorageException: Finalized upload, but object size less than expected. |> [ |> com.google.storage.v2.WriteObjectRequest{ |> write_offset: 524288 |> finish_write: true |> } |> ] | |< com.google.storage.v2.WriteObjectResponse{ |< resource { |< name: "obj" |< size: 262144 |< } |< } | ```
BenWhitehead
added a commit
that referenced
this pull request
Jun 13, 2024
…d object size (#2572) * fix: update grpc finalize on close resumable uploads to validate ack'd object size Follow up to #2527 Add ITGapicUnbufferedFinalizeOnCloseResumableWritableByteChannelTest with failure scenarios * fix: update grpc finalize on close resumable uploads to validate ack'd object size Refactoring to clean up some request building lifecycle and variable scope * fix: update grpc finalize on close resumable uploads to validate ack'd object size Tests are passing
BenWhitehead
added a commit
that referenced
this pull request
Jun 13, 2024
…#2570) * fix: update grpc bidi resumable uploads to validate ack'd object size Follow up to #2527 Part 1, add tests and simulation server * fix: update grpc bidi resumable uploads to validate ack'd object size Follow up to #2527 Cleanup unused inner-class * fix: update grpc bidi resumable uploads to validate ack'd object size Follow up to #2527 Move request trimming inline rather than at the end * fix: update grpc bidi resumable uploads to validate ack'd object size Follow up to #2527 Update GapicBidiUnbufferedWritableByteChannel to correctly handle failure scenarios {1, 2, 3, 4, 4_1, 4_2, 5, 7} Refactor ResumableSessionFailureScenario to accept Message and List rather than WriteObjectResponse and List<WriteObjectRequest>. The shape of BidiWriteObjectRequest/WriteObjectRequest and BidiWriteObjectResponse/WriteObjectResponse are largely the same (bidi has two extra fields) so rather than overloading toStorageException yet again, this time there is a single method for grpc messages that internally can branch when formatting the request. In this case, we're quite safe taking this relaxed typing because it is an internal API that is only called from a grpc context where protos will be used. * fix: update grpc bidi resumable uploads to validate ack'd object size Follow up to #2527 Update GapicBidiUnbufferedWritableByteChannel to correctly handle partial consumption of content Tests passing now. Separate tracking of client detected errors and stream errors. When await is invoked, if a client detected error is present AND a stream error is present, the client detected error will take precedence. If a stream error happens and the client detected error has not yet been observed, the stream error will be added as a suppressed exception to the client detected error. * chore: fix failing tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: storage
Issues related to the googleapis/java-storage API.
owlbot:ignore
instruct owl-bot to ignore a PR
size: xl
Pull request size is extra large.
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.