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.
Closes #111.
Notably, this test:
is incorrectly encoded and has been since 2007; and should never have passed with earlier versions of Loofah. The property value
background-image:52C8'a161332904a1c5248.10278.1053379'9
is garbage, but it's not potentially harmful garbage that needs to be scrubbed.This test was originally taken from OWASP's XSS cheat sheet, or a related source, and exists in that doc as:
but you'll notice that
\00XX
isn't how Ruby encodes unicode strings. Ruby uses\uXXXX
, so this test is an incorrect translation/encoding of the original intent.In addition, that original source contains an additional error, which is that
.1027
and.1053
should be\u0027
and\u0053
. Both errors are corrected in this PR.A short history of how encoding and typographical errors have propagated through this test in
html5lib
,loofah
,rails
, andrails-html-sanitizer
is at flavorjones/loofah#205 for anyone who's interested.