rich7420 opened a new pull request, #10670:
URL: https://github.com/apache/ozone/pull/10670
## What changes were proposed in this pull request?
When an S3 `GetObject`/`HeadObject` request carries a `partNumber` that does
not
exist in the object, Ozone silently returned an empty (0-byte) body with a
`200`
response, instead of rejecting the request. AWS S3 returns `400 InvalidPart`
in
this case.
This PR validates the requested part number in the OM read path
(`KeyManagerImpl.readKeyInfo`):
- **Multipart key** — filter the key's blocks by the requested part number.
If no
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 part `3` is valid but part `2` is not).
- **Non-multipart key** — `partNumber == 1` returns the whole object (AWS
semantics); any `partNumber > 1` is out of range and throws
`OMException(INVALID_PART)`.
`INVALID_PART` is already mapped to the S3 `InvalidPart` error (`400`) by
`S3ErrorTable`, 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]