Skip to content

Commit b3b87d9

Browse files
committed
Fixed: Reject wrong URLs (OFBIZ-13006)
Some URLs need to be rejected before they create problems
1 parent 9cee0bf commit b3b87d9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ControlFilter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
134134
// get the request URI without the webapp mount point
135135
String requestUri = httpRequest.getRequestURI().substring(httpRequest.getContextPath().length());
136136

137+
// Reject wrong URLs
138+
try {
139+
String url = new URI(req.getRequestURL().toString()).normalize().toString();
140+
if (!req.getRequestURL().toString().equals(url)) {
141+
throw new RuntimeException();
142+
}
143+
} catch (URISyntaxException e) {
144+
throw new RuntimeException(e);
145+
}
146+
137147
// normalize to remove ".." special name usage to bypass webapp filter
138148
try {
139149
requestUri = new URI(requestUri).normalize().toString();

0 commit comments

Comments
 (0)