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

Options that contain special HTML characters render incorrectly #171

Open
lawrence-ofsystems opened this issue Feb 2, 2020 · 0 comments

Comments

@lawrence-ofsystems
Copy link

The HTML <option> elements used to initialise the multiselect control may contain special characters that must be encoded appropriately when setting the content and attributes of the multiselect control's HTML <li> elements. Problematic characters may include the double-quote, single-quote, greater-than, less-than and ampersand characters. The multiselect control uses simple string concatenation to construct the raw HTML of each <li> element without properly encoding the control's content and attribute values copied from the source element. This may lead to rendering errors, behaviour errors, and exposes the control to potential security issues. Instead, the available jQuery methods should be used to set the attribute and content values of constructed <li> elements to ensure the source <option> element settings are properly HTML encoded.

Steps to Reproduce:

  • Create and input option element that contains the following valid HTML:
    <option value="evil_html">Evil HTML "&gt;</option>
  • When the control renders the corresponding element renders incorrectly in grid as
    " data-selected-value="evil_html">Evil HTML ">
    instead of the expected
    Evil HTML ">

I have attached a simple HTML test page, based on the demo page content, that demonstrates the issue.
multiselect-encoding-bug.html.zip
Edit the link and style tags in the HTML header to specify the location of the multiselect CSS and JavaScript files in your test environment.

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

No branches or pull requests

1 participant