AuthenticationProtocolMessage.BuildFormPost script tag CSP nonce
See original GitHub issueIs your feature request related to a problem? Please describe.
It is not recommended to enable unsafe-inline
in content security policy (CSP), as it would allow JavaScript to run without any additional validation. In the event of cross site scripting, CSP would no longer be able to protect the user. It is recommended to instead use CSP nonce and remove unsafe-inline
.
In AuthenticationProtocolMessage.BuildFormPost, there is no way to customize the JavaScript script tag to emit the CSP nonce.
Describe the solution you’d like
Provide an overload in AuthenticationProtocolMessage.BuildFormPost that accepts CSP nonce.
Additional context
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
CSP Nonce ⟶ Script & Style Attribute
Learn how to use a CSP nonce to allow the loading and execution of a script or style tag when a Content-Security-Policy is...
Read more >Content Security Policy multiple nonce - javascript
Your initial CSP, loaded with the page, provides a nonce. What you're trying to do is add another nonce, via Ajax, after the...
Read more >CSP: script-src - HTTP - MDN Web Docs
The HTTP Content-Security-Policy (CSP) script-src directive specifies valid sources for JavaScript. This includes not only URLs loaded ...
Read more >how to add Script tag nonce in ScriptResource.axd which ...
now we are trying add nonce tag for each of Script when page load to support CSP. but for those page with ScriptManager....
Read more >Mitigate cross-site scripting (XSS) with a strict Content Security ...
Learn how to deploy a CSP based on script nonces or hashes as a defense-in-depth against cross-site scripting.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since it seems like using a hash in the CSP provides the same functionality as using a nonce, we’ve decided to add a property that returns the string value of the script so that it is easier for users to calculate the hash (for our 5.5.0 release). We plan on adding an overloaded method that allows users to specify a nonce in our 6.x release (tracked in this issue: #1199).
User should pass “12345”. The nonce attribute name won’t change
I just realize using hash in the csp is an alternative way to solve the problem without changes in the source code
https://www.troyhunt.com/locking-down-your-website-scripts-with-csp-hashes-nonces-and-report-uri/