-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
#48297) * Remove token from config options when making a new DynamoDB client - including this creates an error with the `AwsClient` (which `DynamoDbClient` extends) in recent versions of the AWS PHP SDK: ```Invalid configuration value provided for "token"...``` * Do not add `token` value to the `credentials` array element _unless it was already present_ within the config. Adding a blank `token` value into this array element - simply because two other values (`key` and `secret`) happened to be found within the config - can break the `AwsClient`/`S3Client` being built by these managers. It is also cleaner to have a separate check for this `token` value - rather than assume that because you found two other values, you may as well go ahead and add this third value into the mix too, without having validated it first. --------- Co-authored-by: Michael Mehmet <>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,7 +263,11 @@ protected function formatS3Config(array $config) | |
$config += ['version' => 'latest']; | ||
|
||
if (! empty($config['key']) && ! empty($config['secret'])) { | ||
$config['credentials'] = Arr::only($config, ['key', 'secret', 'token']); | ||
$config['credentials'] = Arr::only($config, ['key', 'secret']); | ||
} | ||
|
||
if (! empty($config['token'])) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mmehmet
Author
Contributor
|
||
$config['credentials']['token'] = $config['token']; | ||
} | ||
|
||
return Arr::except($config, ['token']); | ||
|
@mmehmet
This can create a config of just
['token' => '...']
which is not valid AFAIKWe have a case when brefphp/laravel-bridge is setting the token based on AWS Lambda environment, but no key/secret is present. This worked fine in a Laravel 9 env.
I'll unset the bref-bridge set config for now but is it worth opening a PR to make sure the credentials have the required data?