Search in sources :

Example 31 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class SecurityDeserializationTestCase method testSecuirtyDatabind4.

@ATTest({ "modules/testcases/jdkAll/Wildfly/security/src/main/java#16.0.0.Beta1", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/security/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap71x/security/src/main/java#7.1.6", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java#7.2.1", "modules/testcases/jdkAll/Eap72x/security/src/main/java#7.2.1" })
@Test
public void testSecuirtyDatabind4() throws Exception {
    final String JSON = aposToQuotes("{'v':['org.apache.axis2.jaxws.spi.handler.HandlerResolverImpl','/tmp/foobar.txt']}");
    ObjectMapper mapper = new ObjectMapper();
    mapper.enableDefaultTyping();
    try {
        PolyWrapper sc = mapper.readValue(JSON, PolyWrapper.class);
        fail("Should not be able to deserialize because of security prevention.");
    } catch (JsonMappingException e) {
        assertTrue("Fail because of security issues...", e.getMessage().contains("prevented for security reasons"));
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 32 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class SecurityDeserializationTestCase method testSecuirtyDatabind8.

@ATTest({ "modules/testcases/jdkAll/Wildfly/security/src/main/java#17.0.0.Beta1", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java#7.2.1", "modules/testcases/jdkAll/Eap72x/security/src/main/java#7.2.1" })
public void testSecuirtyDatabind8() throws Exception {
    final String JSON = aposToQuotes("{'v':['oracle.jdbc.connector.OracleManagedConnectionFactory']}");
    ObjectMapper mapper = new ObjectMapper();
    mapper.enableDefaultTyping();
    try {
        PolyWrapper sc = mapper.readValue(JSON, PolyWrapper.class);
        fail("Should not be able to deserialize because of security prevention.");
    } catch (JsonMappingException e) {
        assertTrue("Fail because of security issues...", e.getMessage().contains("prevented for security reasons"));
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Example 33 with ATTest

use of org.jboss.eap.additional.testsuite.annotations.ATTest in project eap-additional-testsuite by jboss-set.

the class SecurityDeserializationTestCase method testSecuirtyDatabind2.

@ATTest({ "modules/testcases/jdkAll/Wildfly/security/src/main/java", "modules/testcases/jdkAll/WildflyRelease-17.0.0.Final/security/src/main/java", "modules/testcases/jdkAll/Eap72x/security/src/main/java", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java", "modules/testcases/jdkAll/Eap7/security/src/main/java", "modules/testcases/jdkAll/Eap72x-Proposed/security/src/main/java", "modules/testcases/jdkAll/Eap72x/security/src/main/java", "modules/testcases/jdkAll/Eap71x-Proposed/security/src/main/java", "modules/testcases/jdkAll/Eap71x/security/src/main/java" })
@Test
public void testSecuirtyDatabind2() throws Exception {
    final String JSON = aposToQuotes("{'v':['java.util.logging.FileHandler','/tmp/foobar.txt']}");
    ObjectMapper mapper = new ObjectMapper();
    mapper.enableDefaultTyping();
    try {
        PolyWrapper sc = mapper.readValue(JSON, PolyWrapper.class);
        fail("Should not be able to deserialize because of security prevention.");
    } catch (JsonMappingException e) {
        assertTrue("Fail because of security issues...", e.getMessage().contains("prevented for security reasons"));
    }
}
Also used : JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest) Test(org.junit.Test) ATTest(org.jboss.eap.additional.testsuite.annotations.ATTest)

Aggregations

ATTest (org.jboss.eap.additional.testsuite.annotations.ATTest)33 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)23 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)23 Test (org.junit.Test)14 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)6 URI (java.net.URI)4 URL (java.net.URL)2 Calendar (java.util.Calendar)2 GregorianCalendar (java.util.GregorianCalendar)2 ScheduleExpression (javax.ejb.ScheduleExpression)2 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)2 HttpGet (org.apache.http.client.methods.HttpGet)2 CalendarBasedTimeout (org.jboss.as.ejb3.timerservice.schedule.CalendarBasedTimeout)2 ComboPooledDataSource (com.mchange.v2.c3p0.jacksonTest.ComboPooledDataSource)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1