Author: jleroux
Date: Thu Nov  1 09:39:17 2018
New Revision: 1845420

URL: http://svn.apache.org/viewvc?rev=1845420&view=rev
Log:
Fixed: Missing Security and Cache Headers in CMS Events
Fixed:
(OFBIZ-10597)

While rendering the view through the controller request we set the important 
security headers like x-frame-options, strict-transport-security, 
x-content-type-options, X-XSS-Protection and Referrer-Policy etc. in the 
response object. (Please see the 'rendervView' method of RequestHandler class.) 
 
In the similar line, we set the cache related headers like Expires, 
Last-Modified, Cache-Control, Pragma.
 
But these security headers are missing in the pages rendered through CMS. 
(Please visit the CmsEvents class).
 
These headers are very crucial for the security of the application as they help 
to prevent various security threats like cross-site scripting, 
cross-site request forgery, clickjacking etc. 

Thanks: Deepak Nigam for initial patch and review

Modified:
    
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java

Modified: 
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java?rev=1845420&r1=1845419&r2=1845420&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/cms/CmsEvents.java
 Thu Nov  1 09:39:17 2018
@@ -288,6 +288,11 @@ public class CmsEvents {
                 RequestHandler rh = (RequestHandler) 
ctx.getAttribute("_REQUEST_HANDLER_");
                 templateMap.put("_REQUEST_HANDLER_", rh);
 
+                //Cache Headers
+                UtilHttp.setResponseBrowserProxyNoCache(response);
+                //Security Headers
+                UtilHttp.setResponseBrowserDefaultSecurityHeaders(response, 
null);
+
                 response.setStatus(statusCode);
 
                 try {


Reply via email to