Backoffice Framework Security

Along with the security mechanisms provided by SAP Commerce Cloud Platform, Backoffice Framework provides additional security functionalities to ensure that your application is safe.

Security Headers in Backoffice Framework

Security Headers in Backoffice Framework tell your browser exactly how to behave when it handles your website's content and data.

We ensure that security headers are applied in the Backoffice Framework application context, for example, along with the /backoffice/* path. Reponses from resources other than /backoffice/* do not have necessarily these headers. In network communication with Backoffice Framework every response has the following headers:

Security Header Value Helps preventing from Description
Header Content-Security-Policy (CSP) default-src 'self'; script-src 'self'' 'unsafe-inline' 'unsafe-eval'; connect-src 'self''; img-src 'self' data:; style-src 'self' 'unsafe-inline'; font-src 'self'' XSS, code injection, and clickjacking Sets approved sources of the content to be loaded on a website, supports, for example, images, HTML frames, and audio files.
Header X-XSS-Protection 1; mode=block Compromising cookies, tokens, and XSS such as JavaScript Keylogger Prevents the page from loading when a reflected XSS is detected. It is mostly needed for old types of browsers. Value 1 enables XSS filtering. With other value the page does not get sanitized. When the value block is added, the page is not rendered. When the value report <reporting URI> is set, the page gets sanitized and a report of violation is sent.
Header Strict-Transport-Security (HSTS) max-age=31536000; includeSubDomains Protocol downgrade attacks, cookies hijacking Automatically turns the http links to https, when the security of the connection is not ensured, for example, when the TLS certificate is not trusted, it disallows the user to access the web application and returns an error.
Header X-Content-Type-Options nosniff Uploading malicious files, XSS Provides an opt-out of Internet media type (MIME) sniffing to avoid disguising a file type as something else.
Header X-Frame-Options SAMEORIGIN Clikjacking, and embedding a page into other pages The DENY setting does not allow to display the page anywhere, even on the same page, SAMEORIGIN allows you to embed a page in a frame on the site which is serving the page.

It is possible to override the default values so that they would be less restrictive by changing the project.properties file:

project.properties

#security headers
backoffice.response.header.X-Frame-Options=SAMEORIGIN
backoffice.response.header.Strict-Transport-Security=max-age=31536000; includeSubDomains
backoffice.response.header.X-XSS-Protection=1; mode=block
backoffice.response.header.X-Content-Type-Options=nosniff
backoffice.response.header.Content-Security-Policy=default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; img-src 'self' data: ; style-src 'self' 'unsafe-inline'; font-src 'self'

In case there is a need to replace the static headers with dynamic ones, it is possible to override a bean. The backofficeResponseHeadersFilter is in Backoffice Framework spring filter chain and the backofficeResponseHeadersHandler bean adds headers. The beans configuration looks as follows:

backoffice-spring-filter.xml

<bean id="backofficeResponseHeadersFilter" class="com.hybris.backoffice.filter.responseheaders.BackofficeResponseHeadersFilter">
    <property name="backofficeResponseHeadersHandler" ref="backofficeResponseHeadersHandler"/>
</bean>
 
<alias name="defaultBackofficeSecurityHeadersHandler" alias="backofficeResponseHeadersHandler" />
<bean id="defaultBackofficeSecurityHeadersHandler" class="com.hybris.backoffice.filter.responseheaders.BackofficeResponseHeadersHandler" >
    <property name="cockpitProperties" ref="cockpitProperties"/>
</bean

Below, you can see an example of how the replacement of static headers to dynamic headers looks like:

yourExtensionName-backoffice-spring.xml

 
<bean id="myBackofficeSecurityHeadersHandler" class="org.test.services.MyResponseHeadersHandler">
     <property name="cockpitProperties" ref="cockpitProperties"/>
</bean>
   
<cng:property-extender bean="backofficeResponseHeadersFilter" property="backofficeResponseHeadersHandler">
      <ref bean="myBackofficeSecurityHeadersHandler" />
</cng:property-extender>

anonymoususer.verification Property

To make your application safer, Backoffice Framework ensures that only the users belonging to the Employee user group can sign in to the Backoffice Framework application.

The user, who signed in, is never anonymous, because the BackofficeAuthenticationProvider#authenticate method, ensures only the users belonging to the Employee user group can sign in to the Backoffice Framework application. The backoffice.gettingcurrentuser.annonymoususer.verification property allows the user to decide if the check for anonymous users should be performed. The default value of this property is false and it is consistent with the default BackofficeAuthenticationProvider implementation. In case the behavior of authenticate method is changed, the value of the backoffice.gettingcurrentuser.annonymoususer.verification property has to be considered again.