Skip to content
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

Generate automated hashes and add to CSP header #13

Open
psolbach opened this issue Jun 10, 2022 · 3 comments
Open

Generate automated hashes and add to CSP header #13

psolbach opened this issue Jun 10, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@psolbach
Copy link
Member

psolbach commented Jun 10, 2022

In order to have a relatively secure ruleset in our CSP header, we would want to allow both script-src and inline Javascript files based on their content hashes. We might generate these hashes during build and inject them into our _headers file and in the DOM.

@psolbach psolbach added the enhancement New feature or request label Jun 10, 2022
@sebil
Copy link
Contributor

sebil commented Jun 10, 2022

Hugo has a built-in "fingerprint" function, which automatically generates hashes for script files.
Maybe we could use that exact same hashes for the _headers?

@psolbach
Copy link
Member Author

@sebil Sounds like a plan! Haven't tested yet, but the default hash function used by Hugo is sha256, so exactly what we need.

@psolbach
Copy link
Member Author

Mind you, I'm not sure about the cost-benefit of this idea. We'll see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants