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

credential_process swallows stderr #7306

Closed
Nevon opened this issue Sep 28, 2022 · 3 comments
Closed

credential_process swallows stderr #7306

Nevon opened this issue Sep 28, 2022 · 3 comments
Assignees
Labels
enhancement feature-request A feature should be added or improved.

Comments

@Nevon
Copy link

Nevon commented Sep 28, 2022

Describe the bug

This is a duplicate of the closed issue #3057. I'm opening a new issue to track that this is still broken in aws-cli, even if the root cause is within botocore.

When the aws cli launches a credential_process that writes to stderr, that stderr data is never displayed. This makes it impossible to use a credential process that prompts for MFA, since the prompt for that will be sent over stderr.

Expected Behavior

The credential process stderr should be connected to the aws cli stderr so that anything written to stderr from the credential process is displayed by the aws cli stderr.

Current Behavior

Output to stderr is not displayed. In my case, where the credential process displays an MFA prompt, that prompt is never shown to the user and it just looks like the process has hung.

Reproduction Steps

Example credential process:

#!/bin/bash
echo "Please enter fake MFA code:" >&2

read code

if (( ("$code" % 2) == "0" )); then
  echo "{
  \"Version\": 1,
  \"AccessKeyId\": \"an AWS access key\",
  \"SecretAccessKey\": \"your AWS secret access key\",
  \"SessionToken\": \"the AWS session token for temporary credentials\",
  \"Expiration\": \"ISO8601 timestamp when the credentials expire\"
}"
  exit 0
else
  echo "Invalid fake MFA code" >&2
  exit 1
fi

~/.aws/config:

[profile example]
credential_process = ~/fake-credential-process.sh

When used:

❯ aws --profile example sts get-caller-identity

# process now just sits there waiting for input with no visible prompt

Possible Solution

This is handled correctly in the other AWS SDKs, as far as I can tell, but not in Botocore. This is an open issue boto/botocore#1348.

The following two PRs both attempt to solve this:

Additional Information/Context

No response

CLI version used

aws-cli/1.25.82 Python/3.10.6 Darwin/21.6.0 botocore/1.27.81

Environment details (OS name and version, etc.)

macOS 12.6

@Nevon Nevon added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2022
@aBurmeseDev aBurmeseDev self-assigned this Sep 28, 2022
@aBurmeseDev aBurmeseDev added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 28, 2022
@aBurmeseDev
Copy link
Member

Hi @Nevon, thanks for reaching out.

Have you tried the workaround mentioned here?

As far as exposing stderr for prompts, it would need to be coordinated across SDKs which means the broader teams would need to review and decide on this. Given that this is a feature request that would affect multiple AWS SDKs, I created an issue in aws-sdk repo (aws/aws-sdk#358) for visibility.

Please feel free to check in and show your interest by adding a 👍 in the aws-sdk issue.

@aBurmeseDev aBurmeseDev added feature-request A feature should be added or improved. and removed bug This issue is a bug. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Sep 29, 2022
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

@lorengordon
Copy link
Contributor

Fwiw, the golang sdk already does this, and it is glorious. Folks just shouldn't be using botocore/boto3, I guess? ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants