rich7420 opened a new pull request, #10711:
URL: https://github.com/apache/ozone/pull/10711

   ## What changes were proposed in this pull request?
   
   `UploadPartCopy` read the `x-amz-copy-source-range` header but never 
validated it
   against the source object. In `ObjectEndpoint.createMultipartKey` the range 
was
   parsed with a hard-coded length of `0` and the result was never checked, so:
   
   - an **out-of-range** range was silently clamped and surfaced as a generic
     `InvalidRequest`, and
   - a **malformed** range did not match the parser's pattern and fell through 
to
     "read the whole object", raising no error at all.
   
   This aligns `UploadPartCopy` with AWS S3 by validating the header:
   
   - If the value is not a single numeric byte range (`bytes=<start>-<end>`), 
return
     **`InvalidArgument`** (HTTP 400). This rejects values such as `0-2` 
(missing
     `bytes=`), `bytes=0` (no end), `bytes=hello-world`, `bytes=0-bar`, 
`bytes=hello-`,
     and `bytes=0-2,3-5` (multiple ranges).
   - If `start > end` or `end` is beyond the source object size, return
     **`InvalidRange`** (HTTP 416; AWS also permits 400). Example: a 5-byte 
source with
     `bytes=0-21`.
   - A valid range is unchanged: the target part length is `end - start + 1` 
and the
     existing copy path is used.
   
   Both `InvalidArgument` and `InvalidRange` already exist in `S3ErrorTable`, 
so no new
   error codes or wire changes are needed. The change is confined to the 
UploadPartCopy
   branch; `CopyObject` (without a part) and normal `GetObject`/`PutObject` 
paths are
   untouched, and the shared `RangeHeaderParserUtil` (used by `GetObject`) is 
not
   modified.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15809
   
   ## How was this patch tested?
   
   https://github.com/rich7420/ozone/actions/runs/29078906089


-- 
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]

Reply via email to