Skip to content
Open
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 @@ -28,6 +28,7 @@
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.HttpClient;
import org.apache.ofbiz.base.util.HttpClientException;
import org.apache.ofbiz.base.util.UtilCodec;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.webapp.control.ConfigXMLReader;

Expand Down Expand Up @@ -67,8 +68,13 @@ public void render(String name, String page, String info, String contentType, St
HttpClient httpClient = new HttpClient(page);
String pageText = httpClient.get();

// TODO: parse page and remove harmful tags like <HTML>, <HEAD>, <BASE>, etc - look into the OpenSymphony piece for an example
response.getWriter().print(pageText);
// Sanitize the retrieved HTML content using the configured OFBiz HTML encoder/sanitizer
String sanitizedPageText = UtilCodec.getEncoder("html").sanitize(pageText, null);

// Explicitly enforce the standard OFBiz permissive HTML policy to guarantee XSS-safe markup rendering
sanitizedPageText = UtilCodec.HtmlEncoder.PERMISSIVE_POLICY.sanitize(sanitizedPageText);

response.getWriter().print(sanitizedPageText);
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
} catch (IOException e) {
throw new ViewHandlerException("IO Error in view", e);
} catch (HttpClientException e) {
Expand Down
Loading