-
-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Context
The svelte Live View component renders <style> and <script> tags inline. This can cause issues when using a content security policy because it's inline.
Opportunity
If additional attributes could be added to these tags, it would allow for a more strict CSP header, specifically adding a nonce-* attribute, reference.
Example output
Header
Content-Security-Policy: style-src 'nonce-imk7oIUnJE8r5ResWI1Rq-TsrtoDqZWTVYQIX9Xf9iU' 'self'; script-src 'nonce-8IBTHwOdqNKAWeKl7plt8g==';
Svelte render output
<script nonce="8IBTHwOdqNKAWeKl7plt8g==">/* some head scripts here */</script>
<div id="MyComponent-17506" data-name="MyComponent" data-props="{}" data-live-json="{}" data-slots="{}" phx-update="ignore" phx-hook="SvelteHook" class="">
<style nonce="imk7oIUnJE8r5ResWI1Rq-TsrtoDqZWTVYQIX9Xf9iU">/* some styles here*/</style>
{"var1":null}
<p>component content</p>
</div>camstuart, NeyoYamura and xtian
Metadata
Metadata
Assignees
Labels
No labels