question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nonce not working in asp.net core mvc

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
bennycoomanscommented, Oct 28, 2019

Thanks, my issue is indeed resolved after using version 3.0.0.

1reaction
GeordieStewcommented, Oct 4, 2019

Cheers. Also, unrelated. Tried in aspnet core 3.0 and not getting the auto completion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.net MVC Application having Nonce Problem in ...
1 Answer 1 · Firstly, please check if you have given the correct domain name and verify. · Visual Studio IIS Express which...
Read more >
NONCE not supported in Asp.Net for CSP implementation
I read that NONCE was not supported in Asp.Net, however, I read another simple article, that shows how it is done? Does anyone...
Read more >
Microsoft login issue in asp.net mvc 5 custom application
When I deployed it on Azure AD app and tested it, login is not working. It is redirecting again again to login page...
Read more >
Content-Security-Policy Nonces in ASP.NET and OWIN
First, it securely generates a 32 byte random nonce. There are no specific guidelines on how big a nonce should be, but a...
Read more >
CSP after applying "script-src 'self' " Kendo control doesn't ...
Our assumption is there are dynamic inline scripts generated for kendo controls which not contains nonce. so it may cause an issue.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found