-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
implement credential_process on ProcessCredentials provider #2559
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2559 +/- ##
==========================================
- Coverage 96.85% 96.82% -0.03%
==========================================
Files 281 283 +2
Lines 8527 8609 +82
Branches 1621 1639 +18
==========================================
+ Hits 8259 8336 +77
- Misses 268 273 +5
Continue to review full report at Codecov.
|
Awesome to see progress on this! FWIW, there is a PR on botocore to at least print stderr, so that users have some method to see and respond to things like a prompt for MFA... The implementation in the AWS SDK for GO does this already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will helpful to customer if you add an example of using credential process in the documentation block.
@lorengordon I think it would be better to have a light-weight protocol to facilitate an interactive credential_process (defined by whomever owns the |
I can respect that. Perhaps my javascript naivete is showing, but is the stderr being returned to the calling process? That's the problem in botocore... stderr is swallowed, not returned. So the |
@lorengordon Any stderr from the subprocess will be appended to the resulting For example, if #!/usr/bin/env bash
echo some stdout output
echo some stderr output > /dev/stderr
echo some other stderr output > /dev/stderr
exit 1 ...and we have a node script: proc.exec('./fail', (err, stdout, stderr) => {
console.error('err.message:', err.message);
}); Then, we will get:
|
The |
Yeah, that would definitely be necessary. The primary use case I'm aware of for The |
{ code: 'ProcessCredentialsProviderFailure' } | ||
); | ||
} | ||
this.expired = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this statement and the following if
block be here?
The callback that runs when loadViaCredentialsProcess
completes assigns this.expired
and calls the callback. These statements appear to run on every load, which will eagerly invoke callback
during a refresh, since this.accessKeyId
and this.secretAccessKey
will have truthy values during a refresh.
{ code: 'ProcessCredentialsProviderFailure' } | ||
); | ||
} | ||
if (err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think err
should be checked before trying to process stdOut
, since the condition is always checked.
); | ||
} | ||
if (err) { | ||
callback(err, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all cases where err
is not known to have already been wrapped, be wrapped with AWS.util.error
and the code assigned?
// load after profilesFromCreds to prefer profilesFromConfig | ||
for (var i = 0, profileNames = Object.keys(profilesFromConfig); i < profileNames.length; i++) { | ||
profiles[profileNames[i]] = profilesFromConfig[profileNames[i]]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part same to that in SharedIniFileCredential
? It's a relatively minor one but I'd like to put this functionality(loading correct profile) in the util function and attach to AWS.util
in node_loader
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's almost the same, but it loads profilesFromConfig after profilesFromCreds. If credentials and config files had profiles with the same name, SharedIniFileCredentials
and ProcessCredentials
would give different precedence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks for clearing.
@@ -59,12 +61,9 @@ AWS.CredentialProviderChain.defaultProviders = [ | |||
function () { return new AWS.EnvironmentCredentials('AWS'); }, | |||
function () { return new AWS.EnvironmentCredentials('AMAZON'); }, | |||
function () { return new AWS.SharedIniFileCredentials(); }, | |||
function () { | |||
if (AWS.ECSCredentials.prototype.isConfiguredForEcsCredentials()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the diff for EcsCredentials
. Do I miss it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ECSCredentials already throws an error if ENV_RELATIVE_URI or ENV_FULL_URI aren't set. isConfiguredForEcsCredentials could be removed if ECSCredentials is going to be put into the default providers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
Just as a record: the codecov test fails because of the code diff in default credential chain.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
reworked from #1923 to get tests passing
npm run test
passesnpm run add-change
bundle exec rake docs:api
and inspectdoc/latest/index.html
if documentation is changed