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

Priyesh Karatha updated HDDS-15950:
-----------------------------------
    Description: 
`S3LifecycleConfiguration.convertFromOzoneExpiration()` calls 
`ozoneExpiration.getDays() > 0` (line 482). However, 
`OzoneLifecycleConfiguration.OzoneLCExpiration.getDays()` returns a nullable 
`Integer`. For lifecycle rules that specify an expiration date instead of a 
`Days` value, `getDays()` returns `null`. The subsequent comparison triggers 
auto-unboxing, resulting in a `NullPointerException` that propagates to the 
client as an HTTP 500 response.

A similar issue exists in `convertFromOzoneAbortIncompleteMultipartUpload()` 
(line 500), where `getDaysAfterInitiation()` also returns a nullable `Integer` 
but is compared without a null check, making it susceptible to the same 
`NullPointerException`.

There are currently no tests covering the GET lifecycle code path for rules 
that use date-based expiration. As a result, this bug was not detected by the 
existing test suite.


  was:
{{`S3LifecycleConfiguration.convertFromOzoneExpiration()`}} calls 
{{o`zoneExpiration.getDays() > 0`}} (line 482). However, 
`{{{}OzoneLifecycleConfiguration.OzoneLCExpiration.getDays()`{}}} returns a 
nullable {{{}Integer{}}}. If a lifecycle rule is stored with a {*}Date{*}-based 
expiration (without a {{Days}} field), {{getDays()}} returns {{{}null{}}}. The 
comparison triggers auto-unboxing of the {{{}Integer{}}}, resulting in a 
{{{}NullPointerException{}}}, which propagates to the client as an HTTP 500 
response.

The same issue exists in 
`{{{}convertFromOzoneAbortIncompleteMultipartUpload()`{}}} (line 500), where 
`{{{}getDaysAfterInitiation()`{}}} also returns a nullable {{Integer}} and is 
compared without a null check.

There are currently no tests covering the GET lifecycle path for rules that use 
{*}Date{*}-based expiration, allowing this regression to go undetected.


> S3 Gateway GetBucketLifecycleConfiguration throws NullPointerException when 
> expiration uses Date or DaysAfterInitiation is absent
> ---------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-15950
>                 URL: https://issues.apache.org/jira/browse/HDDS-15950
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: S3
>            Reporter: Priyesh Karatha
>            Assignee: Priyesh Karatha
>            Priority: Major
>
> `S3LifecycleConfiguration.convertFromOzoneExpiration()` calls 
> `ozoneExpiration.getDays() > 0` (line 482). However, 
> `OzoneLifecycleConfiguration.OzoneLCExpiration.getDays()` returns a nullable 
> `Integer`. For lifecycle rules that specify an expiration date instead of a 
> `Days` value, `getDays()` returns `null`. The subsequent comparison triggers 
> auto-unboxing, resulting in a `NullPointerException` that propagates to the 
> client as an HTTP 500 response.
> A similar issue exists in `convertFromOzoneAbortIncompleteMultipartUpload()` 
> (line 500), where `getDaysAfterInitiation()` also returns a nullable 
> `Integer` but is compared without a null check, making it susceptible to the 
> same `NullPointerException`.
> There are currently no tests covering the GET lifecycle code path for rules 
> that use date-based expiration. As a result, this bug was not detected by the 
> existing test suite.



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