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

Fix XSS vulnerability #493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jimf
Copy link
Contributor

@jimf jimf commented Mar 12, 2021

Fixes a Cross-Site Scripting (XSS) vulnerability that would allow an attacker to execute arbitrary JavaScript if they had a way to input data that would ultimately be displayed in a Dropkick select (even if the <select> element itself were properly escaped). This was due to a code path that would set the innerHTML of a div to the .text property of a corresponding option node. If that text value contained valid HTML, the div would be built out with that HTML. This commit instead updates the logic to set innerHTML to the innerHTML of the option, which would appropriately carry over HTML entities, etc.

Here is a fiddle that reproduces the issue:

https://jsfiddle.net/L32ej60q/

Fixes a Cross-Site Scripting (XSS) vulnerability that would allow an
attacker to execute arbitrary JavaScript if they had a way to input data
that would ultimately be displayed in a Dropkick select (even if the
`<select>` element itself were properly escaped). This was due to a code
path that would set the `innerHTML` of a div to the `.text` property of
a corresponding option node.text`. If that text value contained valid
HTML, the div would be built out with that HTML. This commit instead
updates the logic to set `innerHTML` to the `innerHTML` of the option,
which would appropriately carry over HTML entities, etc.

Here is a fiddle that reproduces the issue:

https://jsfiddle.net/L32ej60q/
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