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

Eliminate use of safecss_filter_attr() in processing style attributes since redundant and lossy #1004

merged 1 commit into from Mar 9, 2018


None yet
2 participants
Copy link

westonruter commented Mar 8, 2018

Fixes #613.

There is a problem with the use of safecss_filter_attr() in \AMP_Style_Sanitizer::process_style() introduced via

This is what is removing the display property. It was introduced in de2a303 with the comment:

Filter the styles using safecss_filter_attr() to make sure there
aren't any funky properties. Also alphabetize the valid properties so
that variable order doesn't cause unnecessary duplication.

The logic in safecss_filter_attr() is already being run on post save to strip out display, if the user doesn't have unfiltered_html. So this is preventing safecss_filter_attr() from being called a second time when displaying the post, resulting in a plugin that outputs a Kses-illegal style property to be also erroneously stripped. Otherwise, if a user does have unfiltered_html then they currently aren't able to do so in AMP even in spite of the sanitizer.

@westonruter westonruter added this to the v0.7 milestone Mar 8, 2018

@westonruter westonruter requested a review from coreymckrill Mar 8, 2018

Copy link

coreymckrill left a comment

Looks good to me.

@westonruter westonruter merged commit 8079fcd into develop Mar 9, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed

@westonruter westonruter deleted the fix/style-attribute-processing branch Mar 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment