Commit 7e1062b7 by Johannes Edmeier

Do not include metadata in toString() to prevent password leaks

fixes #789
parent 96498dad
......@@ -27,6 +27,7 @@ import org.springframework.util.Assert;
* @author Johannes Edmeier
*/
@lombok.Data
@lombok.ToString(exclude = "metadata")
public class Application {
private final String name;
private final String managementUrl;
......
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -70,4 +70,10 @@ public class ApplicationTest {
assertThat(a1).isNotEqualTo(a3);
assertThat(a2).isNotEqualTo(a3);
}
@Test
public void should_not_return_sensitive_data_in_toString() {
Application application = Application.create("app").healthUrl("HEALTH").metadata("password", "geheim").build();
assertThat(application.toString()).doesNotContain("geheim");
}
}
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