Bablu Raul created HDDS-17645:
---------------------------------

             Summary: S3 ListParts with max-parts=0 or a negative value returns 
HTTP 500 instead of an S3 error
                 Key: HDDS-17645
                 URL: https://issues.apache.org/jira/browse/HDDS-17645
             Project: Apache Ozone
          Issue Type: Bug
          Components: S3
            Reporter: Bablu Raul


Calling S3 {{ListParts}} with {{max-parts=0}} or a negative value (for example, 
{{{}-1{}}}) returns HTTP 500 {{InternalError}} from the S3 Gateway.

The S3 Gateway passes the value to the Ozone client without validating it. The 
Ozone client throws an {{IllegalArgumentException}} because {{maxParts}} must 
be greater than zero. This exception is not translated into an appropriate S3 
error and results in a generic HTTP 500 response.

Valid values such as {{1}} and {{1000}} work correctly.
h3. Steps to Reproduce
 # Create a bucket and initiate a multipart upload.

 # Upload two parts to the multipart upload.

 # Verify that {{ListParts}} works with valid values:

{{A s3api list-parts --bucket "$BKT" --key "$KEY" --upload-id "$UPID" 
--max-parts 1

A s3api list-parts --bucket "$BKT" --key "$KEY" --upload-id "$UPID" --max-parts 
1000}}
 # Call {{ListParts}} with {{{}max-parts=0{}}}:

{{A s3api list-parts --bucket "$BKT" --key "$KEY" --upload-id "$UPID" 
--max-parts 0}}
 # Repeat with a negative value:

{{A s3api list-parts --bucket "$BKT" --key "$KEY" --upload-id "$UPID" 
--max-parts -1}}
h3. Actual Result
 * {{ListParts}} works correctly with valid {{max-parts}} values.

 * Requests with {{max-parts=0}} or negative values return HTTP 500.

 * The client retries the request multiple times because the response is 
treated as a retryable server error.

 * The S3 Gateway logs show an unhandled {{{}IllegalArgumentException{}}}:

{{java.lang.IllegalArgumentException:
Max Parts Should be greater than zero}}
 * The response does not contain a proper S3 XML error body.

h3. Expected Result

The S3 Gateway should validate {{max-parts}} before calling the Ozone client 
and reject zero or negative values with HTTP 400 {{InvalidArgument}} and a 
proper S3 XML error response.

Invalid input should not result in HTTP 500 or unnecessary client retries.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

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

Reply via email to