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

Prince Raj updated HDDS-16394:
------------------------------
    Description: 
h2. Summary

{{PutBucketLifecycleConfiguration}} correctly rejects lifecycle configurations 
containing duplicate rule IDs with {*}HTTP 400 / InvalidRequest{*}. However, 
the returned error message is too generic and does not indicate that duplicate 
rule IDs caused the failure or identify the duplicated ID.
h2. Steps to Reproduce
 # Create a lifecycle configuration containing duplicate rule IDs:

 

 
{code:java}
{{{
"Rules": [
{
"ID": "expire-rule",
"Status": "Disabled",
"Filter":
{ "Prefix": "key1/" }
,
"Expiration": {
"Date": "2026-09-05T00:00:00Z"
}
},
{
"ID": "expire-rule",
"Status": "Enabled",
"Filter":
{ "Prefix": "key2/" }
,
"Expiration": {
"Date": "2026-09-05T00:00:00Z"
}
}
]
}}}
{code}
 
 # Send the configuration using {{{}PutBucketLifecycleConfiguration{}}}.

h2. Actual Behavior

The request is correctly rejected with:

 

{{HTTP 400
InvalidRequest: Invalid Request}}

However, the error message does not indicate that the failure was caused by 
duplicate rule IDs.
h2. Expected Behavior

The request should continue to return *HTTP 400 / InvalidRequest* (or an 
equivalent validation error), but the error message should provide actionable 
information, for example:

 

{{Duplicate rule ID 'expire-rule' found in lifecycle configuration}}

or at minimum:

 

{{Duplicate rule IDs found}}

This would make it clear to the user why the lifecycle configuration was 
rejected.
h2. Suggested Fix
 * Propagate the underlying validation error message to the S3 response instead 
of returning only the generic {{Invalid Request}} message.

 * Include the duplicated rule ID in the validation error where possible.

 * Ensure the response remains compliant with the expected S3 error type/status 
code.

  was:
h2. Summary

{{PutBucketLifecycleConfiguration}} correctly rejects lifecycle configurations 
containing duplicate rule IDs with {*}HTTP 400 / InvalidRequest{*}. However, 
the returned error message is too generic and does not indicate that duplicate 
rule IDs caused the failure or identify the duplicated ID.
h2. Steps to Reproduce
 # Create a lifecycle configuration containing duplicate rule IDs:

 

{{{
  "Rules": [
    \{
      "ID": "expire-rule",
      "Status": "Disabled",
      "Filter": {
        "Prefix": "key1/"
      },
      "Expiration": \{
        "Date": "2026-09-05T00:00:00Z"
      }
    },
    \{
      "ID": "expire-rule",
      "Status": "Enabled",
      "Filter": {
        "Prefix": "key2/"
      },
      "Expiration": \{
        "Date": "2026-09-05T00:00:00Z"
      }
    }
  ]
}}}
 # Send the configuration using {{{}PutBucketLifecycleConfiguration{}}}.

h2. Actual Behavior

The request is correctly rejected with:

 

{{HTTP 400
InvalidRequest: Invalid Request}}

However, the error message does not indicate that the failure was caused by 
duplicate rule IDs.
h2. Expected Behavior

The request should continue to return *HTTP 400 / InvalidRequest* (or an 
equivalent validation error), but the error message should provide actionable 
information, for example:

 

{{Duplicate rule ID 'expire-rule' found in lifecycle configuration}}

or at minimum:

 

{{Duplicate rule IDs found}}

This would make it clear to the user why the lifecycle configuration was 
rejected.
h2. Suggested Fix
 * Propagate the underlying validation error message to the S3 response instead 
of returning only the generic {{Invalid Request}} message.

 * Include the duplicated rule ID in the validation error where possible.

 * Ensure the response remains compliant with the expected S3 error type/status 
code.


> PutBucketLifecycle returns generic "Invalid Request" for duplicate rule IDs
> ---------------------------------------------------------------------------
>
>                 Key: HDDS-16394
>                 URL: https://issues.apache.org/jira/browse/HDDS-16394
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Prince Raj
>            Priority: Major
>
> h2. Summary
> {{PutBucketLifecycleConfiguration}} correctly rejects lifecycle 
> configurations containing duplicate rule IDs with {*}HTTP 400 / 
> InvalidRequest{*}. However, the returned error message is too generic and 
> does not indicate that duplicate rule IDs caused the failure or identify the 
> duplicated ID.
> h2. Steps to Reproduce
>  # Create a lifecycle configuration containing duplicate rule IDs:
>  
>  
> {code:java}
> {{{
> "Rules": [
> {
> "ID": "expire-rule",
> "Status": "Disabled",
> "Filter":
> { "Prefix": "key1/" }
> ,
> "Expiration": {
> "Date": "2026-09-05T00:00:00Z"
> }
> },
> {
> "ID": "expire-rule",
> "Status": "Enabled",
> "Filter":
> { "Prefix": "key2/" }
> ,
> "Expiration": {
> "Date": "2026-09-05T00:00:00Z"
> }
> }
> ]
> }}}
> {code}
>  
>  # Send the configuration using {{{}PutBucketLifecycleConfiguration{}}}.
> h2. Actual Behavior
> The request is correctly rejected with:
>  
> {{HTTP 400
> InvalidRequest: Invalid Request}}
> However, the error message does not indicate that the failure was caused by 
> duplicate rule IDs.
> h2. Expected Behavior
> The request should continue to return *HTTP 400 / InvalidRequest* (or an 
> equivalent validation error), but the error message should provide actionable 
> information, for example:
>  
> {{Duplicate rule ID 'expire-rule' found in lifecycle configuration}}
> or at minimum:
>  
> {{Duplicate rule IDs found}}
> This would make it clear to the user why the lifecycle configuration was 
> rejected.
> h2. Suggested Fix
>  * Propagate the underlying validation error message to the S3 response 
> instead of returning only the generic {{Invalid Request}} message.
>  * Include the duplicated rule ID in the validation error where possible.
>  * Ensure the response remains compliant with the expected S3 error 
> type/status code.



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