Content Security Policy icon
Module Id
content-security-policy
Group Id
org.jahia.modules
Updated
Requires Jahia
8.0.1.0
Author
JSG
Category
Tools and Utilities
Status
SUPPORTED info

Content Security Policy check_circle

security

The purpose of this module is to allow the definition of a Content Security Policy for a website inside Digital Experience Manager. For more information about the Content Security Policy, please refer to this URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy

Dependencies & Dependants

Dependencies
  • NONE
Dependants
  • NONE

Changelog 2.4.0

  • Updated jahia-depends property to have more accurate dependencies

FAQ

  • How to only report the CSP violations during a test phase?

You just have to check the box Only report CSP violations and the violations will be logged in the Jahia log files.

  • How to generate the nonce value?

In your custom module, you have to set the value of the attribute nonce to the value of the Jahia property contentSecurityPolicy.nonce.placeHolder.

The value of your CSP, at the site level, has to contain the string nonce-.

Then for each page rendering, a random value will be generated and:

  1. will update the CSP for the page
  2. will replace in the HTML code the static value of the nonce

This way, a potential hacker should not be able to bypass this security.

How To Install

Installation

  • In DX, go to "Administration --> Server settings --> System components --> Modules"
  • Upload the JAR content-security-policy-X.X.X.jar
  • Check that the module is started

Use

Administration

  • Go to "Administration -> Server settings -> Web Projects"
  • Edit the site with which you want to use this module and add it to the list of the deployed modules

Edit mode

  • CSP at the site level:
    • Go to the "Edit mode", right click on the root of the site and edit it
    • Go to the tab "Options" and activate the item "Add Content Security Policy at the site level"
    • Add in the text area the policy on one line

Images

License

MIT License

Copyright (c) 2018 - present Florent BOURASSÉ

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.