Replace defaultProvider with explicit calls to exclude user home directory lookup

Signed-off-by: James Letendre <james.letendre@gmail.com>
This commit is contained in:
James Letendre 2020-12-14 16:20:30 -05:00 committed by backportbot[bot]
parent c9a724829a
commit 5750d79181
1 changed files with 15 additions and 1 deletions

View File

@ -32,6 +32,7 @@ namespace OC\Files\ObjectStore;
use Aws\ClientResolver; use Aws\ClientResolver;
use Aws\Credentials\CredentialProvider; use Aws\Credentials\CredentialProvider;
use Aws\Credentials\EcsCredentialProvider;
use Aws\Credentials\Credentials; use Aws\Credentials\Credentials;
use Aws\Exception\CredentialsException; use Aws\Exception\CredentialsException;
use Aws\S3\Exception\S3Exception; use Aws\S3\Exception\S3Exception;
@ -104,10 +105,23 @@ trait S3ConnectionTrait {
$provider = CredentialProvider::memoize( $provider = CredentialProvider::memoize(
CredentialProvider::chain( CredentialProvider::chain(
$this->paramCredentialProvider(), $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 = [ $options = [
'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', 'version' => isset($this->params['version']) ? $this->params['version'] : 'latest',
'credentials' => $provider, 'credentials' => $provider,