Problem/Motivation
The Content-Security-Policy (CSP) module facilitates adding a nonce to inline scripts. Any policy that blocks inline scripts will render this module useless unless we use a nonce.
Steps to reproduce
Proposed resolution
- Add additional script field that gets wrapped in script tags automatically (using
html_tagrender element) - Add CSP nonce integration to script tags
Alternatively we would have to parse script tags from the snippet and add the nonce attribute there.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork script_manager-3476304
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
mstrelan commentedFirst pass, needs a bit of cleanup. Seems to work, needs tests and scrutiny.
Comment #4
mstrelan commentedIn practice we have snippets that combine
<script>,<style>and<link>tags in the same snippet, so unfortunately the original approach of adding a checkbox doesn't work. Have updated the approach to provide a separate field for entering the javascript, and repurposed the existing field for supporting markup.Comment #5
mstrelan commentedComment #6
larowlan