Skip to content

Conversation

@pracucci
Copy link
Contributor

Starting from an issue opened in Cortex cortexproject/cortex#3034, I've realised an edge case in aws.ConfigFromURL(). If the URL is in the format scheme://@host/path, the static credentials are configured in the S3 config but with an empty ID / secret, because no user/pass is specified in the URL before the @.

In this PR I'm proposing a fix for that.

assert.Equal(t, "", tc.expectedKey)
assert.Equal(t, "", tc.expectedSecret)
if tc.expectedKey == "" && tc.expectedSecret == "" {
assert.Nil(t, cfg.Credentials)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed this assertion to ensure that cfg.Credentials are not set at all when we expect no key and secret.

require.NotNil(t, cfg.Endpoint)
assert.Equal(t, tc.expectedEp, *cfg.Endpoint)
} else {
assert.Nil(t, cfg.Endpoint)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we expect no endpoint, we should make sure it's not set.

@tomwilkie
Copy link
Contributor

LGTM thanks Marco!

Copy link
Collaborator

@bboreham bboreham left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@bboreham bboreham merged commit cef15bc into weaveworks:master Sep 14, 2020
@pracucci pracucci deleted the fix-aws-config-from-url branch September 14, 2020 08:39
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.

3 participants