Huang Kuan Hao created HDDS-15740:
-------------------------------------

             Summary: Validate partNumber on GetObject/HeadObject and return 
InvalidPart for out-of-range parts
                 Key: HDDS-15740
                 URL: https://issues.apache.org/jira/browse/HDDS-15740
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


GetObject/HeadObject with a partNumber query parameter is not range-validated, 
so Ozone silently returns wrong results instead of the expected 400 InvalidPart:

- Multipart object, out-of-range partNumber: the block locations are filtered 
by part number and yield an empty list, so the gateway returns HTTP 200 with a 
0-byte body instead of 400 InvalidPart.
- Non-multipart object, partNumber > 1: the multipart filter is skipped 
entirely (isMultipartKey() == false), so the partNumber is ignored and the full 
object is returned with 200 instead of 400 InvalidPart.

Both cases make the s3-tests' assert_raises(ClientError, ...) never fire 
(ClientError not raised).

To align with AWS S3: validate the requested partNumber against the object's 
actual part count and throw InvalidPart (HTTP 400) when it is out of range 
(multipart) or > 1 (non-multipart). partNumber = 1 on a non-multipart object 
must still return the whole object.

Notes:
- ResultCodes.INVALID_PART → S3 InvalidPart/400 is already wired in 
S3ErrorTable.translateResultCode, and ObjectEndpoint GET/HEAD already routes 
OMException through newError(), so this is mainly a validation gap in the OM 
read path.
- The two sse_c_get_part tests share this exact root cause — SSE-C is 
irrelevant (Ozone reuses the key consistently); they pass once partNumber is 
validated.

Failing Ceph s3-tests (5):
- test_multipart_get_part
- test_multipart_single_get_part
- test_non_multipart_get_part
- test_multipart_sse_c_get_part
- test_non_multipart_sse_c_get_part

Code pointers:
- OM read path (root cause): 
hadoop-ozone/ozone-manager/.../om/KeyManagerImpl.java getKeyInfo() / 
getOmKeyInfo() (~L634–649 — add
partNumber range validation)
- Gateway: hadoop-ozone/s3gateway/.../endpoint/ObjectEndpoint.java GET/HEAD 
(handleGetRequest, ~L374–386); parts count via
EndpointBase.extractPartsCount (~L738)
- Client forwarding: RpcClient.java getS3KeyDetails/getS3PartKeyInfo 
(~L1864–1909)
- Prior related (merged, happy-path only, does not cov

Ref: https://ozone.s3.peterxcli.dev/



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to