Jim Boy
Well-known member
- Affected version
- 2.2.7
If you do not set credentials in src/config.php, a stack trace is generated:
ie doing
instead of
XF uses Flysystem S3Client which does not require username and secret. see https://flysystem.thephpleague.com/v1/docs/adapter/aws-s3-v3/
OK, maybe not strictly a bug, but getting users to create IAM users and record login credentials instead of using roles is extremely bad security and definitely not in line with AWS best practise
Code:
b>Fatal error</b>: Uncaught Error: Unknown named parameter $instance in /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php:74
Stack trace:
#0 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php(74): call_user_func_array('self::chain', Array)
#1 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/ClientResolver.php(260): Aws\Credentials\CredentialProvider::defaultProvider(Array)
#2 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/AwsClient.php(161): Aws\ClientResolver->resolve(Array, Object(Aws\HandlerList))
#3 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/S3/S3Client.php(263): Aws\AwsClient->__construct(Array)
#4 /sites/bigfooty/forum/src/config.php(28): Aws\S3\S3Client->__construct(Array)
#5 /sites/bigfooty/forum/src/config.php(36): XF\App->{closure}()
#6 /sites/bigfooty/forum/src/XF/FsMounts.php(19): XF\App->{closure}()
#7 /sites/bigfooty/forum/src/XF/App.php(1100): XF\FsMounts::loadDefaultMounts(Array)
#8 /sites/bigfooty/forum/src/XF/Container.php(30): XF\App->XF\{closure}(Object(XF\Container))
#9 /sites/bigfooty/forum/src/XF/App.php(2585): XF\Container->offsetGet('fs')
#10 /sites/bigfooty/forum/src/XF.php(932): XF\App->fs()
#11 /sites/bigfooty/forum/src/XF/Util/File.php(740): XF::fs()
#12 /sites/bigfooty/forum/src/XF/Error.php(102): XF\Util\File::installLockExists()
#13 /sites/bigfooty/forum/src/XF/App.php(2356): XF\Error->logException(Object(Error), true, '')
#14 /sites/bigfooty/forum/src/XF.php(196): XF\App->logException(Object(Error), true)
#15 [internal function]: XF::handleException(Object(Error))
#16 {main}
thrown in <b>/sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php</b> on line <b>74</b><br />
<br />
<b>Fatal error</b>: Uncaught Error: Unknown named parameter $instance in /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php:74
Stack trace:
#0 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php(74): call_user_func_array('self::chain', Array)
#1 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/ClientResolver.php(260): Aws\Credentials\CredentialProvider::defaultProvider(Array)
#2 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/AwsClient.php(161): Aws\ClientResolver->resolve(Array, Object(Aws\HandlerList))
#3 /sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/S3/S3Client.php(263): Aws\AwsClient->__construct(Array)
#4 /sites/bigfooty/forum/src/config.php(28): Aws\S3\S3Client->__construct(Array)
#5 /sites/bigfooty/forum/src/config.php(36): XF\App->{closure}()
#6 /sites/bigfooty/forum/src/XF/FsMounts.php(19): XF\App->{closure}()
#7 /sites/bigfooty/forum/src/XF/App.php(1100): XF\FsMounts::loadDefaultMounts(Array)
#8 /sites/bigfooty/forum/src/XF/Container.php(30): XF\App->XF\{closure}(Object(XF\Container))
#9 /sites/bigfooty/forum/src/XF/App.php(2585): XF\Container->offsetGet('fs')
#10 /sites/bigfooty/forum/src/XF.php(932): XF\App->fs()
#11 /sites/bigfooty/forum/src/XF/Util/File.php(740): XF::fs()
#12 /sites/bigfooty/forum/src/XF/Error.php(102): XF\Util\File::installLockExists()
#13 /sites/bigfooty/forum/src/XF/App.php(2356): XF\Error->logException(Object(ErrorException), true, '')
#14 /sites/bigfooty/forum/src/XF.php(236): XF\App->logException(Object(ErrorException), true)
#15 [internal function]: XF::handleFatalError()
#16 {main}
thrown in <b>/sites/bigfooty/forum/src/addons/XFAws/_vendor/aws/aws-sdk-php/src/Credentials/CredentialProvider.php</b> on line <b>74</b><br />
Code:
$s3 = function () {
return new \Aws\S3\S3Client(['region' => 'us-west-2', 'version' => 'latest', 'endpoint' => 'https://s3.us-west-2.amazonaws.com']);
};
Code:
$s3 = function () {
return new \Aws\S3\S3Client(['credentials' => ['key' => '[APIKEY]', 'secret' => '[APISECRET'], 'region' => 'us-west-2', 'version' => 'latest', 'endpoint' => 'https://s3.us-west-2.amazonaws.com' ]);
};
OK, maybe not strictly a bug, but getting users to create IAM users and record login credentials instead of using roles is extremely bad security and definitely not in line with AWS best practise