diff options
author | James Letendre <James.Letendre@gmail.com> | 2020-12-14 16:20:30 -0500 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-02-02 20:52:16 +0000 |
commit | 5750d79181885d24654dda4ecf81bedeaa6aeb34 (patch) | |
tree | 5c791b92fbbb2f650d665cbbaaabb7d7dd2e05f4 /lib/private | |
parent | c9a724829a202cfcb685eaaa7b4529e69acf3ff9 (diff) | |
download | nextcloud-server-5750d79181885d24654dda4ecf81bedeaa6aeb34.tar.gz nextcloud-server-5750d79181885d24654dda4ecf81bedeaa6aeb34.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 f23bcbc675d..1a36683a300 100644 --- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php +++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php @@ -32,6 +32,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; @@ -104,10 +105,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, |