-
Notifications
You must be signed in to change notification settings - Fork 249
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
redo sanitize_css to use a css parser #248
Comments
I'm putting this in the 2.0 milestone for now because I'm changing lots of things, but will push it out if I don't have time. |
I got tinycss sort of working with Bleach. Something like this:
We have a test that verifies that bogus CSS gets dropped:
It fails the second assertion in that test. For some reason tinycss thinks I think I'm going to leave things as they are and think about this issue some more another time. Possible options:
|
I recently tried replacing html5lib’s FWIW, I realised it made sense to also have a whitelist of CSS property functions ( |
Oo--supporting CSS property functions is pretty interesting. Maybe |
@peterbe suggested some other options too:
and willkg suggested rolling a minimal parser (e.g. just of declarations) might suffice. |
just wanted to mention that there is also tinycss2 which handles some edge cases much better than tinycss did. |
Yep! The current plan is to drop Python 2 support in a major release so we can use tinycss2. |
I don't want to move forward with this. Instead I want to switch gears and focus our efforts on issue #633. I'm going to close this out. |
html5lib has this issue for replacing parts of the
sanitize_css()
method with a better CSS parser:html5lib/html5lib-python#152
Bleach has its own
sanitize_css()
which probably has some of the same problems, but not all of them. Might be worth switching to a library instead.The text was updated successfully, but these errors were encountered: