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

shashank updated CAMEL-27167:
-----------------------------
    Description: 
h3. What happens

With {{deleteAfterRead}}, the {{alibaba-oss}} consumer takes the bucket and the 
key of the object to delete from the {{CamelAlibabaOssBucketName}} and 
{{CamelAlibabaOssObjectKey}} headers when the exchange completes. The 
{{hwcloud-obs}} consumer does the same with {{CamelHwCloudObsBucketName}} and 
{{CamelHwCloudObsObjectKey}} for {{moveAfterRead}} and {{deleteAfterRead}}.

For {{alibaba-oss}} the bucket name header is also where the producer reads the 
bucket to write to from. So a route that sets it to write a copy of the 
consumed object to another bucket makes the consumer delete the object with 
that key in the other bucket, and the consumed object stays and is consumed 
again by the next poll. (The {{hwcloud-obs}} producer reads the exchange 
property of that name, so for OBS this happens only when a route changes the 
headers for another reason.) A route that removes the headers, or replaces the 
message, deletes nothing, and the object is consumed again by every poll.

This is the same defect that CAMEL-27015 (#30168) (aws2-s3, azure-storage-blob, 
aws2-sqs) and CAMEL-27064 (#30227) (google-storage, minio, alibaba-mns) fixed 
in the other object storage consumers.

h3. How to reproduce

{{OSSConsumerDeleteAfterReadTest}} and {{OBSConsumerMoveDeleteAfterReadTest}} 
(mocked clients, as the existing consumer tests): a route that sets the bucket 
and key headers makes the consumer delete {{archive/copy-of-a.txt}} instead of 
{{bucket/a.txt}}; a route that removes the headers deletes nothing.

h3. Fix

The consumers take the bucket and the key of the object before the exchange is 
routed, and delete or move that object when it completes.

_Filed with Claude Code on behalf of allthingssecurity._

  was:
h3. What happens

With {{deleteAfterRead}}, the {{alibaba-oss}} consumer takes the bucket and the 
key of the object to delete from the {{CamelAlibabaOssBucketName}} and 
{{CamelAlibabaOssObjectKey}} headers when the exchange completes. The 
{{hwcloud-obs}} consumer does the same with {{CamelHwCloudObsBucketName}} and 
{{CamelHwCloudObsObjectKey}} for {{moveAfterRead}} and {{deleteAfterRead}}.

The bucket name header is also the header the producer of each component reads 
the bucket to write to from. So a route that sets it to write a copy of the 
consumed object to another bucket makes the consumer delete (and for OBS copy) 
the object with that key in the other bucket, and the consumed object stays and 
is consumed again by the next poll. A route that removes the headers, or 
replaces the message, deletes nothing, and the object is consumed again by 
every poll.

This is the same defect that CAMEL-27015 (#30168) (aws2-s3, azure-storage-blob, 
aws2-sqs) and CAMEL-27064 (#30227) (google-storage, minio, alibaba-mns) fixed 
in the other object storage consumers.

h3. How to reproduce

{{OSSConsumerDeleteAfterReadTest}} and {{OBSConsumerMoveDeleteAfterReadTest}} 
(mocked clients, as the existing consumer tests): a route that sets the bucket 
and key headers makes the consumer delete {{archive/copy-of-a.txt}} instead of 
{{bucket/a.txt}}; a route that removes the headers deletes nothing.

h3. Fix

The consumers take the bucket and the key of the object before the exchange is 
routed, and delete or move that object when it completes.

_Filed with Claude Code on behalf of allthingssecurity._


> camel-alibaba-oss, camel-huaweicloud-obs - the consumers delete or move the 
> object named by the headers as the route left them, not the one they consumed
> ---------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27167
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27167
>             Project: Camel
>          Issue Type: Bug
>            Reporter: shashank
>            Assignee: shashank
>            Priority: Major
>
> h3. What happens
> With {{deleteAfterRead}}, the {{alibaba-oss}} consumer takes the bucket and 
> the key of the object to delete from the {{CamelAlibabaOssBucketName}} and 
> {{CamelAlibabaOssObjectKey}} headers when the exchange completes. The 
> {{hwcloud-obs}} consumer does the same with {{CamelHwCloudObsBucketName}} and 
> {{CamelHwCloudObsObjectKey}} for {{moveAfterRead}} and {{deleteAfterRead}}.
> For {{alibaba-oss}} the bucket name header is also where the producer reads 
> the bucket to write to from. So a route that sets it to write a copy of the 
> consumed object to another bucket makes the consumer delete the object with 
> that key in the other bucket, and the consumed object stays and is consumed 
> again by the next poll. (The {{hwcloud-obs}} producer reads the exchange 
> property of that name, so for OBS this happens only when a route changes the 
> headers for another reason.) A route that removes the headers, or replaces 
> the message, deletes nothing, and the object is consumed again by every poll.
> This is the same defect that CAMEL-27015 (#30168) (aws2-s3, 
> azure-storage-blob, aws2-sqs) and CAMEL-27064 (#30227) (google-storage, 
> minio, alibaba-mns) fixed in the other object storage consumers.
> h3. How to reproduce
> {{OSSConsumerDeleteAfterReadTest}} and {{OBSConsumerMoveDeleteAfterReadTest}} 
> (mocked clients, as the existing consumer tests): a route that sets the 
> bucket and key headers makes the consumer delete {{archive/copy-of-a.txt}} 
> instead of {{bucket/a.txt}}; a route that removes the headers deletes nothing.
> h3. Fix
> The consumers take the bucket and the key of the object before the exchange 
> is routed, and delete or move that object when it completes.
> _Filed with Claude Code on behalf of allthingssecurity._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to