Skip to main content

Getting unsafe-eval CSP error!


  • New Participant
  • 3 replies

Hi

 

I’m getting unsafe-eval CSP error from script-src policy.

Can this be fixed somehow without adding unsafe-eval to the policy?

Do you have any other script version without eval inside your JS code?

 

Attaching screenshots.

 

 

Regards

4 replies

Shaq Payne
Intercom Team
Forum|alt.badge.img+2
  • Intercom Team
  • 40 replies
  • March 9, 2025

Hey Matt, Shaq here from the Support Engineering team😀

 

Intercom scripts may trigger Content-Security-Policy (CSP) warnings due to the use of the eval function, which is generally not recommended as it can increase the risk of XSS attacks. However, Intercom supports Google strict CSPv3, which includes directives that can help mitigate these risks without enabling unsafe-eval.

 

If you are using a strict CSP, you can include nonce-source(s) for scripts loaded by the Messenger, which allows you to maintain security without enabling unsafe-eval. Despite these warnings, the functionality of Intercom should not be affected if the CSP is configured correctly. This guide her has a little more context as well: https://www.intercom.com/help/en/articles/3894-using-intercom-with-content-security-policy 

 

Let me know if I can clarify anything! 


  • Author
  • New Participant
  • 3 replies
  • March 10, 2025

Hey Shaq, thanks for the answer.

 

Can you please give me an example of how to include nonce for script loaded by Messenger?

We’re already adding nonce to intercom script, what else can I do?

 

Shaq Payne wrote:

If you are using a strict CSP, you can include nonce-source(s) for scripts loaded by the Messenger, which allows you to maintain security without enabling unsafe-eval. Despite these warnings, the functionality of Intercom should not be affected if the CSP is configured correctly.

 

Also, what warnings here we’re talking about?

Shaq Payne wrote:

Despite these warnings, the functionality of Intercom should not be affected if the CSP is configured correctly.

 

Thanks

Matt


  • New Participant
  • 1 reply
  • March 10, 2025

@MattWD did you find a solution to this? I’m also confused about how we’re supposed to add the nonce value to scripts loading inside their SDK code. Trying to fit Intercom under our CSP policy has been a nightmare, to say the least.


  • New Participant
  • 1 reply
  • March 19, 2025

@Jordan Ramey instead of adding a nonce to the intercom scripts you add the nonce attribute and value to any script tags in your html response (matching the nonce in the script-src directive of your CSP header) and set strict-dynamic as a source expression in script-src, which propagates the trust to any script loaded by a tag or script with the nonce attribute.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings