Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion taccsite_cms/templates/analytics.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</script>
{% else %}
<!-- Global site tag (gtag.js) & Google Analytics Code for Site. -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ settings.GOOGLE_ANALYTICS_PROPERTY_ID }}"></script>
<script async nonce="CSP_NONCE" src="https://www.googletagmanager.com/gtag/js?id={{ settings.GOOGLE_ANALYTICS_PROPERTY_ID }}"></script>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a static string value. I think a nonce is suppose to be a random value per HTTP response.

  1. Is this a test? If so, why merge instead of build image from branch?

  2. Why do we now need a nonce? Is it because Google Analytics changed something, and we should "avoid using the CSP unsafe-inline directive" as a solution?

    […] If you don't need nonce, don't use it. […] Always try to take full advantage of CSP protections and avoid nonces or unsafe inline scripts whenever possible.
    MDN: nonce

Note

@chandra-tacc's attempt at this was #672. It probably made a dynamic value, but added nonce on more elements than seemed necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Google also says nonce should be server-generated, but it says the nonce can be supplied in server config's "Content-Security-Policy" instead. That may be easier and cover all scripts.


<!-- Analytics Code -->
<script>
Expand Down