Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HtmlSanitizer] Some minor changes in the config API#44814
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
tgalopin commentedDec 28, 2021 • edited by nicolas-grekas
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by nicolas-grekas
Uh oh!
There was an error while loading.Please reload this page.
Thanks for 1! I'm fine with 2, I included the "all" to clarify the fact that all elements would be added, meaning possibly CSS injection issues, clickjacking issues, ... If we think the new name is enough, I'm good with it, it's good to have shorter names. For 3, I have more reserves. I do think the sanitizer shouldn't have behaviors where the default includes everything. Your proposal would for instance allow style attributes by default, which probably shouldn't happen. I think I'm -1 on this 3rd point. |
javiereguiluz commentedJan 4, 2022
I've reverted all the changes related to (3). Thanks. |
tgalopin commentedJan 5, 2022
Could you update the README as well with the new method name? |
javiereguiluz commentedJan 7, 2022
@tgalopin done! Sorry I forgot about this! |
fabpot commentedJan 7, 2022
Thank you@javiereguiluz. |
First of all, thanks to@tgalopin for this superb contribution 🙇
This PR makes 3 little changes:
(1) Fix two minor typos
(2) Rename
allowAllStaticElements()asallowStaticElements()to be consistent with the rest of methods, which don't include theAllword.(3) A proposal to change this default value:
In my opinion, when you want to allow some element, most of the times you want to allow the standard attributes on them too. So, the following should allow
<div>and their standard attributes:Forcing to write it as
->allowElement('div', '*')seems cumbersome. The previous behavior (forbid all attributes) would now be like this: