deliciousbrains / wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
https://wordpress.org/plugins/amazon-s3-and-cloudfront/
304 stars 148 forks source link

Feature Request: Avoid calling GetBucketLocation API if not required #637

Open harai opened 9 months ago

harai commented 9 months ago

Is your feature request related to a problem? Please describe.

I'm using this plugin on AWS. On Storage Settings page, GetBucketLocation API is always called and results in AccessDenied error.

AccessDenied error

Since I know the region the S3 bucket is located in, I'm manually specifying it like this:

define( 'AS3CF_SETTINGS', serialize( array(
    'provider' => 'aws',
    'use-server-roles' => true,
    'bucket' => 'my-bucket',
    'region' => 'ap-northeast-1',
) ) );

I don't allow the plugin to call GetBucketLocation API.

Describe the solution you'd like The API call should be omitted if the region is manually specified.

Describe alternatives you've considered Allowing the plugin to call GetBucketLocation might be an alternative solution, but it is against the principle of least privilege. On some managed WordPress environment, it's almost impossible to add such an extra permission just to make this plugin work without error.

Additional context None.