trendmicro / cloudone-filestorage-plugins

Trend Micro Cloud One File Storage Security plugins reference code.
https://cloudone.trendmicro.com
Apache License 2.0
42 stars 51 forks source link

fix: Azure synchronous copy limitation workaround #147

Closed jessie-y-kuo closed 1 year ago

jessie-y-kuo commented 1 year ago

fix: Azure synchronous copy limitation workaround

Summary

Azure’s promote and quarantine plugin's start_copy_from_url() with requires_sync=True has a 256MB limit that prevents customers from moving malicious files to the quarantine bucket or moving good files to the promote bucket. This workaround implementation will allow our Azure promote and quarantine plugin to copy synchronously without the 256MB limitation for the file size being copied.

Documentation for Azure blob's 256MB synchronous copy limitation:

Documentation for all current copy_status:

PR Checklist

Other Notes

jessie-y-kuo commented 1 year ago

Hi @jessie-y-kuo,

Given that the code relies on the copy status as a condition, I recommend specifying the azure-storage-blob version in the requirements.txt file to prevent potential issues with new status codes in future versions.

Good idea! I will change it to match the Python azure-storage-blob version that our other service is currently adopting.

jessie-y-kuo commented 1 year ago

I ended up using azure-storage-blob==12.17.0 because the ContainerClient.exist() function for azure-storage-blob version before 12.8.0 is either not stable or in preview (https://github.com/Azure/azure-sdk-for-python/blob/azure-storage-blob_12.18.0b1/sdk/storage/azure-storage-blob/CHANGELOG.md#1280-2021-03-01).