Skip to content
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

Prevent style injections #19

Merged
merged 7 commits into from
May 12, 2018
Merged

Prevent style injections #19

merged 7 commits into from
May 12, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented May 12, 2018

Local directives about background images have an basic vulnerability of style injection. It can apply any style, and can access to unexpected remote URL by url().

<!-- backgroundSize: "auto;filter:url('https://example.com/unexpeted/')" -->

We create InlineStyle helper class to sanitize unexpected declarations through PostCSS.

🤔 In future, supporting CSP's unsafe-inline is a good idea. If element requires inline style, we assigns only data attribute to the element and themeSet.pack() makes packed CSS includes inline styles.

In image filter syntax, we have already applied escaping passed filter arguments, but current way of escaping CSS is wrong. We have fixed to follow W3C CSS3 Escaping. e.g.: \( ➡️ \28 

CSS.escape or its polyfill will too much escape chars, and it will break filter functions.

@yhatt yhatt merged commit f829fde into master May 12, 2018
@yhatt yhatt deleted the prevent-style-injections branch May 12, 2018 10:16
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