Zendesk

CSP for Zendesk

supportchatcrm

Using Zendesk with Content Security Policy

Zendesk is a popular helpdesk system, with abilities for agent chat and ticket management. It's documentation does not really explain which directives are needed, and the RapidSec data network adds more directives - in order to make sure that your CSP does not break Zendesk's functionality. Please note that the Zendesk scripts may introduce 'unsafe-eval' to your site, which would need to be approved manually.

Allow these directives in your CSP, to support Zendesk in your Content Security Policy:

script-src
  https://assets.zendesk.com
  https://{{zendeskSubdomain}}.zendesk.com
  https://static.zdassets.com
  https://widget-mediator.zopim.com
  https://v2.zopim.com
  https://theme.zdassets.com;
style-src
  'unsafe-inline'
  *.zdassets.com;
img-src
  data:
  *.zendesk.com
  *.zdassets.com
  *.zopim.io
  *.zopim.com
  *.zdusercontent.com;
font-src
  data:
  *.zopim.com
  static.zdassets.com;
connect-src
  {{zendeskSubdomain}}.zendesk.com
  wss://{{zendeskSubdomain}}.zendesk.com
  ekr.zdassets.com
  *.zopim.com
  wss://*.zopim.com
  *.zopim.io;
media-src
  static.zdassets.com;

The main domains used by Zendesk are:

zdassets.com
zopim.com
zendesk.com
zopim.io
zdusercontent.com

Sources:

Using Zendesk with Content Security Policy(Offical Docs)RapidSec CSP Generator(RapidSec Data Network)

Example Content-Security-Policy violations / reports:

Using the above CSP package, will fix these errors that you may be seeing in your console logs:

script-src/script-src-elem/script-src-attrviolations

Refused to load the script 'https://static.zdassets.com/web_widget/latest/vendors~framework.*.chunk.js' because it violates the following Content Security Policy directive: "script-src 'self' 'report-sample'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.

If you see inline style errors, you need to add SHA-256 hashes / nonces to your CSP with RapidSec:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'report-sample'". Either the 'unsafe-inline' keyword, a hash ('sha256-RFWPLDbv2BY+rCkDzsE+0fr8ylGr2R2faWMhq4lfEQc='), or a nonce ('nonce-...') is required to enable inline execution.

If you see inline eval() errors, RapidSec will generate your CSP with the specific content of the errors:

Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self' 'report-sample'".

style-src/style-src-elem/style-src-attrviolations

If you see inline style errors, you need to add SHA-256 hashes / nonces to your CSP with RapidSec:

Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'report-sample'". Either the 'unsafe-inline' keyword, a hash ('sha256-RFWPLDbv2BY+rCkDzsE+0fr8ylGr2R2faWMhq4lfEQc='), or a nonce ('nonce-...') is required to enable inline execution.

font-srcviolations

Refused to load the font 'https://v2.zopim.com/widget/fonts/zopim.ttf' because it violates the following Content Security Policy directive: "font-src 'self'"

img-srcviolations

Refused to load the image 'zdassets.com' because it violates the following Content Security Policy directive: "img-src 'self'".

frame-srcviolations

[Report Only] Refused to frame 'zdassets.com' because it violates the following Content Security Policy directive: "frame-src 'self'".

form-actionviolations

[Report Only] Refused to send form data to 'zdassets.com' because it violates the following Content Security Policy directive: "form-action 'self'".

connect-srcviolations

[Report Only] Refused to connect to 'zdassets.com' because it violates the following Content Security Policy directive: "connect-src 'self'"