|
|
|
@ -17,6 +17,7 @@ |
|
|
|
package org.springframework.boot.actuate.endpoint; |
|
|
|
package org.springframework.boot.actuate.endpoint; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
@ -212,6 +213,23 @@ public class ConfigurationPropertiesReportEndpointTests |
|
|
|
assertThat(item.get("somePassword")).isEqualTo("******"); |
|
|
|
assertThat(item.get("somePassword")).isEqualTo("******"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
@SuppressWarnings("unchecked") |
|
|
|
|
|
|
|
public void listsOfListsAreSanitized() throws Exception { |
|
|
|
|
|
|
|
ConfigurationPropertiesReportEndpoint report = getEndpointBean(); |
|
|
|
|
|
|
|
Map<String, Object> properties = report.invoke(); |
|
|
|
|
|
|
|
Map<String, Object> nestedProperties = (Map<String, Object>) ((Map<String, Object>) properties |
|
|
|
|
|
|
|
.get("testProperties")).get("properties"); |
|
|
|
|
|
|
|
assertThat(nestedProperties.get("listOfListItems")).isInstanceOf(List.class); |
|
|
|
|
|
|
|
List<List<Object>> listOfLists = (List<List<Object>>) nestedProperties |
|
|
|
|
|
|
|
.get("listOfListItems"); |
|
|
|
|
|
|
|
assertThat(listOfLists).hasSize(1); |
|
|
|
|
|
|
|
List<Object> list = listOfLists.get(0); |
|
|
|
|
|
|
|
assertThat(list).hasSize(1); |
|
|
|
|
|
|
|
Map<String, Object> item = (Map<String, Object>) list.get(0); |
|
|
|
|
|
|
|
assertThat(item.get("somePassword")).isEqualTo("******"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Configuration |
|
|
|
@Configuration |
|
|
|
@EnableConfigurationProperties |
|
|
|
@EnableConfigurationProperties |
|
|
|
public static class Parent { |
|
|
|
public static class Parent { |
|
|
|
@ -254,10 +272,13 @@ public class ConfigurationPropertiesReportEndpointTests |
|
|
|
|
|
|
|
|
|
|
|
private List<ListItem> listItems = new ArrayList<ListItem>(); |
|
|
|
private List<ListItem> listItems = new ArrayList<ListItem>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<List<ListItem>> listOfListItems = new ArrayList<List<ListItem>>(); |
|
|
|
|
|
|
|
|
|
|
|
public TestProperties() { |
|
|
|
public TestProperties() { |
|
|
|
this.secrets.put("mine", "myPrivateThing"); |
|
|
|
this.secrets.put("mine", "myPrivateThing"); |
|
|
|
this.secrets.put("yours", "yourPrivateThing"); |
|
|
|
this.secrets.put("yours", "yourPrivateThing"); |
|
|
|
this.listItems.add(new ListItem()); |
|
|
|
this.listItems.add(new ListItem()); |
|
|
|
|
|
|
|
this.listOfListItems.add(Arrays.asList(new ListItem())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public String getDbPassword() { |
|
|
|
public String getDbPassword() { |
|
|
|
@ -308,6 +329,14 @@ public class ConfigurationPropertiesReportEndpointTests |
|
|
|
this.listItems = listItems; |
|
|
|
this.listItems = listItems; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<List<ListItem>> getListOfListItems() { |
|
|
|
|
|
|
|
return this.listOfListItems; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setListOfListItems(List<List<ListItem>> listOfListItems) { |
|
|
|
|
|
|
|
this.listOfListItems = listOfListItems; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static class Hidden { |
|
|
|
public static class Hidden { |
|
|
|
|
|
|
|
|
|
|
|
private String mine = "mySecret"; |
|
|
|
private String mine = "mySecret"; |
|
|
|
|