Skip to content
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

fix source_profile handling #2519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Credentials/CredentialProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,12 @@ private static function loadRoleProfile(
$sourceProfileName = "";
if (!empty($roleProfile['source_profile'])) {
$sourceProfileName = $roleProfile['source_profile'];
# in ~/.aws/config all the named profile (except 'default') are
# prefix with 'profile '
if ($filename == (self::getHomeDir() . '/.aws/config') &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove the condition $filename == (self::getHomeDir() . '/.aws/config') since I do no think is needed. You can leave the other condition $sourceProfileName != 'default'.

$sourceProfileName != 'default') {
$sourceProfileName = 'profile ' . $sourceProfileName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please be able to add a check here for whether profile has been already appended to the profile. By doing this we keep backward compatibility for customers that are already adding the profile to profile names.

}
if (!isset($profiles[$sourceProfileName])) {
return self::reject("source_profile " . $sourceProfileName
. " using profile " . $profileName . " does not exist"
Expand Down