Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,12 @@ public String makeLink(HttpServletRequest request, HttpServletResponse response,

//If required by webSite parameter, surcharge control path
if (webSiteProps.getWebappPath() != null) {
String requestPath = request.getServletPath();
// Derive servlet path from the trusted _CONTROL_PATH_ request attribute (set by ControlServlet)
// rather than calling getServletPath() directly on the request, to avoid relying on user-influenced input.
String contextPath = request.getContextPath();
String requestPath = controlPath.startsWith(contextPath)
? controlPath.substring(contextPath.length())
: controlPath;
if (requestPath == null) requestPath = "";
if (requestPath.lastIndexOf("/") > 0) {
if (requestPath.indexOf("/") == 0) {
Expand Down
Loading