aspnetcore-security-headers
aspnetcore-security-headers copied to clipboard
Using SHA. How do I use it?
I have an issue with inline styles using MTCaptcha in an IFrame. I am getting loads of errors from the browser, refused to allow inline style
I can specify unsafe-inline but I don't want to. Using Nonce doesn't help
The error shows me an SHA value and I am being told to specify that
Can I do that on some way. I was looking for something along the lines of ".Allow("SHA....") but there doesn't seem to be an option. How would I go about doing this?
This might not be possible at the moment. An update could be made that would allow something like:
csp.AllowStyles.WithHash("sha256-RFWPLDbv2BY+rCkDzsE+0fr8ylGr2R2faWMhq4lfEQc=");
or in configuration:
{
"Csp": {
"Style": {
"AllowedHashes": [
"sha256-RFWPLDbv2BY+rCkDzsE+0fr8ylGr2R2faWMhq4lfEQc="
]
}
}
}
@juunas11 i have created a PR for this issue.
The PR has been merged. I was already working on a 5.0.0 version and included the changes in that. It should be available on Nuget soon.