Commit ad0a38c7 by Johannes Edmeier

Make the sanitizing for application metadata case-insensitive

fixes #590
parent 8143743d
......@@ -318,7 +318,7 @@ public class Application implements Serializable {
private static Pattern[] createPatterns(String... keys) {
Pattern[] patterns = new Pattern[keys.length];
for (int i = 0; i < keys.length; i++) {
patterns[i] = Pattern.compile(keys[i]);
patterns[i] = Pattern.compile(keys[i], Pattern.CASE_INSENSITIVE);
}
return patterns;
}
......
......@@ -81,7 +81,7 @@ public class ApplicationTest {
@Test
public void test_sanitize_metadata() throws JsonProcessingException {
Application app = Application.create("test").withHealthUrl("http://health")
.addMetadata("password", "qwertz123").addMetadata("user", "humptydumpty").build();
.addMetadata("PASSWORD", "qwertz123").addMetadata("user", "humptydumpty").build();
String json = objectMapper.writeValueAsString(app);
assertThat(json, not(containsString("qwertz123")));
assertThat(json, containsString("humptydumpty"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment