[ 
https://issues.apache.org/jira/browse/HDDS-16115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated HDDS-16115:
----------------------------------
    Labels: pull-request-available  (was: )

> Reject invalid lifecycle rule Status values in S3 Gateway
> ---------------------------------------------------------
>
>                 Key: HDDS-16115
>                 URL: https://issues.apache.org/jira/browse/HDDS-16115
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Shuo Huang
>            Assignee: Shuo Huang
>            Priority: Major
>              Labels: pull-request-available
>
> h3. Problem
> S3 Gateway accepts invalid values for the lifecycle rule \{{Status}} field.
> According to the Amazon S3 API, \{{Status}} is required and only \{{Enabled}} 
> or \{{Disabled}} is valid. However, Ozone accepts values such as lowercase 
> \{{enabled}} and returns HTTP 200.
> h3. Steps to reproduce
> # Create an S3 bucket.
> # Send a PutBucketLifecycleConfiguration request containing:
> {code:xml}
> <LifecycleConfiguration>
>   <Rule>
>     <ID>rule1</ID>
>     <Prefix>test1/</Prefix>
>     <Status>enabled</Status>
>     <Expiration>
>       <Days>2</Days>
>     </Expiration>
>   </Rule>
> </LifecycleConfiguration>
> {code}
> h3. Expected result
> The request is rejected with HTTP 400 and \{{MalformedXML}}.
> h3. Actual result
> The request succeeds with HTTP 200. The invalid value is silently converted 
> to \{{enabled=false}}.
> h3. Root cause
> {\{S3LifecycleConfiguration.convertToOmRule}} only checks whether Status is 
> null or empty. It then converts the value using:
> {code:java}
> .setEnabled("Enabled".equals(rule.getStatus()))
> {code}
> As a result, every non-\{{Enabled}} value is treated as disabled instead of 
> being rejected.
> h3. Compatibility test
> This is detected by:
> {\{s3tests/functional/test_s3.py::test_lifecycle_invalid_status}}
> https://github.com/ceph/s3-tests/blob/fb8b73092bb1dd8db829f1205a9e52e73bf9a232/s3tests/functional/test_s3.py#L9013
> AWS API reference:
> https://docs.aws.amazon.com/AmazonS3/latest/API/API_LifecycleRule.html



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