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

Draft implementation for Issue #7 with aws secret manager #16

Merged
merged 12 commits into from
Mar 21, 2020

Conversation

cafeliker
Copy link
Contributor

Draft implementation on #7

@zhill
Copy link
Member

zhill commented Dec 10, 2019

Thanks! Will take a look.

@zhill zhill self-assigned this Dec 10, 2019
@cafeliker
Copy link
Contributor Author

@zhill I am not sure if I put the change in the right place, and feel free let me know your thoughts.

Copy link
Member

@zhill zhill left a comment

Choose a reason for hiding this comment

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

Good start! Thanks! I'd like to setup a structure that will support more extensible auth managers. If you'd like to implement a factory interface to return something like a 'CredentialProvider' object that returns valid credentials based on the configuration that would be ideal. Part of that would be putting the aws code in its own package, and imported by the factory so that the client just imports the factory and gets credentials from it. That will allow simpler testing of clients and mocks for the client, as well as extensions for Azure Key Vault or other similar services moving forward.

timeout := time.Duration(clientConfiguration.TimeoutSeconds) * time.Second
return gorequest.New().TLSClientConfig(&tls.Config{InsecureSkipVerify: clientConfiguration.TLSVerify}).SetBasicAuth(clientConfiguration.Username, clientConfiguration.Password).Timeout(timeout)
}

// Reload the anchore user name and password if AWS Secret Manager is used
func reloadCredential(clientConfiguration *ClientConfig) {
Copy link
Member

Choose a reason for hiding this comment

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

Rather than a reload, I think a credential factory model makes more sense. It would take a clientConfiguration and return a set of credentials. The default factory would return the credential in the config, but the AWS Credential Factory would return the credentials from the SecretManager. I think that would make testing the individual parts a little easier and allow a clean extension point later to use other credential managers or service accounts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zhill I am totally fine with a factory pattern, can you draft the codes structure and I will push an aws implementation.

@cafeliker
Copy link
Contributor Author

@zhill I applied the factory pattern, but as I am new for golang, could you pls help review it again and share me your comments?

Merry x'mas and happy new year!

ye

@zhill
Copy link
Member

zhill commented Dec 24, 2019

@zhill I applied the factory pattern, but as I am new for golang, could you pls help review it again and share me your comments?

Merry x'mas and happy new year!

ye

Thanks! I'll give it a review after the holiday. Thanks very much for the contribution and collaboration. Happy holidays to you as well!

@cafeliker
Copy link
Contributor Author

@zhill happy new year, can you make a quick review on it?

@zhill
Copy link
Member

zhill commented Jan 12, 2020

@cafeliker yes, I'll review it tonight

Copy link
Member

@zhill zhill left a comment

Choose a reason for hiding this comment

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

Good draft implementation. I'll merge it and then we can discuss follow-ups. I'll probably change how the config is loaded a bit as mentioned in the review comment, but will get the merged and we can iterate from there.


type DefaultCredenitalLoader struct{}

func (c *DefaultCredenitalLoader) LoadFromCredentialStore(passwordConfig string) string {
Copy link
Member

Choose a reason for hiding this comment

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

I'd like to make the secret/cred configuration more explicit rather than an encoded value in the password, but I think we can start with this as a draft and follow-up with another commit to change that behavior before a release is pushed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, we can talk after Feb 3 as I will be in Chinese new year holiday from next week. I'd like to hear more ideas from you ;-)

Copy link
Member

Choose a reason for hiding this comment

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

Have a great new year holiday! We'll sync up when you return.

@zhill
Copy link
Member

zhill commented Jan 13, 2020

I can either squash-merge it or you can rebase/squash it down to one commit if you'd like to set the commit message that will show in the change-log.

@cafeliker
Copy link
Contributor Author

@zhill it will be easier if you do squash-merge through the github UI, pls do it, thanks.

@zhill
Copy link
Member

zhill commented Mar 10, 2020

I should have some time tomorrow to get to this. I've not forgotten, just short on cycles recently.

@zhill zhill merged commit 3428f85 into anchore:master Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants