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

Gargi Jaiswal updated HDDS-15259:
---------------------------------
    Description: 
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 
{color:#de350b}{{test_put_obj_with_tags}}{color} to fail.
While a normal put-object-tagging is correctly rejecting null tag value.
{code:java}
// 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": []
}{code}
*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:
{code:java}
// 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": ""
        }
    ]
} {code}

  was:
This JIRA addresses two core compliance issues in the *object tagging* 
implementation:
 # *Overwrite vs. Merge:* Currently, tagging operations appear to be merging 
new tags with existing ones. AWS S3 specification requires that 
{{PutObjectTagging}} completely replaces the existing tag set with the new one 
provided in the request. This causes {{test_put_modify_tags on ceph}} to fail.

 # *Empty Value Support:* The S3 Gateway validator currently rejects tags with 
an empty value string (e.g., {{{}Key=TagA, Value={}}}) with an {{InvalidTag}} 
error. AWS S3 permits keys to have empty string values. This causes 
{{test_put_obj_with_tags}} to fail.

*Proposed Fix:* 
1. Update the internal tagging logic to ensure {{*setTags()*}} is called 
instead of an additive operation, ensuring a full overwrite of the metadata.
2. 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.


> PutObjectTagging should support empty tag values for x-amz-tagging header
> -------------------------------------------------------------------------
>
>                 Key: HDDS-15259
>                 URL: https://issues.apache.org/jira/browse/HDDS-15259
>             Project: Apache Ozone
>          Issue Type: Sub-task
>            Reporter: Gargi Jaiswal
>            Assignee: Gargi Jaiswal
>            Priority: Major
>
> 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 
> {color:#de350b}{{test_put_obj_with_tags}}{color} to fail.
> While a normal put-object-tagging is correctly rejecting null tag value.
> {code:java}
> // 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": []
> }{code}
> *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:
> {code:java}
> // 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": ""
>         }
>     ]
> } {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