# Unterstützung für CSP-Nonce-Quellen hinzufügen

**URL:** <https://meta.discourse.org/t/add-csp-nonce-source-support/93300>\
**Category:** Development\
**Created:** [27. Juli 2018 um 16:19 UTC](https://meta.discourse.org/t/add-csp-nonce-source-support/93300 "2018-07-27T16:19:33Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)\
**Post date:** [30. Juli 2018 um 16:10 UTC](https://meta.discourse.org/t/add-csp-nonce-source-support/93300/4 "2018-07-30T16:10:13Z")

</div>

Sure, done in: [GitHub - LeoMcA/discourse at csp-nonce-source · GitHub](https://github.com/LeoMcA/discourse/tree/csp-nonce-source)

The code is pretty straightforward, most of the changes are just adding the nonce attribute to all the tags: [https://github.com/discourse/discourse/compare/master...LeoMcA:csp-nonce-source](https://github.com/discourse/discourse/compare/master...LeoMcA:csp-nonce-source)

I’ve spun up a temporary instance to show the CSP working in practice: [https://discourse-csp-nonce.mozilla.community/](https://discourse-csp-nonce.mozilla.community/)

(which gets an A from Mozilla Observatory! [Scan results - HTTP Observatory | MDN](https://observatory.mozilla.org/analyze/discourse-csp-nonce.mozilla.community))

Open the developer console to see the CSP in action:

 ![Screenshot%20from%202018-07-30%2017-11-29](https://global.discourse-cdn.com/meta/original/3X/4/f/4f0a44d158d03699c68684d39b884acbf7875734.png)

Just for this proof of concept [I’m not adding the nonce attribute to theme’s `body_tag`](https://github.com/discourse/discourse/blob/4e9dd43c0e6b3eb630063dbe0b4408a7db56c5dd/app/helpers/application_helper.rb#L378-L380) to show how this greatly reduces the risk of XSS.

---

_[View the full topic](https://meta.discourse.org/t/add-csp-nonce-source-support/93300)._
