Open aho-exerp opened 11 months ago
I assume you're still facing this in Superset 3.1 / 4.x as we haven't changed much in Talisman configs.
Are you able to add unsafe-inline
to script-src
to work around this? CC @michael-s-molina @kgabryje who might know more about the nonce implementation.
This is coming a bit late but I found a fix.
Instead of using the usual import you can use a similar Jinja macro inside the template like this:
{% with nonce=csp_nonce() %} {% include 'superset/form_view/database_schemas_selector.html' %} {% endwith %}
Which ensures that the nonces it sets is the same one as of all the other scripts that are inside the template and didn't need to be imported.
I have also the issue on superset 4.0.2
On 'CSV to Database configuration' the field for custom delimiter configuration isn't loaded when choosing 'Other' - due to violation of Content Security Policy (CSP) by static nonce on script. The issue isn't present the first time the page is loaded, but upon every following visit to the page.
How to reproduce the bug
Expected results
A free text input field under 'Enter a delimiter for this data' is loaded. No CSP errors.
Actual results
No text input field is loaded, instead in the Dev console of the browser you can see the following error:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'strict-dynamic' 'nonce-A3G08VMJ0tosJ5Wlse9kLCHiqfipHohf'". Either the 'unsafe-inline' keyword, a hash ('sha256-LDZ4ztcGb3PpryC0w3Ox6TyZleJKsSIt1Vu4Zay22rE='), or a nonce ('nonce-...') is required to enable inline execution.
Screenshots
In the html script one can see that the nonce set on the script handling the delimiter does not refresh along with the other nonces on the page when the page is refreshed but instead stays static.
Environment
(please complete the following information):
node -v
Checklist
Make sure to follow these steps before submitting your issue - thank you!
Additional context
Add any other context about the problem here.