HDDS-15740. Validate partNumber on GetObject and return InvalidPart for out-of-range parts#10670
Open
rich7420 wants to merge 1 commit into
Open
HDDS-15740. Validate partNumber on GetObject and return InvalidPart for out-of-range parts#10670rich7420 wants to merge 1 commit into
rich7420 wants to merge 1 commit into
Conversation
…or out-of-range parts Validate the requested partNumber against the object's actual part count in the OM read path (KeyManagerImpl.readKeyInfo): - Multipart key: throw InvalidPart when partNumber exceeds the number of parts (previously returned an empty 0-byte HTTP 200). - Non-multipart key: throw InvalidPart when partNumber > 1 (previously the partNumber was silently ignored and the whole object returned); partNumber == 1 still returns the whole object. Update existing tests that asserted the old (0-byte) out-of-range behavior to expect InvalidPart: TestKeyManagerImpl, TestOzoneClientMultipartUploadWithFSO, AbstractS3SDKV1Tests, and the objectputget.robot acceptance test. Fixes ceph s3-tests test_multipart_get_part, test_multipart_single_get_part, test_non_multipart_get_part, test_multipart_sse_c_get_part and test_non_multipart_sse_c_get_part.
Contributor
|
Thanks @rich7420 for the patch! |
sreejasahithi
left a comment
Contributor
There was a problem hiding this comment.
Thanks @rich7420 for the PR
Could you please add a test for the non-contiguous part numbers case as well.
As testGetNotExistedPart covers part 4 on a contiguous 1–3 part object (beyond max).
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.
What changes were proposed in this pull request?
When an S3
GetObject/HeadObjectrequest carries apartNumberthat does notexist in the object, Ozone silently returned an empty (0-byte) body with a
200response, instead of rejecting the request. AWS S3 returns
400 InvalidPartinthis case.
This PR validates the requested part number in the OM read path
(
KeyManagerImpl.readKeyInfo):block matches, the part does not exist, so throw
OMException(INVALID_PART).This is done by presence (empty filtered list), not by a part count, so it
correctly handles objects completed with non-contiguous part numbers
(e.g. parts
{1, 3}where part3is valid but part2is not).partNumber == 1returns the whole object (AWSsemantics); any
partNumber > 1is out of range and throwsOMException(INVALID_PART).INVALID_PARTis already mapped to the S3InvalidParterror (400) byS3ErrorTable, so no gateway/wire changes are needed.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15740
How was this patch tested?
https://github.com/rich7420/ozone/actions/runs/28732155743