Skip to content

Commit

Permalink
WA-7048: Prevent XSS by always specifying a content-type for get requ…
Browse files Browse the repository at this point in the history
…ests.

Make sure that we always respond with a content-type, org.apache.catalina.servlets.WebdavServlet may not set it on all code paths.
  • Loading branch information
dumitrubogdanmihai committed Feb 9, 2024
1 parent c3a2e2a commit 76389d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void service(HttpServletRequest req, HttpServletResponse resp)
resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}

resp.setContentType("text/plain");
webdavWrapper.service(req, resp);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
response.getWriter().print("{\"trustedHostNotConfigured\": \"true\"}");
}
} else {
response.setContentType("application/octet-stream");
super.doGet(request, response);
}
}
Expand Down Expand Up @@ -255,6 +256,8 @@ protected void service(HttpServletRequest req, HttpServletResponse resp)
return;
}
}

resp.setContentType("application/octet-stream");
super.service(req, resp);
}

Expand Down

0 comments on commit 76389d9

Please sign in to comment.