Replace CSP 'nonce-<base64>' directive with 'self' directive#43553
Replace CSP 'nonce-<base64>' directive with 'self' directive#43553joshdover merged 4 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/kibana-security |
|
ACK: reviewing now |
There was a problem hiding this comment.
If someone happened to set the following, we'll likely be breaking this install csp.rules: ["default-src 'unsafe-eval' 'nonce-{nonce}'"]. What if instead whenever we removed a nonce source, we added the 'self' source?
There was a problem hiding this comment.
That should work. I think we should still also add it if script-src or style-src don't have self or nonce.
There was a problem hiding this comment.
This seems reasonable to me.
💔 Build Failed |
c462845 to
4c1f14a
Compare
💔 Build Failed |
💚 Build Succeeded |
💚 Build Succeeded |
mistic
left a comment
There was a problem hiding this comment.
In the operations side it looks good to me! 👍
💚 Build Succeeded |
| <!DOCTYPE html> | ||
| <title>Kibana OpenID Connect Login</title> | ||
| <script nonce="${nonce}"> | ||
| <script> |
There was a problem hiding this comment.
question: hmmm @joshdover @kobelb aren't we effectively disabling execution of this script here assuming our default CSP rule is script-src 'unsafe-eval' 'self'; now?
Summary
Closes #42497
This replaces our usage of the
'nonce-{nonce}'directive with'self'which will allow us to support dynamic imports more easily.This change is BWC by adding fixes for any invalid rules in the
csp.rulesconfig option:{nonce}template, that source will be removed and a warning will be logged.'self', it will be added and a warning will be logged.Dev Docs
Kibana no longer supports the
{nonce}notation in thecsp.rulesconfiguration. These will be replaced with the'self'source directive automatically and log a deprecation warning. The{nonce}notation must be removed before upgrading to 8.0.Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers