-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with profile-based credentials #2794
Comments
Hi @BVMiko, sorry to hear about your issues. I can confirm the reported behavior so that I will add a needs-review label to it so we can address this further. Test code: <?php
require '../vendor/autoload.php';
use Aws\S3\S3Client;
use Aws\Credentials\CredentialProvider;
$client = new S3Client([
'credentials' => CredentialProvider::ini('profile issue-2794', '/PATH/config'),
'region' => 'us-east-2'
]);
$response = $client->listBuckets();
print_r($response); /PATH/config
/PATH/credentials
Thanks! |
Hi @yenfryherrerafeliz, I'm just checking to see if there's any chance of this being considered in the near future. I had to set up a pretty messy workaround with my development environment last year, but I'm going through to optimize things recently and was hoping to clean it up. If there is any chance of it picking up some traction, let me know and I will rebase against the current master branch. |
Hi @yenfryherrerafeliz, I'm working on a different project and it will be another good chance to use this if it had been merged in. Is there any chance of this being reviewed in the near future? It's been a very long time now, and I'm hoping to help fix up this bug if your team is willing. Should I be pinging someone else, perhaps? |
@stobrien89, I suspect that @yenfryherrerafeliz might not have been receiving my messages on this thread and it has been forgotten from over a year ago; I was wondering if you might be able to take a look and consider it? This is quite an annoyance for anyone using AWS Organizations and I'd like to see about getting it fixed. |
@stobrien89 @yenfryherrerafeliz It's been a few more weeks; any chance you can read over this and see if it's something you guys are willing to accept a PR for in the first place? All of the other AWS SDK systems that I've used behave consistently, it's only AWS-SDK-PHP that doesn't properly combine It sees that you are responding to new issues promptly, perhaps comments to this issue are just not visible to you guys via a mail filter or something? |
Describe the bug
AWS CLI as well as
boto3
implementation handle config & credentials files by reading the contents of both and consolidating them into a single associative array, prior to doing any processing.aws-sdk-php
, on the other hand, only reads in one file when processing. This causes an issue when using assumed roles while organizing credentials the way recommended in the AWS CLI docs (the "IAM Role" tab here).Specifically, when using a specific profile (configured the
AWS_PROFILE
environment variable) and usingrole_arn
for the provided profile, the CredentialProvider doesn't search the~/.aws/credentials
file for thesource_profile
's credentials. This is different from how it works for other AWS config parsers (both AWS CLI and Python's boto3).Expected Behavior
I expect that using the
AWS_PROFILE=foobar
environment variable will properly use STS by pulling the source credentials from~/.aws/credentials
.Current Behavior
When processing the
role_arn
, it only searches for the credentials in the~/.aws/config
file, instead of the more appropriate~/.aws/credentials
file.Reproduction Steps
With the
~/.aws/config
:And the
~/.aws/credentials
file:Use the
AWS_PROFILE=foobar
environment variable.Possible Solution
The code here should first check the
~/.aws/credentials
file with:and on rejection it should try the
~/.aws/config
file as it is doing currently:Additional Information/Context
No response
SDK version used
3.283.2
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)PHP 8.2.11; Ubuntu Linux 22.04
The text was updated successfully, but these errors were encountered: