Closed martinstoeckli closed 1 year ago
@martinstoeckli Thank you for your feedback! After I was considered, I removed the inline "data:" protocol JavaScript module importing. Instead, added another dependency to the "Toolbelt.Blazor.GetProperty.Script" NuGet package that provides a tiny global JavaScript function to retrieve property values under the window object. I released the v.2.0 Preview 1 of this package.
This latest package allows you to make the "script-src" content security policy only "self".
Would you like to try and evaluate it? Again, thank you for your feedback and contributions!
Works like a charm! Thank you for considering this improvement, which makes it easier to build safe apps.
In a Blazor-hybrid project of mine, a content-security-policy is in place, to prevent loading of external JS scripts. To get it running, I had to add
data:
to thescript-src
, because the library generates an inline script with the data: prefix.<meta http-equiv="content-security-policy" content="base-uri 'self'; default-src 'self'; script-src 'self' data:; style-src 'self' 'unsafe-inline'; img-src 'self' data:" />
Maybe this could be mentioned in the documentation, in any case I thought it would be helpful for others to publish it in an issue. Thanks a lot for your great work!