(OFBIZ-11470) As reported by OWASP ZAP: A cookie has been set without the SameSite attribute, which means that the cookie can be sent as a result of a 'cross-site' request. The SameSite attribute is an effective counter measure to cross-site request forgery, cross-site script inclusion, and timing attacks. The solution was not obvious in OFBiz for 2 reasons: 1. There is no HttpServletResponse::setHeader. So we need to use a filter (SameSiteFilter) and even that is not enough because of 2: 2. To prevent session fixation we force Tomcat to generates a new jsessionId, ultimately put in cookie, in LoginWorker::login. So we need to add a call to SameSiteFilter::addSameSiteCookieAttribute in UtilHttp::setResponseBrowserDefaultSecurityHeaders.
97 lines
4.9 KiB
XML
97 lines
4.9 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
or more contributor license agreements. See the NOTICE file
|
|
distributed with this work for additional information
|
|
regarding copyright ownership. The ASF licenses this file
|
|
to you under the Apache License, Version 2.0 (the
|
|
"License"); you may not use this file except in compliance
|
|
with the License. You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
software distributed under the License is distributed on an
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
KIND, either express or implied. See the License for the
|
|
specific language governing permissions and limitations
|
|
under the License.
|
|
-->
|
|
|
|
<web-app version="4.0" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd">
|
|
<display-name>Apache OFBiz - @component-resource-name@ Component</display-name>
|
|
<description>@component-resource-name@ Component of the Apache OFBiz Project</description>
|
|
|
|
<!-- context-param>
|
|
<param-name>webSiteId</param-name>
|
|
<param-value>@component-name@Site</param-value>
|
|
<description>A unique ID used to look up the WebSite entity. Only for component using a WebSite entity, like ecommerce</description>
|
|
</context-param-->
|
|
<context-param>
|
|
<description>A unique name used to identify/recognize the local dispatcher for the Service Engine</description>
|
|
<param-name>localDispatcherName</param-name><param-value>@component-name@</param-value>
|
|
</context-param>
|
|
<context-param>
|
|
<description>The Name of the Entity Delegator to use, defined in entityengine.xml</description>
|
|
<param-name>entityDelegatorName</param-name><param-value>default</param-value>
|
|
</context-param>
|
|
<context-param>
|
|
<description>The location of the main-decorator screen to use for this webapp; referred to as a context variable in screen def XML files.</description>
|
|
<param-name>mainDecoratorLocation</param-name>
|
|
<param-value>component://@component-name@/widget/CommonScreens.xml</param-value>
|
|
</context-param>
|
|
<context-param>
|
|
<description>Remove unnecessary whitespace from HTML output.</description>
|
|
<param-name>compressHTML</param-name>
|
|
<param-value>false</param-value>
|
|
</context-param>
|
|
|
|
<filter>
|
|
<display-name>ControlFilter</display-name>
|
|
<filter-name>ControlFilter</filter-name>
|
|
<filter-class>org.apache.ofbiz.webapp.control.ControlFilter</filter-class>
|
|
<init-param>
|
|
<param-name>allowedPaths</param-name>
|
|
<param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value>
|
|
</init-param>
|
|
<init-param><param-name>redirectPath</param-name><param-value>/control/main</param-value></init-param>
|
|
</filter>
|
|
<filter>
|
|
<display-name>ContextFilter</display-name>
|
|
<filter-name>ContextFilter</filter-name>
|
|
<filter-class>org.apache.ofbiz.webapp.control.ContextFilter</filter-class>
|
|
</filter>
|
|
<filter>
|
|
<display-name>SameSiteFilter</display-name>
|
|
<filter-name>SameSiteFilter</filter-name>
|
|
<filter-class>org.apache.ofbiz.webapp.control.SameSiteFilter</filter-class>
|
|
</filter>
|
|
<filter-mapping><filter-name>ControlFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
|
|
<filter-mapping><filter-name>ContextFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
|
|
<filter-mapping><filter-name>SameSiteFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>
|
|
|
|
<listener><listener-class>org.apache.ofbiz.webapp.control.ControlEventListener</listener-class></listener>
|
|
<listener><listener-class>org.apache.ofbiz.webapp.control.LoginEventListener</listener-class></listener>
|
|
<!-- NOTE: not all app servers support mounting implementations of the HttpSessionActivationListener interface -->
|
|
<!-- <listener><listener-class>org.apache.ofbiz.webapp.control.ControlActivationEventListener</listener-class></listener> -->
|
|
|
|
<servlet>
|
|
<description>Main Control Servlet</description>
|
|
<display-name>ControlServlet</display-name>
|
|
<servlet-name>ControlServlet</servlet-name>
|
|
<servlet-class>org.apache.ofbiz.webapp.control.ControlServlet</servlet-class>
|
|
<load-on-startup>1</load-on-startup>
|
|
</servlet>
|
|
<servlet-mapping><servlet-name>ControlServlet</servlet-name><url-pattern>/control/*</url-pattern></servlet-mapping>
|
|
|
|
<session-config>
|
|
<session-timeout>60</session-timeout><!-- in minutes -->
|
|
</session-config>
|
|
|
|
<welcome-file-list>
|
|
<welcome-file>index.jsp</welcome-file>
|
|
<welcome-file>index.html</welcome-file>
|
|
<welcome-file>index.htm</welcome-file>
|
|
</welcome-file-list>
|
|
</web-app>
|