-
Notifications
You must be signed in to change notification settings - Fork 322
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
Do not marshal secrets in URL's #328
Do not marshal secrets in URL's #328
Conversation
config/http_config.go
Outdated
} | ||
return nil, nil | ||
} | ||
|
||
// MarshalYAML implements the yaml.Marshaler interface for URLs. |
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.
This comment doesn't describe this function.
config/http_config.go
Outdated
@@ -110,11 +110,24 @@ func (u *URL) UnmarshalYAML(unmarshal func(interface{}) error) error { | |||
// MarshalYAML implements the yaml.Marshaler interface for URLs. | |||
func (u URL) MarshalYAML() (interface{}, error) { | |||
if u.URL != nil { | |||
return u.String(), nil | |||
return u.Redact(), nil |
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.
Could we just use url.Redacted()
?
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.
We can't as it is only supported from go 1.15 and +. But my intention was to use the same name, I will fix that.
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.
Go dropped support for 1.15 now that 1.17 is out. We could now require that.
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.
Thanks!
I think we could update to require 1.15. |
That is a question for client_golang.
Le mar. 28 sept. 2021 à 07:38, Ben Kochie ***@***.***> a
écrit :
… I think we could update to require 1.15.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#328 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHHJWKFHOXITCWVI7CDCDUEFIHDANCNFSM5E2ZPVPA>
.
|
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.
LGTM with a nit
config/http_config.go
Outdated
if u.URL != nil { | ||
ru := *u.URL | ||
if _, ok := ru.User.Password(); ok { | ||
// We can not use secretToken because it would be escaped. | ||
ru.User = url.UserPassword(ru.User.Username(), "xxxxx") | ||
} | ||
return ru.String() | ||
} | ||
return "" |
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.
Look nicer, less indentation
if u.URL != nil { | |
ru := *u.URL | |
if _, ok := ru.User.Password(); ok { | |
// We can not use secretToken because it would be escaped. | |
ru.User = url.UserPassword(ru.User.Username(), "xxxxx") | |
} | |
return ru.String() | |
} | |
return "" | |
if u.URL == nil { | |
return "" | |
} | |
ru := *u.URL | |
if _, ok := ru.User.Password(); ok { | |
// We can not use secretToken because it would be escaped. | |
ru.User = url.UserPassword(ru.User.Username(), "xxxxx") | |
} | |
return ru.String() |
Signed-off-by: Julien Pivotto <[email protected]>
a66304f
to
b6d7542
Compare
Signed-off-by: Julien Pivotto [email protected]