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

Sourcing credentials via external Process - Browser not opening up #5506

Closed
2 tasks done
Tanmayshetty opened this issue Aug 31, 2020 · 8 comments
Closed
2 tasks done
Labels
bug This issue is a bug. closed-for-staleness credential-provider p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. v2

Comments

@Tanmayshetty
Copy link

Tanmayshetty commented Aug 31, 2020

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug

I am using the feature to source credentials from third-party source using credential_process
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html

I would like to occasionally open up the browser to authenticate the user with the command that I run
I am using CLI built with Node.js and https://github.com/sindresorhus/open to open up the browser.

This process works fine on AWS CLI v1 but fails in AWS CLI v2.

SDK version number
aws-cli/2.0.44 Python/3.7.3 Linux/4.14.192-147.314.amzn2.x86_64 exe/x86_64.amzn.2

Platform/OS/Hardware/Device
What are you running the cli on?

LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Amazon
Description: Amazon Linux release 2 (Karoo)
Release: 2
Codename: Karoo

To Reproduce (observed behavior)
Steps to reproduce the behavior

  1. Install open CLI (https://github.com/sindresorhus/open-cli) globally
    npm install --global open-cli

  2. For a profile add the open-cli command to open up a browser

[profile test]
credential_process = open-cli https://www.amazon.com --wait
  1. Run aws command with profile test.

aws s3 ls --profile test

Expected behavior
The browser should open up

Logs/output
open-cli-v2.txt
open-cli-v1.txt

Additional context
The above will not generate the valid token but is an example for the browser not opening-up
Both logs have errors, but for AWS CLI v1 browser opens up.

Edit: This issue occurs only for Firefox browser

@Tanmayshetty Tanmayshetty added the needs-triage This issue or PR still needs to be triaged. label Aug 31, 2020
@kdaily kdaily added guidance Question that needs advice or information. and removed needs-triage This issue or PR still needs to be triaged. labels Sep 8, 2020
@kdaily kdaily added bug This issue is a bug. and removed guidance Question that needs advice or information. labels Sep 21, 2020
@kdaily
Copy link
Member

kdaily commented Sep 21, 2020

I am able to reproduce, marking as a bug. Thanks!

@joguSD
Copy link
Contributor

joguSD commented Sep 21, 2020

I haven't taken a look at the logs but my hunch says it's likely the same issue as the one fixed here: #4964

@alfonso-presa
Copy link

alfonso-presa commented Oct 23, 2020

Hi @joguSD,

I think this is exactly what is happening to us. We have a custom credential process, and it's failing apparently because of this issue. It's a python 3 development that bootstraps a webserver and opens a webbrowser to receive credentials from our own IDP. The browser never opens.

Unsetting LD_LIBRARY_PATH prior to executing our tool in the credential_process entry inside sh -c solves the issue, but it's kind of hacky.

To reproduce the problem easily just add this to the aws config file in a linux machine:

[profile fake]
credential_process=google-chrome www.google.es

Then run AWS_PROFILE=fake aws s3 ls from a terminal.

Obviously it will fail as not credentials would be provided, but the expected behaviour would be to open the browser, and it would not.

Changing the config to:

[profile fake]
credential_process=bash -c "unset LD_LIBRARY_PATH; google-chrome www.google.es"

Would make the browser start opening.

For me it's failing with both chrome and firefox.

alfonso-presa added a commit to alfonso-presa/aws-credentials-process-cache that referenced this issue Oct 23, 2020
@alfonso-presa
Copy link

@joguSD ... I guess the issue is coming from here: https://github.com/boto/botocore/blob/develop/botocore/credentials.py#L974, I'm going to file an issue at botocore.

@jtsoi
Copy link

jtsoi commented May 28, 2021

@joguSD @alfonso-presa The issue is the same as for #4964
LD_LIBRARY_PATH is added by AWS CLI PyInstaller, I don't think boto should fix it.
See: boto/botocore#2195 (comment)

@krschwab
Copy link

krschwab commented Sep 23, 2021

I see @kdaily mentioned this issue alongside the one I filed in #6416, but I thought it was worth adding a comment here, since you would probably have to fix it in at least two places.

With external aliases, it's calling via python's subprocess directly in CLI related code (alias.py).

The credential_process external call appears to come from botocore.

@tim-finnigan tim-finnigan added the p2 This is a standard priority issue label Nov 4, 2022
@tim-finnigan
Copy link
Contributor

tim-finnigan commented Nov 11, 2024

Checking in — it looks like there have since been changes with how the path is handled. Both of these worked as expected when testing on Mac:

[profile test]
credential_process=bash -c "open http://google.com"

[profile test2]
credential_process=bash -c "'../../Applications/Google Chrome.app/Contents/MacOS/Google Chrome' 'http://google.com'"

Does this address the use case here?

Linking related docs for reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html

@tim-finnigan tim-finnigan added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 11, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closed-for-staleness credential-provider p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. v2
Projects
None yet
Development

No branches or pull requests

7 participants