diff options
author | James Letendre <James.Letendre@gmail.com> | 2020-12-14 16:20:30 -0500 |
---|---|---|
committer | James Letendre <James.Letendre@gmail.com> | 2020-12-14 16:22:41 -0500 |
commit | 5b756a9fb077bf71edd744c5018772ac649e5374 (patch) | |
tree | 29042984d5bfd3a37db4242e1c9d66a5380a2210 /lib/private | |
parent | 85aa77539b5dbbf74a56833f5d0d0b6815e612e1 (diff) | |
download | nextcloud-server-5b756a9fb077bf71edd744c5018772ac649e5374.tar.gz nextcloud-server-5b756a9fb077bf71edd744c5018772ac649e5374.zip |
Replace defaultProvider with explicit calls to exclude user home directory lookup
Signed-off-by: James Letendre <james.letendre@gmail.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ConnectionTrait.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php index 158298e059f..eaa9e9a9074 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -31,6 +31,7 @@ namespace OC\Files\ObjectStore; use Aws\ClientResolver; use Aws\Credentials\CredentialProvider; +use Aws\Credentials\EcsCredentialProvider; use Aws\Credentials\Credentials; use Aws\Exception\CredentialsException; use Aws\S3\Exception\S3Exception; @@ -103,10 +104,23 @@ trait S3ConnectionTrait { $provider = CredentialProvider::memoize( CredentialProvider::chain( $this->paramCredentialProvider(), - CredentialProvider::defaultProvider() + CredentialProvider::env(), + CredentialProvider::instanceProfile() ) ); + // If running in an ECS environment, then also include the ECS task role in the chain + if (!empty(getenv(EcsCredentialProvider::ENV_URI))) { + $provider = CredentialProvider::memoize( + CredentialProvider::chain( + $this->paramCredentialProvider(), + CredentialProvider::env(), + CredentialProvider::ecsCredentials(), + CredentialProvider::instanceProfile() + ) + ); + } + $options = [ 'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', 'credentials' => $provider, |