summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorJames Letendre <James.Letendre@gmail.com>2020-12-14 16:20:30 -0500
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-02-02 20:52:16 +0000
commit5750d79181885d24654dda4ecf81bedeaa6aeb34 (patch)
tree5c791b92fbbb2f650d665cbbaaabb7d7dd2e05f4 /lib/private
parentc9a724829a202cfcb685eaaa7b4529e69acf3ff9 (diff)
downloadnextcloud-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.php16
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,