aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-11-19 08:45:02 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2015-11-19 09:04:15 +0100
commit06623086e231ef094ec80b65a18b0fe8c8457bb7 (patch)
tree6356eb5adf0890a8ff0a5300104c427a7826f017 /pdf-as-web/src/main/java/at/gv/egiz
parent32bf02fbf25c5a9ab0133e7edba5d5edea914d30 (diff)
downloadpdf-as-4-06623086e231ef094ec80b65a18b0fe8c8457bb7.tar.gz
pdf-as-4-06623086e231ef094ec80b65a18b0fe8c8457bb7.tar.bz2
pdf-as-4-06623086e231ef094ec80b65a18b0fe8c8457bb7.zip
XML-Entity Injection in DataUrl Servlet gefixt
Diffstat (limited to 'pdf-as-web/src/main/java/at/gv/egiz')
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java17
-rw-r--r--pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java4
2 files changed, 21 insertions, 0 deletions
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
index 52eb8468..b2559b25 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/helper/PdfAsHelper.java
@@ -793,6 +793,23 @@ public class PdfAsHelper {
return baos.toByteArray();
}
+ public static boolean checkDataUrlAccess(HttpServletRequest request) throws Exception {
+ HttpSession session = request.getSession(false);
+
+ if(session != null) {
+ Object statusObject = session
+ .getAttribute(PDF_STATUS);
+ if(statusObject != null && statusObject instanceof StatusRequest) {
+ StatusRequest statusRequest = (StatusRequest)statusObject;
+ if(statusRequest.needCertificate() || statusRequest.needSignature()) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
public static void injectCertificate(HttpServletRequest request,
HttpServletResponse response,
InfoboxReadResponseType infoboxReadResponseType,
diff --git a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
index 5b3fe82a..13c37171 100644
--- a/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
+++ b/pdf-as-web/src/main/java/at/gv/egiz/pdfas/web/servlets/DataURLServlet.java
@@ -80,6 +80,10 @@ public class DataURLServlet extends HttpServlet {
protected void process(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
try {
+ if(!PdfAsHelper.checkDataUrlAccess(request)) {
+ throw new Exception("No valid dataURL access");
+ }
+
PdfAsHelper.setFromDataUrl(request);
String xmlResponse = request.getParameter("XMLResponse");