Polish "Sanitize password in URI properties"
See gh-17939
This commit is contained in:
@@ -286,7 +286,7 @@ class ConfigurationPropertiesReportEndpointTests {
|
||||
|
||||
private URI sensitiveUri = URI.create("http://user:password@localhost:8080");
|
||||
|
||||
private URI noPasswordUri = URI.create("http://user:p@localhost:8080");
|
||||
private URI noPasswordUri = URI.create("http://user:@localhost:8080");
|
||||
|
||||
TestProperties() {
|
||||
this.secrets.put("mine", "myPrivateThing");
|
||||
|
||||
@@ -44,6 +44,19 @@ class SanitizerTests {
|
||||
.isEqualTo("http://user:******@localhost:8080");
|
||||
}
|
||||
|
||||
@Test
|
||||
void uriWithNoPasswordShouldNotBeSanitized() {
|
||||
Sanitizer sanitizer = new Sanitizer();
|
||||
assertThat(sanitizer.sanitize("my.uri", "http://localhost:8080")).isEqualTo("http://localhost:8080");
|
||||
}
|
||||
|
||||
@Test
|
||||
void uriWithPasswordMatchingOtherPartsOfString() {
|
||||
Sanitizer sanitizer = new Sanitizer();
|
||||
assertThat(sanitizer.sanitize("my.uri", "http://user://@localhost:8080"))
|
||||
.isEqualTo("http://user:******@localhost:8080");
|
||||
}
|
||||
|
||||
@Test
|
||||
void regex() {
|
||||
Sanitizer sanitizer = new Sanitizer(".*lock.*");
|
||||
|
||||
Reference in New Issue
Block a user