-
Notifications
You must be signed in to change notification settings - Fork 43
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
Nonce not working in asp.net core mvc #45
Comments
Same issue here. |
Okay, I'll try to have a look at it at some point. |
Cheers. Also, unrelated. Tried in aspnet core 3.0 and not getting the auto completion. |
I have the same issue. The nonce worked correctly in our project when it was a If you need a sample project (I would need to create one since our project is a private project), let me know. |
I've published version 3.0.0 on Nuget now that should fix the issues. I had to update some of the dependencies related to Razor to get it to work, similar to this other issue: Shazwazza/Smidge#89. Try it out and see if your issue is solved, the sample app started functioning once I did those updates. |
Thanks, my issue is indeed resolved after using version 3.0.0. |
I have this problem still. My project is asp.net core 2.2 and using the 3.0.0 version of this library. The script tag ends up like <script nonce="">. I can verify the nonce service is working but the attribute is never filled in. |
@goekboet Okay that sounds odd. Keep in mind that 2.2 will be out of support in a few weeks though. |
Yes. I realized a bit later that chrome the attribute renders with edge but not with chrome. I'm looking into why this is but it's probably not anything to do with this library. The attribute renders as empty string even though I hard code it in chrome. |
@goekboet, I had a similar issue, however, after some research, I found this Stackoverflow answer which says
|
I think I hit that one as well during development; confused the heck out of me.. It might be a security thing so another script etc. could not copy it? |
Hi
I followed your guide on the readme but I cant get the nonce to work, unsafe inline is working fine.
I have created a testproject where I add the
services.AddCsp(nonceByteAmount: 32);
in the configureservices section and the
app.usecsp in the Configure section with .AddNonce()
added the taghelper in the viewimport
and added the asp-add-nonce="true" to the script tag.
It also get the auto completion for that tag.
but when i start the website i get an error that it violates the csp rules because the inline doesnt have a nonce.
I added the nonce in the index.cshtml
here the testproject to download : https://www.dropbox.com/sh/9ykavf5c0kik6j7/AABNY-Tsnm8WK3tftgw7lj9Sa?dl=0
The text was updated successfully, but these errors were encountered: