Skip to content

Decode some html entities #835

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

Merged
merged 7 commits into from
Aug 9, 2016
Merged

Decode some html entities #835

merged 7 commits into from
Aug 9, 2016

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Aug 9, 2016

In #804, we dropped html entity decoding for performance reasons, but apparently some folks have been using &,  , etc in their graphs. We need to bring back support for these ASAP.

So, I propose supporting a few entities by translating them one-by-one to unicode.

This PR also DRYs up some code by making sure that svg_text_utils.js (for svg text) and html2unicode (for WebGL text) use the same mappings.

- use it in html2unicode and svg_text_utils to
  translate a limited set of HTML enitity to unicode
- list unicode-to-entities mappings
  (used in svg text style and anchors)
- this commit partly reverts 6cf80de
@etpinard etpinard added bug something broken status: reviewable labels Aug 9, 2016
@@ -121,34 +121,33 @@ describe('svg+text utils', function() {
});

it('wrap XSS attacks in href', function() {
var node = mockTextSVGElement(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverting a commit from PR #804, as now <, > and " are now back in play.

@etpinard
Copy link
Contributor Author

etpinard commented Aug 9, 2016

@scjody the most important commit is ba6320e

'amp': '&',
'lt': '<',
'gt': '>',
'quot': '\"',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&quot; support makes me really uncomfortable since it's been part of so many of our XSS attacks (inserting a " sometimes allows an entity to be terminated early).

Is this definitely needed?

(The rest looks OK to me.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it isn't definitely needed. I thought it was common enough to be part of the list. I'll drop it.

@scjody
Copy link
Contributor

scjody commented Aug 9, 2016

💃

@etpinard etpinard merged commit c47a2db into master Aug 9, 2016
@etpinard etpinard deleted the decode-some-html-entities branch August 9, 2016 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants