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

Chung-En Lee updated HDDS-17703:
--------------------------------
    Description: 
A lifecycle rule whose {{Tag}} filter has no {{Value}}, or no {{Key}}, is saved 
with an empty filter, so the rule applies to every key in the bucket. AWS S3 
rejects such a body with 400 MalformedXML.

Steps to reproduce:
# Send PutBucketLifecycleConfiguration with this rule:
{{<Rule><ID>r1</ID><Filter><Tag><Key>a</Key></Tag></Filter><Status>Enabled</Status><Expiration><Days>1</Days></Expiration></Rule>}}
# Send GetBucketLifecycleConfiguration.

Actual: Step 1 returns 200. Step 2 returns the rule with {{<Filter/>}}. With 
{{ozone.lifecycle.service.enabled=true}}, KeyLifecycleService expires keys that 
don't have tag {{a}} (tested in {{TestKeyLifecycleService}}, OBS and FSO 
buckets).

Expected: Step 1 returns 400 MalformedXML and nothing is saved, as on AWS S3.

The same {{Tag}} inside {{<And>}} returns 500 instead, with a 
NullPointerException in the S3 Gateway log. AWS S3 returns 400 MalformedXML for 
that body too.

The fix should ensure that:
* A {{Tag}} without {{Key}} or {{Value}} is rejected with 400 MalformedXML, in 
{{Filter}}, and the bucket keeps its current configuration.
* OM rejects such a filter too, because 
{{OzoneBucket#setLifecycleConfiguration}} reaches OM without going through S3 
Gateway.
* A {{Tag}} with an empty {{Value}} is still accepted. AWS S3 accepts it inside 
{{And}}.

  was:
A lifecycle rule whose {{Tag}} filter has no {{Value}}, or no {{Key}}, is saved 
with an empty filter, so the rule applies to every key in the bucket. AWS S3 
rejects such a body with 400 MalformedXML.

Steps to reproduce:
# Send PutBucketLifecycleConfiguration with this rule:
{{<Rule><ID>r1</ID><Filter><Tag><Key>a</Key></Tag></Filter><Status>Enabled</Status><Expiration><Days>1</Days></Expiration></Rule>}}
# Send GetBucketLifecycleConfiguration.

Actual: Step 1 returns 200. Step 2 returns the rule with {{<Filter/>}}. With 
{{ozone.lifecycle.service.enabled=true}}, KeyLifecycleService expires keys that 
don't have tag {{a}} (tested in {{TestKeyLifecycleService}}, OBS and FSO 
buckets).

Expected: Step 1 returns 400 MalformedXML and nothing is saved, as on AWS S3.

The same {{Tag}} inside {{<And>}} returns 500 instead, with a 
NullPointerException in the S3 Gateway log. AWS S3 returns 400 MalformedXML for 
that body too.

The fix should ensure that:
* A {{Tag}} without {{Key}} or {{Value}} is rejected with 400 MalformedXML, 
both directly in {{Filter}} and inside {{And}}, and the bucket keeps its 
current configuration.
* OM rejects such a filter too, because 
{{OzoneBucket#setLifecycleConfiguration}} reaches OM without going through S3 
Gateway.
* A {{Tag}} with an empty {{Value}} is still accepted. AWS S3 accepts it inside 
{{And}}.


> PutBucketLifecycleConfiguration saves a Tag filter without Key or Value as an 
> empty filter that matches every key
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-17703
>                 URL: https://issues.apache.org/jira/browse/HDDS-17703
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: S3
>            Reporter: Chung-En Lee
>            Priority: Major
>
> A lifecycle rule whose {{Tag}} filter has no {{Value}}, or no {{Key}}, is 
> saved with an empty filter, so the rule applies to every key in the bucket. 
> AWS S3 rejects such a body with 400 MalformedXML.
> Steps to reproduce:
> # Send PutBucketLifecycleConfiguration with this rule:
> {{<Rule><ID>r1</ID><Filter><Tag><Key>a</Key></Tag></Filter><Status>Enabled</Status><Expiration><Days>1</Days></Expiration></Rule>}}
> # Send GetBucketLifecycleConfiguration.
> Actual: Step 1 returns 200. Step 2 returns the rule with {{<Filter/>}}. With 
> {{ozone.lifecycle.service.enabled=true}}, KeyLifecycleService expires keys 
> that don't have tag {{a}} (tested in {{TestKeyLifecycleService}}, OBS and FSO 
> buckets).
> Expected: Step 1 returns 400 MalformedXML and nothing is saved, as on AWS S3.
> The same {{Tag}} inside {{<And>}} returns 500 instead, with a 
> NullPointerException in the S3 Gateway log. AWS S3 returns 400 MalformedXML 
> for that body too.
> The fix should ensure that:
> * A {{Tag}} without {{Key}} or {{Value}} is rejected with 400 MalformedXML, 
> in {{Filter}}, and the bucket keeps its current configuration.
> * OM rejects such a filter too, because 
> {{OzoneBucket#setLifecycleConfiguration}} reaches OM without going through S3 
> Gateway.
> * A {{Tag}} with an empty {{Value}} is still accepted. AWS S3 accepts it 
> inside {{And}}.



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