New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fingerprinting and SRI ordering issue #5296

Closed
onedrawingperday opened this Issue Oct 8, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@onedrawingperday
Contributor

onedrawingperday commented Oct 8, 2018

It seems that to generate the SHA value for an inline script we need to wrap it within a {{ if $secureJS.Content }}{{ end }} before accessing the integrity.

Also see related Forum topic: https://discourse.gohugo.io/t/generate-inline-script-sha-for-content-security-policy/14627

@bep bep added the Enhancement label Oct 8, 2018

@bep bep added this to the v0.50 milestone Oct 8, 2018

@bep bep added Bug and removed Enhancement labels Oct 27, 2018

@bep

This comment has been minimized.

Member

bep commented Oct 27, 2018

I will fix this, but note that in the original problem case, adding MIME type to the script would also work:

<script type="{{ $secureJS.MediaType }}" integrity="{{ $secureJS.Data.Integrity }}">{{ $secureJS.Content | safeJS }}</script>

bep added a commit to bep/hugo that referenced this issue Oct 27, 2018

@bep bep closed this in #5363 Oct 27, 2018

bep added a commit that referenced this issue Oct 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment