-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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 code execution vulnerabilities. #2254
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When rendering the selected item for a single-select chosen, be sure to pass an escaped version of the select text (the html property, perhaps confusingly).
When the results container is rendered, be sure to use the escaped version of the contents instead of the unescaped version.
This was referenced Mar 3, 2015
pfiller
added a commit
that referenced
this pull request
Mar 3, 2015
Fix code execution vulnerabilities.
This was referenced Mar 4, 2015
satchmorun
pushed a commit
that referenced
this pull request
Jun 22, 2017
Before this change, if you tried to search for "&" to match "Stuff & Nonsense", what we would do is html-escape _both_ things and compare the escaped strings. This works fine in the case where you just type "&". However, if you type "mp", that will match the html entity "&" in the middle of the html-escaped text we're comparing it to. Which is incorrect. Additionally, we highlight our "matched" result. When we do, we break up the entity so that the resulting HTML looks like: Stuff &a<em>mp</em>; Nonsense And you get to see what basically looks like garbage on the screen. ![screen garbage](https://camo.githubusercontent.com/b5e384f3f622f3560739c287c481e05a7b0668af/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f7470786279757478626b747069347a2f6c7566336c7835792e706e67) This commit fixes all of that by just comparing the actual text of things. We avoid the problem previous addressed in #2254 by escaping each piece of the to-be-highlighted option text before assembling it into HTML.
satchmorun
pushed a commit
that referenced
this pull request
Aug 22, 2017
Before this change, if you tried to search for "&" to match "Stuff & Nonsense", what we would do is html-escape _both_ things and compare the escaped strings. This works fine in the case where you just type "&". However, if you type "mp", that will match the html entity "&" in the middle of the html-escaped text we're comparing it to. Which is incorrect. Additionally, we highlight our "matched" result. When we do, we break up the entity so that the resulting HTML looks like: Stuff &a<em>mp</em>; Nonsense And you get to see what basically looks like garbage on the screen. ![screen garbage](https://camo.githubusercontent.com/b5e384f3f622f3560739c287c481e05a7b0668af/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f7470786279757478626b747069347a2f6c7566336c7835792e706e67) This commit fixes all of that by just comparing the actual text of things. We avoid the problem previous addressed in #2254 by escaping each piece of the to-be-highlighted option text before assembling it into HTML.
satchmorun
pushed a commit
that referenced
this pull request
Aug 22, 2017
Before this change, if you tried to search for "&" to match "Stuff & Nonsense", what we would do is html-escape _both_ things and compare the escaped strings. This works fine in the case where you just type "&". However, if you type "mp", that will match the html entity "&" in the middle of the html-escaped text we're comparing it to. Which is incorrect. Additionally, we highlight our "matched" result. When we do, we break up the entity so that the resulting HTML looks like: Stuff &a<em>mp</em>; Nonsense And you get to see what basically looks like garbage on the screen. ![screen garbage](https://camo.githubusercontent.com/b5e384f3f622f3560739c287c481e05a7b0668af/68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f7370612f7470786279757478626b747069347a2f6c7566336c7835792e706e67) This commit fixes all of that by just comparing the actual text of things. We avoid the problem previous addressed in #2254 by escaping each piece of the to-be-highlighted option text before assembling it into HTML.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed a scripting vulnerability just now in
1.3.0
when rendering results — and upon checkingmaster
, not only is that one present, but there’s also another when rendering a single select’s selected option.Demo of the issue using chosen@
501568a
(current master): http://jsfiddle.net/hpv4La79/3/.Fixes #2132, replaces #2209, #1806. Effectively undoes #1638.