You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/02/10 10:01:19 UTC
[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull
request #4205: Add class filter Constructor to restrict the illegal class
from YAML
kimmking commented on a change in pull request #4205: Add class filter Constructor to restrict the illegal class from YAML
URL: https://github.com/apache/incubator-shardingsphere/pull/4205#discussion_r376964251
##########
File path: sharding-core/sharding-core-common/src/test/java/org/apache/shardingsphere/core/yaml/engine/YamlEngineTest.java
##########
@@ -38,11 +44,25 @@ public void assertUnmarshal() {
@SuppressWarnings("unchecked")
@Test
public void assertUnmarshalMap() {
- Map<String, Object> actual = (Map<String, Object>) YamlEngine.unmarshal("password: pwd\nauthorizedSchemas: db1");
+ Map<String, Object> actual = (Map<String, Object>) YamlEngine.unmarshal("password: pwd\nauthorizedSchemas: db1", Collections.<Class<?>>emptyList());
assertThat(actual.get("password").toString(), is("pwd"));
assertThat(actual.get("authorizedSchemas").toString(), is("db1"));
}
+ @Test(expected = ConstructorException.class)
+ public void assertUnmarshalMapWithIllegalClasses() {
+ YamlEngine.unmarshal("url: !!java.net.URLClassLoader [[!!java.net.URL [\"http://localhost\"]]]", Collections.<Class<?>>emptyList());
Review comment:
"url: !!java.net.URLClassLoader [[!!java.net.URL [\"http://localhost\"]]]"
maybe not enough
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services