-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSpringStaxUtilsCreateDefensiveInputFactory.java
More file actions
31 lines (24 loc) · 1.1 KB
/
SpringStaxUtilsCreateDefensiveInputFactory.java
File metadata and controls
31 lines (24 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.aspectsecurity.unittestsweb.xxetestcases;
import java.io.IOException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.aspectsecurity.unittestsweb.ExternalTestCaseHelper;
import com.aspectsecurity.unittestsweb.XXETestCase;
@WebServlet("/springStaxUtilsCreateDefensiveInputFactory")
public class SpringStaxUtilsCreateDefensiveInputFactory extends XXETestCase {
/*
* JAXBContext: Unsafe (Safe in Java 1.8 and up) JAXBContext Unmarshaller from File Example
* Proves that XML deserialized using a JAXB Unmarshaller is unsafe from malicious entities when
* unmarshalled directly from File (Safe in 1.8 and up)
*/
protected void doTest(HttpServletRequest request, HttpServletResponse response) throws IOException {
boolean expectedSafe = true;
String path = "/springStaxUtilsCreateDefensiveInputFactory";
String results = ExternalTestCaseHelper.sendExternalRequest(path, request);
if (results != null)
{
printResults(expectedSafe, results, response);
}
}
}