-
Notifications
You must be signed in to change notification settings - Fork 242
New plugin: IBM Cloud CLI #181
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
New plugin: IBM Cloud CLI #181
Conversation
|
Currently, there are a few things I'm unsure about with regards to my implementation.
|
Does the IBM CLI read the API key from said config file? I'm asking because that would be a reason for users to manually add it. |
Your current implementation is a great first version, that's already super valuable. It allows users to remove the API key from plaintext on disk, and instead load it through 1Password when and where needed. Not having to run |
SimonBarendse
left a comment
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.
Love it! ☁️ I have left one comment to further look into and one small suggestion to help future readers of this code.
@SimonBarendse No there aren't any instances where the CLI reads the API key directly from the config file from what I know. The CLI stores a bearer and refresh token in the config file to authenticate, which may contain information extracted or derived from the API key, but it never reads an API key directly. After some more thought, I feel like removing the file importer may be the right choice. Most likely, the user would be storing their API key in some other unknown location on their local disk since there isn't even a recommended location that IBM suggests users keep their API key. So in most cases, scanning the config file for an API key would probably not be useful. Can I get your thoughts on this @SimonBarendse? |
|
Added one more small change to skip auth through 1Password when user runs |
|
If the way to pass the key is through an envvar and not through the config file, the envvar importer will be sufficient. Most likely users are storing the key in their |
|
So the current approach we are taking in this PR will not work. Last time I checked we were waiting on IBM's team to introduce support for an env var in |
Summary
Build a new shell plugin for the IBM Cloud CLI.
Addresses: #163
Testing
Setup
make ibmcloud/build.Importer
Provisioner
ibmcloud login. You should be automatically authenticated with the API key stored in 1Password.ibmcloud loginwith each of the below flags (descriptions can be found here). You should not be prompted to authenticate through the 1Password CLI. The use cases for the flags are described below as well. Most of the flags would be passed if the user wants to authenticate using a method besides an API key, in which case we want to let the user authenticate manually to avoid confusion and potential conflict between credentials.Wants to authenticate with username (email)/password:
Wants to potentially authenticate with an API key that's different from the one saved in 1Password:
Wants to authenticate with a compute resource token or as a VPC VSI compute resource identity:
Wants to authenticate with a one-time passcode:
Wants to authenticate to a specific account or no account. Since an API key is linked to a specific account, both cases should only work if the user provides their authentication credentials manually, or else there could be conflicts:
Wants help or version information:
ibmcloudwith no arguments. You should not be prompted to authenticate through the 1Password CLI.