Repository navigation
Core screens that work with a nonce-based CSP (no inline JavaScript) #48738
anabobillo3
started this conversation in
1. Feature Evaluation
Replies: 1 comment 1 reply
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
With the Nonce option of the System - HTTP Headers plugin turned on, browsers ignore
'unsafe-inline', so every inline event handler (onclick,onchange, ...) and everyjavascript:link in core stops working. #45770 reports two of them on the frontend category list. Part of this is already done or open: #39730 (JGrid), #45910 (Grid::id), #48523 (frontend sort headings) and #48737 (check all, limit box, administrator pagination).What is left on 6.3-dev:
onchange/onclickattributes on form fields in the core XML formsjavascript:URLsnew Function()calls in media JavaScript, which need'unsafe-eval'Proposal
Convert them area by area, the way #45910 and #48523 do: classes and data attributes handled by scripts core already has (mostly
list-view), with each helper loading the script it needs. Where the inline code comes from something an extension can pass in (a custom action forGrid::checkall,$button['onclick']in the login module and view,onchangeon form fields), it keeps working as it does today, so nothing breaks for extensions.One PR per area, so each one stays small enough to test:
onchange/onclick, while the field attributes stay for extensions. This one changes how fields are used, so I would like feedback on it here before writing it.Why
A nonce-based policy without
'unsafe-inline'is one of the best protections a browser can give against XSS, but today it can't be turned on without breaking much of the administrator. Once this is done, a site can enable it from the plugin.Questions
All reactions