-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Fix the password display problem when passing the chart link #1281
Conversation
876dd49
to
5641051
Compare
@NavesEdu please move the logic into a single func and add some unit tests. Thanks So much. |
5641051
to
2cdd064
Compare
@yxxhero I made the changes that you asked me! |
pkg/state/state.go
Outdated
@@ -3192,6 +3192,15 @@ func renderValsSecrets(e vals.Evaluator, input ...string) ([]string, error) { | |||
return output, nil | |||
} | |||
|
|||
func hideChartCredentials(chartCredentials string) string { | |||
httpIndex := strings.Index(chartCredentials, "http") |
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.
why did only have http? thanks. @NavesEdu
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.
Only the charts that were passed the links through the helmfile presented this credentials exposure problem. So I throught it would be better to hide everything from "http" to "@".
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.
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.
Fixed @yxxhero, thank you!
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.
The result looks a bit strange. sorry for the error display.
http://***@example.com or https://***@example will be better.
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.
I left the output at the default you asked for above, is there still anything I need to change @yxxhero?
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.
No more. Please add more test cases. @NavesEdu
pkg/state/state_test.go
Outdated
input string | ||
expected string | ||
}{ | ||
{"http://example.com@user", "http*****@user"}, |
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.
Normal url style should like this: http://username:password@example.com/. right? thanks so much. @NavesEdu
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.
Yes, I already change this in the test.
5b2ae8e
to
f3422ec
Compare
pkg/state/state_test.go
Outdated
expected string | ||
}{ | ||
{"http://username:password@example.com/", "http@example.com/"}, | ||
{"http://example.com@", "http@"}, |
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.
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.
Done! Also made a improvement to the function I created, thanks @yxxhero!
chart link Signed-off-by: Eduardo Naves <eduardonaves41@gmail.com>
f3422ec
to
272e981
Compare
{"https://username::password@example.com/", "http@example.com/"}, | ||
{"https://username:httpd@example.com/", "http@example.com/"}, | ||
{"https://username:httpsd@example.com/", "http@example.com/"}, | ||
} |
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.
pkg/state/state.go
Outdated
@@ -3192,6 +3192,15 @@ func renderValsSecrets(e vals.Evaluator, input ...string) ([]string, error) { | |||
return output, nil | |||
} | |||
|
|||
func hideChartCredentials(chartCredentials string) string { |
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.
url.Parse
is better?
doc: https://gobyexample.com/url-parsing
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.
@NavesEdu I think so.
@NavesEdu any updates? I wish this can be contained in v0.161.0. I will release v0.161.0 in ths weekend. |
chart link Signed-off-by: Eduardo Naves <eduardonaves41@gmail.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
@NavesEdu WDYT of the new code? |
I had a problem passing a chart's credentials through a helmfile.yaml.
When I ran the following commands:
I could see in the output table, the credentials passed within the helmfile.yaml. So, I did a treatment under the
DisplayAffectedReleases
function to make sure the credentials woudn't be exposed.