Skip to content

🐛 Block spaced !important in inline style sanitizer - #40536

Open
madib06ops wants to merge 1 commit into
ampproject:mainfrom
madib06ops:inline-style-spaced-important
Open

🐛 Block spaced !important in inline style sanitizer#40536
madib06ops wants to merge 1 commit into
ampproject:mainfrom
madib06ops:inline-style-spaced-important

Conversation

@madib06ops

Copy link
Copy Markdown

INVALID_INLINE_STYLE_REGEX is the only CSS-level check isValidAttr runs on an inline style attribute, and its !important token assumes no whitespace between the ! and important. CSS permits whitespace there and browsers honor color:red ! important as an important declaration, so an author or template value like color:blue ! important slips past the denylist and lands in the DOM after reaching the purifier through amp-mustache, amp-bind [style], or amp-list, letting it override AMP protective !important rules. Relax the token to !\s*important so the spaced and tabbed forms are caught while valid styles and the existing position rules stay unchanged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant