Skip to content

Commit 5cc45e8

Browse files
committed
Fixed: XML Import fails due to security check (OFBIZ-12602)
When importing an entity with "${" in for at least an element it's rejected because of the security check done to protect from Freemarker unauth attacks (see OFBIZ-12594). As suggested by Ingo, allowing users with appropriate permissions seems an usable solution. We still need to define the "appropriate permissions". We can start with OFBTOOLS and WEBTOOLS, as it's reported by Ingo, and add others later if they ever come. Thanks: Ingo Wolfmayr for report and suggestion
1 parent 63ecc05 commit 5cc45e8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,14 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
134134
if (offset == -1) {
135135
offset = requestUri.length();
136136
}
137-
if (!GenericValue.getStackTraceAsString().contains("ControlFilterTests")
138-
&& null == System.getProperty("SolrDispatchFilter") // Allows Solr tests
139-
&& SecurityUtil.containsFreemarkerInterpolation(httpRequest, httpResponse, requestUri)) {
140-
return;
137+
138+
GenericValue userLogin = (GenericValue) httpRequest.getSession().getAttribute("userLogin");
139+
if (!LoginWorker.hasBasePermission(userLogin, httpRequest)) { // Allows UEL and FlexibleString (OFBIZ-12602)
140+
if (!GenericValue.getStackTraceAsString().contains("ControlFilterTests")
141+
&& null == System.getProperty("SolrDispatchFilter") // Allows Solr tests
142+
&& SecurityUtil.containsFreemarkerInterpolation(httpRequest, httpResponse, requestUri)) {
143+
return;
144+
}
141145
}
142146

143147
while (!allowedPaths.contains(requestUri.substring(0, offset))) {

0 commit comments

Comments
 (0)