1
0
Fork 0

Merge pull request #1102 from rqlite/std-redact

Use standard library redaction functionality
master
Philip O'Toole 2 years ago committed by GitHub
commit 6d14c13299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,6 +4,7 @@
- [PR #1097](https://github.com/rqlite/rqlite/pull/1097), [PR #1110](https://github.com/rqlite/rqlite/pull/1100): Start HTTP server as soon as possible after launch. - [PR #1097](https://github.com/rqlite/rqlite/pull/1097), [PR #1110](https://github.com/rqlite/rqlite/pull/1100): Start HTTP server as soon as possible after launch.
- [PR #1098](https://github.com/rqlite/rqlite/pull/1098): Bootstrapper doesn't need to know the bootstrap-expect value. - [PR #1098](https://github.com/rqlite/rqlite/pull/1098): Bootstrapper doesn't need to know the bootstrap-expect value.
- [PR #1099](https://github.com/rqlite/rqlite/pull/1099): Add explicit `.exit` option to CLI. - [PR #1099](https://github.com/rqlite/rqlite/pull/1099): Add explicit `.exit` option to CLI.
- [PR #1102](https://github.com/rqlite/rqlite/pull/1102): Use BasicAuth redaction functionality from the standard library.
## 7.10.0 (October 26th 2022) ## 7.10.0 (October 26th 2022)
### New features ### New features

@ -56,13 +56,12 @@ func AddBasicAuth(joinAddr, username, password string) (string, error) {
return u.String(), nil return u.String(), nil
} }
// RemoveBasicAuth returns a copy of the given URL, with any basic auth information // RemoveBasicAuth returns a copy of the given URL, with any basic auth password
// removed. // redacted.
func RemoveBasicAuth(u string) string { func RemoveBasicAuth(u string) string {
uu, err := url.Parse(u) uu, err := url.Parse(u)
if err != nil { if err != nil {
return u return u
} }
uu.User = nil return uu.Redacted()
return uu.String()
} }

@ -121,15 +121,15 @@ func Test_RemoveBasicAuth(t *testing.T) {
}, },
{ {
orig: "https://foo:bar@localhost", orig: "https://foo:bar@localhost",
removed: "https://localhost", removed: "https://foo:xxxxx@localhost",
}, },
{ {
orig: "https://foo:bar@localhost:4001", orig: "https://foo:bar@localhost:4001",
removed: "https://localhost:4001", removed: "https://foo:xxxxx@localhost:4001",
}, },
{ {
orig: "http://foo:bar@localhost:4001/path", orig: "http://foo:bar@localhost:4001/path",
removed: "http://localhost:4001/path", removed: "http://foo:xxxxx@localhost:4001/path",
}, },
} }

Loading…
Cancel
Save