TheNab
30 juni 2025 om 00:54
1
inline js script tag wordt niet geladen vanwege csp en ik weet niet hoe ik het moet oplossen.
2 likes
Thereâs some information in this post that may help: Mitigate XSS Attacks with Content Security Policy
CSP and third-party integrations
When using third-party services like Google Tag Manager, Google Analytics, or advertising services, you may need to adjust your CSP settings. In most cases with Discourse version 3.3.0.beta1 or later, external scripts should work without additional configuration due to the âstrict-dynamicâ CSP implementation.
If you encounter issues, you may need to:
Identify the required script sources by monitoring your browser console
Add the necessary sources to the content_security_policy_script_src setting
For complex integrations like ad services which load external resources, you might need to enable cross-domain rendering (Example PR from discourse-adplugin that does this).
Best practices
Start with CSP Report-Only mode to identify potential issues
Gradually tighten your CSP as you resolve legitimate violations
Regularly review your CSP settings and adjust as needed
Be cautious when adding permissive directives like 'unsafe-eval' or 'wasm-unsafe-eval'
Keep your Discourse instance updated to benefit from the latest CSP improvements
1 like
TheNab
30 juni 2025 om 17:14
3
Ik heb dat en andere gelezen, maar kan niet achterhalen hoe ik de uitzondering daadwerkelijk moet toevoegen aan de content_security_policy_script_src.
1 like
Do you see an error concerning the script in your browser console? something like this?
Youâll want to add that provided hash ('sha256-xxxxx') to the âcontent security policy script srcâ setting found in admin > all site settings
1 like
De fout die ik kreeg had nonce-s0m3h4sh in de Firefox-browser, ik kreeg de sha256-s0m3h4sh niet. Maar toen ik het net in Chrome bekeek, was het de sha256-versie. Ik vermoed dat dat de oorzaak was van de meeste verwarring.
2 likes
system
(system)
gesloten
31 juli 2025 om 15:58
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.