Gargi-jais11 opened a new pull request, #10299: URL: https://github.com/apache/ozone/pull/10299
## What changes were proposed in this pull request? This JIRA addresses issues in the object tagging implementation: Null Tag Value Support for `x-amz-tagging-header`: The S3 Gateway validator currently rejects x-amz-tagging on put object tags with a null value string (e.g., Key=TagA, Value) with an InvalidTag error. AWS S3 permits null tag value to be considered as empty string values. This causes **`test_put_obj_with_tags`** to fail. While a normal put-object-tagging is correctly rejecting null tag value. ``` // wrong behaviour // put object with x-amz-tagging header with null tag value should be treated as an empty value. bash-5.1$ aws s3api put-object --bucket buck1 --key key1 --tagging 'tag1' --endpoint-url http://s3g:9878 An error occurred (InvalidTag) when calling the PutObject operation: Some tag values are not specified, please specify the tag values // no tags applied which is wrong bash-5.1$ aws s3api get-object-tagging --bucket buck1 --key key1 --endpoint-url http://s3g:9878 { "TagSet": [] } ``` **Proposed Fix:** Update **validateAndGetTagging()** in EndpointBase to allow values with zero length when x-amz-tagging header is present else on normal put object tagging this null tag value should fail, while maintaining the requirement that the Key must have at least one character. **After fix:** ``` // put object with x-amz-tagging header succeded for null tag value bash-5.1$ aws s3api put-object --bucket buck1 --key key1 --tagging 'tag1' --endpoint-url http://s3g:9878 { "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"" } // confirming with get object tagging bash-5.1$ aws s3api get-object-tagging --bucket buck1 --key key1 --endpoint-url http://s3g:9878 { "TagSet": [ { "Key": "tag1", "Value": "" } ] } ``` ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-15259 ## How was this patch tested? Added unit and Integration Tests. Also tested manually. **Before fix:** [**Test Suit Link**](https://ozone.s3.peterxcli.dev/?q=test_put_obj_with_tags&run=2026-05-17T05-56-28Z&caseSuite=s3_tests&test=test_put_obj_with_tags#search-section) ``` 1. // wrong behaviour // put object with x-amz-tagging header with null tag value should be treated as an empty value. bash-5.1$ aws s3api put-object --bucket buck1 --key key1 --tagging 'tag1' --endpoint-url http://s3g:9878/ An error occurred (InvalidTag) when calling the PutObject operation: Some tag values are not specified, please specify the tag values // no tags applied which is wrong bash-5.1$ aws s3api get-object-tagging --bucket buck1 --key key1 --endpoint-url http://s3g:9878/ { "TagSet": [] } ``` **After Fix:** ``` // put object with x-amz-tagging header succeded for null tag value bash-5.1$ aws s3api put-object --bucket buck1 --key key1 --tagging 'tag1' --endpoint-url http://s3g:9878/ { "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"" } // confirming with get object tagging bash-5.1$ aws s3api get-object-tagging --bucket buck1 --key key1 --endpoint-url http://s3g:9878/ { "TagSet": [ { "Key": "tag1", "Value": "" } ] } // 2nd example which succeded. This also shows correctly replacing the old tags with new tags. bash-5.1$ aws s3api put-object --bucket buck1 --key key1 --tagging 'foo=bar&bar' --endpoint-url http://s3g:9878/ { "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"" } bash-5.1$ aws s3api get-object-tagging --bucket buck1 --key key1 --endpoint-url http://s3g:9878/ { "TagSet": [ { "Key": "bar", "Value": "" }, { "Key": "foo", "Value": "bar" } ] } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
