-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96eb83b
commit fa87c1d
Showing
4 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/test/java/com/fasterxml/jackson/databind/interop/IllegalTypesCheckTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.fasterxml.jackson.databind.interop; | ||
|
||
import com.fasterxml.jackson.databind.*; | ||
|
||
/** | ||
* Test case(s) to guard against handling of types that are illegal to handle | ||
* due to security constraints. | ||
*/ | ||
public class IllegalTypesCheckTest extends BaseMapTest | ||
{ | ||
static class Bean1599 { | ||
public int id; | ||
public Object obj; | ||
} | ||
|
||
public void testIssue1599() throws Exception | ||
{ | ||
final String JSON = aposToQuotes( | ||
"{'id': 124,\n" | ||
+" 'obj':[ 'com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl',\n" | ||
+" {\n" | ||
+" 'transletBytecodes' : [ 'AAIAZQ==' ],\n" | ||
+" 'transletName' : 'a.b',\n" | ||
+" 'outputProperties' : { }\n" | ||
+" }\n" | ||
+" ]\n" | ||
+"}" | ||
); | ||
ObjectMapper mapper = new ObjectMapper(); | ||
mapper.enableDefaultTyping(); | ||
try { | ||
mapper.readValue(JSON, Bean1599.class); | ||
fail("Should not pass"); | ||
} catch (JsonMappingException e) { | ||
verifyException(e, "Illegal type"); | ||
verifyException(e, "to deserialize"); | ||
verifyException(e, "prevented for security reasons"); | ||
} | ||
} | ||
} |